mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 14:03:07 +01:00
Fixed CORE-1432 - Collation not propagated between record formats
This commit is contained in:
parent
e138f3b559
commit
cf7ae27db5
@ -5456,8 +5456,11 @@ jrd_nod* CMP_pass2(thread_db* tdbb, CompilerScratch* csb, jrd_nod* const node, j
|
||||
// SMB_SET uses ULONG, not USHORT
|
||||
const ULONG id = (ULONG)(IPTR) node->nod_arg[e_fld_id];
|
||||
SBM_SET(tdbb->getDefaultPool(), &csb->csb_rpt[stream].csb_fields, id);
|
||||
if (csb->csb_rpt[stream].csb_relation || csb->csb_rpt[stream].csb_procedure)
|
||||
node->nod_arg[e_fld_format] = (jrd_nod*) CMP_format(tdbb, csb, stream);
|
||||
csb->csb_impure += sizeof(impure_value_ex);
|
||||
break;
|
||||
}
|
||||
// FALL INTO
|
||||
|
||||
case nod_argument:
|
||||
case nod_variable:
|
||||
|
@ -894,18 +894,52 @@ dsc* EVL_expr(thread_db* tdbb, jrd_nod* const node)
|
||||
|
||||
case nod_field:
|
||||
{
|
||||
Record* record = request->req_rpb[(int) (IPTR)node->nod_arg[e_fld_stream]].rpb_record;
|
||||
jrd_rel* relation = request->req_rpb[(USHORT)(IPTR) node->nod_arg[e_fld_stream]].rpb_relation;
|
||||
/* In order to "map a null to a default" value (in EVL_field()),
|
||||
* the relation block is referenced.
|
||||
* Reference: Bug 10116, 10424
|
||||
*/
|
||||
if (!EVL_field(relation,
|
||||
record,
|
||||
(USHORT)(IPTR) node->nod_arg[e_fld_id],
|
||||
&impure->vlu_desc))
|
||||
{
|
||||
USHORT id = (USHORT)(IPTR) node->nod_arg[e_fld_id];
|
||||
record_param& rpb = request->req_rpb[(USHORT)(IPTR) node->nod_arg[e_fld_stream]];
|
||||
Record* record = rpb.rpb_record;
|
||||
jrd_rel* relation = rpb.rpb_relation;
|
||||
// In order to "map a null to a default" value (in EVL_field()),
|
||||
// the relation block is referenced.
|
||||
// Reference: Bug 10116, 10424
|
||||
|
||||
if (!EVL_field(relation, record, id, &impure->vlu_desc))
|
||||
request->req_flags |= req_null;
|
||||
else
|
||||
{
|
||||
Format* compileFormat = (Format*) node->nod_arg[e_fld_format];
|
||||
|
||||
// ASF: CORE-1432 - If the the record is not on the latest format, upgrade it.
|
||||
if (compileFormat &&
|
||||
record->rec_format->fmt_version != compileFormat->fmt_version &&
|
||||
!DSC_EQUIV(&impure->vlu_desc, &compileFormat->fmt_desc[id], true))
|
||||
{
|
||||
dsc desc = impure->vlu_desc;
|
||||
impure->vlu_desc = compileFormat->fmt_desc[id];
|
||||
|
||||
if (impure->vlu_desc.isText())
|
||||
{
|
||||
// Allocate a string block of sufficient size.
|
||||
VaryingString* string = impure->vlu_string;
|
||||
if (string && string->str_length < impure->vlu_desc.dsc_length)
|
||||
{
|
||||
delete string;
|
||||
string = NULL;
|
||||
}
|
||||
|
||||
if (!string)
|
||||
{
|
||||
string = impure->vlu_string = FB_NEW_RPT(*tdbb->getDefaultPool(),
|
||||
impure->vlu_desc.dsc_length) VaryingString();
|
||||
string->str_length = impure->vlu_desc.dsc_length;
|
||||
}
|
||||
|
||||
impure->vlu_desc.dsc_address = string->str_data;
|
||||
}
|
||||
else
|
||||
impure->vlu_desc.dsc_address = (UCHAR*) &impure->vlu_misc;
|
||||
|
||||
MOV_move(tdbb, &desc, &impure->vlu_desc);
|
||||
}
|
||||
}
|
||||
|
||||
if (!relation || !(relation->rel_flags & REL_system))
|
||||
|
@ -305,8 +305,9 @@ const int e_msg_length = 4;
|
||||
|
||||
const int e_fld_stream = 0;
|
||||
const int e_fld_id = 1;
|
||||
const int e_fld_default_value = 2; // hold column default value info if any, (Literal*)
|
||||
const int e_fld_length = 3;
|
||||
const int e_fld_format = 2; // relation or procedure latest format when compiling
|
||||
const int e_fld_default_value = 3; // hold column default value info if any, (Literal*)
|
||||
const int e_fld_length = 4;
|
||||
|
||||
const int e_sto_statement = 0;
|
||||
const int e_sto_statement2 = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user