8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-24 10:43:03 +01:00

Fix problem with table reservation and views based in procedures

This commit is contained in:
asfernandes 2009-12-24 14:43:54 +00:00
parent 68308e907a
commit 9e3ebc4807
3 changed files with 12 additions and 4 deletions

View File

@ -35,10 +35,12 @@ class ViewContext
{ {
public: public:
explicit ViewContext(MemoryPool& p, const TEXT* context_name, explicit ViewContext(MemoryPool& p, const TEXT* context_name,
const TEXT* relation_name, USHORT context) : const TEXT* relation_name, USHORT context,
bool is_relation) :
vcx_context_name(p, context_name, strlen(context_name)), vcx_context_name(p, context_name, strlen(context_name)),
vcx_relation_name(relation_name), vcx_relation_name(relation_name),
vcx_context(context) vcx_context(context),
vcx_is_relation(is_relation)
{ {
} }
@ -50,6 +52,7 @@ public:
const Firebird::string vcx_context_name; const Firebird::string vcx_context_name;
const Firebird::MetaName vcx_relation_name; const Firebird::MetaName vcx_relation_name;
const USHORT vcx_context; const USHORT vcx_context;
const bool vcx_is_relation;
}; };
typedef Firebird::SortedArray<ViewContext*, Firebird::EmptyStorage<ViewContext*>, typedef Firebird::SortedArray<ViewContext*, Firebird::EmptyStorage<ViewContext*>,

View File

@ -4435,9 +4435,11 @@ static void lookup_view_contexts( thread_db* tdbb, jrd_rel* view)
// trim trailing spaces // trim trailing spaces
fb_utils::exact_name_limit(V.RDB$CONTEXT_NAME, sizeof(V.RDB$CONTEXT_NAME)); fb_utils::exact_name_limit(V.RDB$CONTEXT_NAME, sizeof(V.RDB$CONTEXT_NAME));
bool isProcedure = MET_lookup_procedure(tdbb, V.RDB$RELATION_NAME, true) != NULL;
ViewContext* view_context = FB_NEW(*dbb->dbb_permanent) ViewContext* view_context = FB_NEW(*dbb->dbb_permanent)
ViewContext(*dbb->dbb_permanent, ViewContext(*dbb->dbb_permanent, V.RDB$CONTEXT_NAME, V.RDB$RELATION_NAME,
V.RDB$CONTEXT_NAME, V.RDB$RELATION_NAME, V.RDB$VIEW_CONTEXT); V.RDB$VIEW_CONTEXT, !isProcedure);
view->rel_view_contexts.add(view_context); view->rel_view_contexts.add(view_context);

View File

@ -2323,6 +2323,9 @@ static void expand_view_lock(thread_db* tdbb, jrd_tra* transaction, jrd_rel* rel
for (size_t i = 0; i < ctx.getCount(); ++i) for (size_t i = 0; i < ctx.getCount(); ++i)
{ {
if (!ctx[i]->vcx_is_relation)
continue;
jrd_rel* base_rel = MET_lookup_relation(tdbb, ctx[i]->vcx_relation_name); jrd_rel* base_rel = MET_lookup_relation(tdbb, ctx[i]->vcx_relation_name);
if (!base_rel) if (!base_rel)
{ {