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

More fixes for CORE-3557.

This commit is contained in:
dimitr 2012-05-17 08:08:26 +00:00
parent f5bc3dee8c
commit 34e13e6189

View File

@ -552,7 +552,8 @@ jrd_nod* PAR_make_field(thread_db* tdbb, CompilerScratch* csb,
**************************************/ **************************************/
SET_TDBB(tdbb); SET_TDBB(tdbb);
const USHORT stream = csb->csb_rpt[context].csb_stream; const CompilerScratch::csb_repeat* const tail = CMP_csb_element(csb, context);
const USHORT stream = tail->csb_stream;
/* CVC: This is just another case of a custom function that isn't prepared /* CVC: This is just another case of a custom function that isn't prepared
for quoted identifiers and that causes views with fields names like "z x" for quoted identifiers and that causes views with fields names like "z x"
@ -563,11 +564,12 @@ jrd_nod* PAR_make_field(thread_db* tdbb, CompilerScratch* csb,
mysterious message "cannot access column z x in view VF" when selecting from mysterious message "cannot access column z x in view VF" when selecting from
such view that has field "z x". This closes Firebird Bug #227758. */ such view that has field "z x". This closes Firebird Bug #227758. */
// solved by using MetaName& as parameter - AP // solved by using MetaName& as parameter - AP
jrd_rel* relation = csb->csb_rpt[stream].csb_relation; jrd_rel* const relation = tail->csb_relation;
jrd_prc* procedure = csb->csb_rpt[stream].csb_procedure; jrd_prc* const procedure = tail->csb_procedure;
const SSHORT id = procedure ? find_proc_field(procedure, base_field) : const SSHORT id =
MET_lookup_field (tdbb, csb->csb_rpt[stream].csb_relation, base_field); relation ? MET_lookup_field(tdbb, relation, base_field) :
procedure ? find_proc_field(procedure, base_field) : -1;
if (id < 0) if (id < 0)
return NULL; return NULL;
@ -607,6 +609,7 @@ jrd_nod* PAR_make_field(thread_db* tdbb, CompilerScratch* csb,
if (!relation->rel_fields) { if (!relation->rel_fields) {
ERR_post(Arg::Gds(isc_depend_on_uncommitted_rel)); ERR_post(Arg::Gds(isc_depend_on_uncommitted_rel));
} }
field = (*relation->rel_fields)[id]; field = (*relation->rel_fields)[id];
} }
@ -614,7 +617,7 @@ jrd_nod* PAR_make_field(thread_db* tdbb, CompilerScratch* csb,
par_dependency(tdbb, csb, stream, id, base_field); par_dependency(tdbb, csb, stream, id, base_field);
} }
jrd_nod* temp_node = PAR_gen_field(tdbb, stream, id); jrd_nod* const temp_node = PAR_gen_field(tdbb, stream, id);
/* /*
if (param) if (param)
{ {
@ -1396,27 +1399,26 @@ static jrd_nod* par_field(thread_db* tdbb, CompilerScratch* csb, SSHORT blr_oper
if (is_column) if (is_column)
{ {
jrd_rel* temp_rel = csb->csb_rpt[stream].csb_relation; const jrd_rel* const temp_rel = csb->csb_rpt[stream].csb_relation;
if (temp_rel) if (temp_rel)
{ {
jrd_fld* field; fb_assert(id >= 0);
if (id < (int) temp_rel->rel_fields->count() && (field = (*temp_rel->rel_fields)[id])) if (temp_rel->rel_fields && id < (int) temp_rel->rel_fields->count())
{ {
if (field->fld_default_value && field->fld_not_null) const jrd_fld* const field = (*temp_rel->rel_fields)[id];
if (field && field->fld_default_value && field->fld_not_null)
node->nod_arg[e_fld_default_value] = field->fld_default_value; node->nod_arg[e_fld_default_value] = field->fld_default_value;
} }
else else if (temp_rel->rel_flags & REL_system)
{
if (temp_rel->rel_flags & REL_system)
{ {
node = PAR_make_node(tdbb, 0); node = PAR_make_node(tdbb, 0);
node->nod_type = nod_null; node->nod_type = nod_null;
} }
} }
} }
}
return node; return node;
} }