mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 21:23:03 +01:00
Misc.
This commit is contained in:
parent
891f2bf971
commit
888174719e
@ -262,6 +262,11 @@ void DYN_define_collation( Global* gbl, const UCHAR** ptr)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ASF: Our DDL strings is very weak.
|
||||||
|
// I've added isc_dyn_coll_specific_attributes_charset to pass the character set of a string.
|
||||||
|
// It may be the connection charset or some charset specified with INTRODUCER.
|
||||||
|
// Better approach is to pass DYN strings (including delimited identifiers) with the
|
||||||
|
// charset and reading it converting to CS_METADATA.
|
||||||
case isc_dyn_coll_specific_attributes_charset:
|
case isc_dyn_coll_specific_attributes_charset:
|
||||||
specific_attributes_charset = DYN_get_number(ptr);
|
specific_attributes_charset = DYN_get_number(ptr);
|
||||||
break;
|
break;
|
||||||
@ -273,7 +278,7 @@ void DYN_define_collation( Global* gbl, const UCHAR** ptr)
|
|||||||
isc_bpb_target_type, 1, isc_blob_text, isc_bpb_target_interp, 1, 0};
|
isc_bpb_target_type, 1, isc_blob_text, isc_bpb_target_interp, 1, 0};
|
||||||
|
|
||||||
bpb[6] = specific_attributes_charset; // from charset
|
bpb[6] = specific_attributes_charset; // from charset
|
||||||
bpb[12] = CS_UNICODE_FSS; // to charset
|
bpb[12] = CS_METADATA; // to charset
|
||||||
|
|
||||||
X.RDB$SPECIFIC_ATTRIBUTES.NULL = FALSE;
|
X.RDB$SPECIFIC_ATTRIBUTES.NULL = FALSE;
|
||||||
DYN_put_text_blob(gbl, ptr, &X.RDB$SPECIFIC_ATTRIBUTES, sizeof(bpb), bpb);
|
DYN_put_text_blob(gbl, ptr, &X.RDB$SPECIFIC_ATTRIBUTES, sizeof(bpb), bpb);
|
||||||
@ -294,6 +299,7 @@ void DYN_define_collation( Global* gbl, const UCHAR** ptr)
|
|||||||
strcpy(X.RDB$COLLATION_NAME, collation_name.c_str());
|
strcpy(X.RDB$COLLATION_NAME, collation_name.c_str());
|
||||||
X.RDB$COLLATION_ATTRIBUTES = (info.attributes | attributes_on) & (~attributes_off);
|
X.RDB$COLLATION_ATTRIBUTES = (info.attributes | attributes_on) & (~attributes_off);
|
||||||
|
|
||||||
|
// If isc_dyn_coll_specific_attributes is not provided, then inherit from the base collation
|
||||||
if (X.RDB$SPECIFIC_ATTRIBUTES.NULL && info.specificAttributes.getCount() != 0)
|
if (X.RDB$SPECIFIC_ATTRIBUTES.NULL && info.specificAttributes.getCount() != 0)
|
||||||
{
|
{
|
||||||
X.RDB$SPECIFIC_ATTRIBUTES.NULL = FALSE;
|
X.RDB$SPECIFIC_ATTRIBUTES.NULL = FALSE;
|
||||||
@ -313,7 +319,7 @@ void DYN_define_collation( Global* gbl, const UCHAR** ptr)
|
|||||||
else
|
else
|
||||||
info.baseCollationName = X.RDB$BASE_COLLATION_NAME;
|
info.baseCollationName = X.RDB$BASE_COLLATION_NAME;
|
||||||
info.attributes = X.RDB$COLLATION_ATTRIBUTES;
|
info.attributes = X.RDB$COLLATION_ATTRIBUTES;
|
||||||
info.ignore_attributes = false;
|
info.ignoreAttributes = false;
|
||||||
|
|
||||||
if (!IntlManager::collationInstalled(info.baseCollationName, info.charsetName))
|
if (!IntlManager::collationInstalled(info.baseCollationName, info.charsetName))
|
||||||
{
|
{
|
||||||
|
@ -657,14 +657,14 @@ TextType* CharSetContainer::lookupCollation(thread_db* tdbb, USHORT tt_id)
|
|||||||
{
|
{
|
||||||
CharSet* charset = INTL_charset_lookup(tdbb, TTYPE_TO_CHARSET(tt_id), NULL);
|
CharSet* charset = INTL_charset_lookup(tdbb, TTYPE_TO_CHARSET(tt_id), NULL);
|
||||||
|
|
||||||
if (TTYPE_TO_CHARSET(tt_id) != CS_UNICODE_FSS)
|
if (TTYPE_TO_CHARSET(tt_id) != CS_METADATA)
|
||||||
{
|
{
|
||||||
Firebird::HalfStaticArray<UCHAR, 32> specificAttributes;
|
Firebird::HalfStaticArray<UCHAR, 32> specificAttributes;
|
||||||
ULONG size = info.specificAttributes.getCount() * charset->maxBytesPerChar();
|
ULONG size = info.specificAttributes.getCount() * charset->maxBytesPerChar();
|
||||||
|
|
||||||
size = INTL_convert_bytes(tdbb, TTYPE_TO_CHARSET(tt_id),
|
size = INTL_convert_bytes(tdbb, TTYPE_TO_CHARSET(tt_id),
|
||||||
specificAttributes.getBuffer(size), size,
|
specificAttributes.getBuffer(size), size,
|
||||||
CS_UNICODE_FSS, info.specificAttributes.begin(),
|
CS_METADATA, info.specificAttributes.begin(),
|
||||||
info.specificAttributes.getCount(), ERR_post);
|
info.specificAttributes.getCount(), ERR_post);
|
||||||
specificAttributes.shrink(size);
|
specificAttributes.shrink(size);
|
||||||
info.specificAttributes = specificAttributes;
|
info.specificAttributes = specificAttributes;
|
||||||
@ -773,7 +773,7 @@ static INTL_BOOL lookup_texttype(texttype* tt, const SubtypeInfo* info)
|
|||||||
{
|
{
|
||||||
return IntlManager::lookupCollation(info->baseCollationName, info->charsetName,
|
return IntlManager::lookupCollation(info->baseCollationName, info->charsetName,
|
||||||
info->attributes, info->specificAttributes.begin(),
|
info->attributes, info->specificAttributes.begin(),
|
||||||
info->specificAttributes.getCount(), info->ignore_attributes, tt);
|
info->specificAttributes.getCount(), info->ignoreAttributes, tt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1015,7 +1015,7 @@ bool MET_get_char_coll_subtype_info(thread_db* tdbb, SSHORT id, SubtypeInfo* inf
|
|||||||
}
|
}
|
||||||
|
|
||||||
info->attributes = (USHORT)CL.RDB$COLLATION_ATTRIBUTES;
|
info->attributes = (USHORT)CL.RDB$COLLATION_ATTRIBUTES;
|
||||||
info->ignore_attributes = CL.RDB$COLLATION_ATTRIBUTES.NULL;
|
info->ignoreAttributes = CL.RDB$COLLATION_ATTRIBUTES.NULL;
|
||||||
END_FOR;
|
END_FOR;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1037,8 +1037,8 @@ bool MET_get_char_coll_subtype_info(thread_db* tdbb, SSHORT id, SubtypeInfo* inf
|
|||||||
|
|
||||||
info->baseCollationName = info->collationName;
|
info->baseCollationName = info->collationName;
|
||||||
info->specificAttributes.clear();
|
info->specificAttributes.clear();
|
||||||
info->attributes = (USHORT)CL.RDB$COLLATION_ATTRIBUTES;
|
info->attributes = 0;
|
||||||
info->ignore_attributes = true;
|
info->ignoreAttributes = true;
|
||||||
END_FOR;
|
END_FOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ struct SubtypeInfo
|
|||||||
Firebird::string collationName;
|
Firebird::string collationName;
|
||||||
Firebird::string baseCollationName;
|
Firebird::string baseCollationName;
|
||||||
USHORT attributes;
|
USHORT attributes;
|
||||||
bool ignore_attributes;
|
bool ignoreAttributes;
|
||||||
Firebird::HalfStaticArray<UCHAR, 32> specificAttributes;
|
Firebird::HalfStaticArray<UCHAR, 32> specificAttributes;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user