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

Let's create varchar columns with the length defined in fields.h. No more weird 253 and 78 bytes.

This change requires everybody to boot-build and recreate already existing ODS 11.2 databases.
This commit is contained in:
dimitr 2008-02-20 13:17:54 +00:00
parent ab5d5dcd3a
commit 9fa724a658

View File

@ -544,7 +544,7 @@ USHORT INI_get_trig_flags(const TEXT* trig_name)
}
void INI_init(void)
void INI_init()
{
/**************************************
*
@ -603,6 +603,8 @@ void INI_init(void)
{
const gfld* gfield = &gfields[fld[RFLD_F_ID]];
desc->dsc_length = gfield->gfld_length;
if (gfield->gfld_dtype == dtype_varying)
desc->dsc_length += sizeof(USHORT);
desc->dsc_dtype = gfield->gfld_dtype;
desc->dsc_sub_type = gfield->gfld_sub_type;
if (desc->dsc_dtype == dtype_blob && desc->dsc_sub_type == isc_blob_text)
@ -616,7 +618,7 @@ void INI_init(void)
}
void INI_init2(void)
void INI_init2()
{
/**************************************
*
@ -765,14 +767,20 @@ void INI_init2(void)
format->fmt_length = (USHORT)MET_align(dbb, &(*desc), format->fmt_length);
desc->dsc_address = (UCHAR*) (IPTR) format->fmt_length;
/* In ODS11 length of RDB$MESSAGES are
enlarged from 80 to 1023 bytes */
// In ODS11 length of RDB$MESSAGES are enlarged from 80 to 1023 bytes
if ((fld[RFLD_F_NAME] == nam_msg) &&
(major_version < ODS_VERSION11))
{
desc->dsc_length = 80;
}
// In ODS prior to 11.2 all varchar columns were actually
// two bytes shorter than defined in fields.h
if (ENCODE_ODS(major_version, minor_original) < ODS_11_2)
{
desc->dsc_length -= sizeof(USHORT);
}
format->fmt_length += desc->dsc_length;
}
}
@ -1508,7 +1516,6 @@ static void store_global_field(thread_db* tdbb, const gfld* gfield, jrd_req** ha
else
{
X.RDB$FIELD_TYPE = (int) blr_varying;
X.RDB$FIELD_LENGTH -= sizeof(USHORT);
}
if (gfield->gfld_sub_type == dsc_text_type_metadata)
{