Sorting of TWideMemo-field
Posted: 11.05.2017, 16:35
Database used : MySQL.
When in a TZQuery, the field name of a ftWideMemo-column (from a MySQL TEXT datatype) is assigned to SortedFields, sorting does not work. It did work in 7.1.4 though, and it also works in a TZReadOnlyQuery.
The problem can be tracked down to the following code in ZDbcCache, I think, where in case of a stAsciiStream or an stUnicodeStream (to which the memo-field translates) no alternative is given for CompareNothing when CompareKind is ckAscending or ckDescending. Only the ckEquals case is considered there.
Can anyone point me in the correct direction to fix this ? I am not sure if I can copy some code of the stString/stUnicodeString case to the stAsciiStream/stUnicodeStream case to make sorting work again ?
When in a TZQuery, the field name of a ftWideMemo-column (from a MySQL TEXT datatype) is assigned to SortedFields, sorting does not work. It did work in 7.1.4 though, and it also works in a TZReadOnlyQuery.
The problem can be tracked down to the following code in ZDbcCache, I think, where in case of a stAsciiStream or an stUnicodeStream (to which the memo-field translates) no alternative is given for CompareNothing when CompareKind is ckAscending or ckDescending. Only the ckEquals case is considered there.
Can anyone point me in the correct direction to fix this ? I am not sure if I can copy some code of the stString/stUnicodeString case to the stAsciiStream/stUnicodeStream case to make sorting work again ?
Code: Select all
function TZRowAccessor.GetCompareFunc(ColumnIndex: Integer;
const CompareKind: TComparisonKind): TCompareFunc;
begin
Result := CompareNothing;
case FColumnTypes[ColumnIndex{$IFNDEF GENERIC_INDEX}-1{$ENDIF}] of
stBoolean:
case CompareKind of
[...]
stString, stUnicodeString:
[...]
stAsciiStream, stUnicodeStream:
if CompareKind = ckEquals then
if ConSettings^.CPType in [cCP_UTF16, cCP_UTF8] then
Result := CompareUnicodeCLob_Equals
else
Result := CompareNativeCLob_Equals;
end;
end;