mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 17:23:03 +01:00
Changed attribute name NUMERIC to NUMERIC-SORT - sugested by Claudio
This commit is contained in:
parent
d868936aab
commit
23e4059ce5
@ -277,18 +277,18 @@ Format: SPECIALS-FIRST={0 | 1}
|
||||
Example: SPECIALS-FIRST=1
|
||||
|
||||
|
||||
NUMERIC: Specify how numbers are sorted.
|
||||
NUMERIC-SORT: Specify how numbers are sorted.
|
||||
Valid for: UNICODE collations.
|
||||
Format: NUMERIC={0 | 1} (0 is the default)
|
||||
Format: NUMERIC-SORT={0 | 1} (0 is the default)
|
||||
|
||||
NUMERIC=0 sorts number in alphabetic order. Example:
|
||||
NUMERIC-SORT=0 sorts number in alphabetic order. Example:
|
||||
1
|
||||
10
|
||||
100
|
||||
2
|
||||
20
|
||||
|
||||
NUMERIC=1 sorts number in numeric order. Example:
|
||||
NUMERIC-SORT=1 sorts number in numeric order. Example:
|
||||
1
|
||||
2
|
||||
10
|
||||
|
@ -125,7 +125,7 @@ void ClumpletWriter::toVaxInteger(UCHAR* ptr, size_t length, SINT64 value)
|
||||
{
|
||||
int shift = 0;
|
||||
while (length--) {
|
||||
*ptr++ = (UCHAR)(value >> shift);
|
||||
*ptr++ = (UCHAR) (value >> shift);
|
||||
shift += 8;
|
||||
}
|
||||
}
|
||||
|
@ -1855,16 +1855,18 @@ UCHAR* ISC_map_file(
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!init_flag && GetLastError() != ERROR_ALREADY_EXISTS)
|
||||
{
|
||||
/* We have made header_obj but we are not initializing
|
||||
Previous owner is closed and clear all header_data.
|
||||
One need to retry */
|
||||
// We have made header_obj but we are not initializing.
|
||||
// Previous owner is closed and clear all header_data.
|
||||
// One need to retry.
|
||||
CloseHandle(header_obj);
|
||||
CloseHandle(event_handle);
|
||||
CloseHandle(file_handle);
|
||||
goto retry;
|
||||
}
|
||||
}
|
||||
|
||||
SLONG* header_address =
|
||||
(SLONG*) MapViewOfFile(header_obj, FILE_MAP_WRITE, 0, 0, 0);
|
||||
|
@ -954,13 +954,13 @@ UnicodeUtil::Utf16Collation* UnicodeUtil::Utf16Collation::create(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
string numeric;
|
||||
if (specificAttributes.get(IntlUtil::convertAsciiToUtf16("NUMERIC"), numeric))
|
||||
string numericSort;
|
||||
if (specificAttributes.get(IntlUtil::convertAsciiToUtf16("NUMERIC-SORT"), numericSort))
|
||||
{
|
||||
++attributeCount;
|
||||
|
||||
numeric = IntlUtil::convertUtf16ToAscii(numeric, &error);
|
||||
if (error || !(numeric == "0" || numeric == "1"))
|
||||
numericSort = IntlUtil::convertUtf16ToAscii(numericSort, &error);
|
||||
if (error || !(numericSort == "0" || numericSort == "1"))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -1025,8 +1025,8 @@ UnicodeUtil::Utf16Collation* UnicodeUtil::Utf16Collation::create(
|
||||
else
|
||||
tt->texttype_flags = TEXTTYPE_DIRECT_MATCH;
|
||||
|
||||
const bool isNumeric = numeric == "1";
|
||||
if (isNumeric)
|
||||
const bool isNumericSort = numericSort == "1";
|
||||
if (isNumericSort)
|
||||
{
|
||||
icu->ucolSetAttribute(compareCollator, UCOL_NUMERIC_COLLATION, UCOL_ON, &status);
|
||||
icu->ucolSetAttribute(partialCollator, UCOL_NUMERIC_COLLATION, UCOL_ON, &status);
|
||||
@ -1046,7 +1046,7 @@ UnicodeUtil::Utf16Collation* UnicodeUtil::Utf16Collation::create(
|
||||
obj->sortCollator = sortCollator;
|
||||
obj->contractions = contractions;
|
||||
obj->contractionsCount = icu->usetGetItemCount(contractions);
|
||||
obj->numeric = isNumeric;
|
||||
obj->numericSort = isNumericSort;
|
||||
|
||||
return obj;
|
||||
}
|
||||
@ -1127,8 +1127,10 @@ USHORT UnicodeUtil::Utf16Collation::stringToKey(USHORT srcLen, const USHORT* src
|
||||
}
|
||||
}
|
||||
|
||||
if (numeric)
|
||||
if (numericSort)
|
||||
{
|
||||
// ASF: Wee need to remove trailing numbers to return sub key that
|
||||
// matches full key. Example: "abc1" becomes "abc" to match "abc10".
|
||||
const USHORT* p = src + srcLen - 1;
|
||||
|
||||
for (; p >= src; --p)
|
||||
|
@ -103,7 +103,7 @@ public:
|
||||
UCollator* sortCollator;
|
||||
USet* contractions;
|
||||
int contractionsCount;
|
||||
bool numeric;
|
||||
bool numericSort;
|
||||
};
|
||||
|
||||
friend class Utf16Collation;
|
||||
|
Loading…
Reference in New Issue
Block a user