mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-24 09:23:03 +01:00
Fixed CORE-1802 - Maximum key size using PXW_CSY collation
This commit is contained in:
parent
7bc95f13fc
commit
ff80913a1b
@ -105,36 +105,34 @@ USHORT LC_NARROW_key_length(texttype* obj, USHORT inLen)
|
|||||||
{
|
{
|
||||||
BYTE bytesPerChar = 3;
|
BYTE bytesPerChar = 3;
|
||||||
|
|
||||||
// if collation is not multi-level, the weights used is already know
|
// scan the table to identify what weights are used
|
||||||
|
bool useSecondary = false;
|
||||||
|
bool useTertiary = false;
|
||||||
|
|
||||||
|
for (int ch = 0; ch <= 255; ++ch)
|
||||||
|
{
|
||||||
|
const SortOrderTblEntry* coll =
|
||||||
|
&((const SortOrderTblEntry*)obj->texttype_impl->texttype_collation_table)[ch];
|
||||||
|
|
||||||
|
if (coll->Secondary != NULL_SECONDARY)
|
||||||
|
useSecondary = true;
|
||||||
|
|
||||||
|
if (coll->Tertiary != NULL_TERTIARY)
|
||||||
|
useTertiary = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!useSecondary)
|
||||||
|
--bytesPerChar;
|
||||||
|
|
||||||
|
if (!useTertiary)
|
||||||
|
--bytesPerChar;
|
||||||
|
|
||||||
if (obj->texttype_impl->texttype_flags & TEXTTYPE_non_multi_level)
|
if (obj->texttype_impl->texttype_flags & TEXTTYPE_non_multi_level)
|
||||||
{
|
{
|
||||||
if (obj->texttype_impl->texttype_flags & TEXTTYPE_secondary_insensitive)
|
if (useSecondary && (obj->texttype_impl->texttype_flags & TEXTTYPE_secondary_insensitive))
|
||||||
--bytesPerChar;
|
--bytesPerChar;
|
||||||
|
|
||||||
if (obj->texttype_impl->texttype_flags & TEXTTYPE_tertiary_insensitive)
|
if (useTertiary && (obj->texttype_impl->texttype_flags & TEXTTYPE_tertiary_insensitive))
|
||||||
--bytesPerChar;
|
|
||||||
}
|
|
||||||
else // scan the table to identify what weights are used
|
|
||||||
{
|
|
||||||
bool useSecondary = false;
|
|
||||||
bool useTertiary = false;
|
|
||||||
|
|
||||||
for (int ch = 0; ch <= 255; ++ch)
|
|
||||||
{
|
|
||||||
const SortOrderTblEntry* coll =
|
|
||||||
&((const SortOrderTblEntry*)obj->texttype_impl->texttype_collation_table)[ch];
|
|
||||||
|
|
||||||
if (coll->Secondary != NULL_SECONDARY)
|
|
||||||
useSecondary = true;
|
|
||||||
|
|
||||||
if (coll->Tertiary != NULL_TERTIARY)
|
|
||||||
useTertiary = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!useSecondary)
|
|
||||||
--bytesPerChar;
|
|
||||||
|
|
||||||
if (!useTertiary)
|
|
||||||
--bytesPerChar;
|
--bytesPerChar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user