[bug_fixed] error handling stUnicodeStream in ZDbcCache.pas
Posted: 29.05.2007, 14:01
bug report: error handling stUnicodeStream in ZDbcCache.pas
TZRowAccessor.CompareBuffers doesn't handle stUnicodeStream right way.
the code is:
but obviously there should be:
[suggested solution]
(scope)
======== [component\ZAbstractDataset.pas] ========
function TZRowAccessor.CompareBuffers(Buffer1, Buffer2: PZRowBuffer;
ColumnIndices: TIntegerDynArray; ColumnDirs: TBooleanDynArray): Integer;
(origin)
{
else if FColumnTypes[ColumnIndex] = stAsciiStream then
{$IFNDEF VER130BELOW}
Result := WideCompareStr(Blob1.GetUnicodeString, Blob2.GetUnicodeString);
{$ELSE}
Result := AnsiCompareStr(Blob1.GetString, Blob2.GetString);
{$ENDIF}
}
(change into)
{
else if FColumnTypes[ColumnIndex] = stUnicodeStream then
{$IFNDEF VER130BELOW}
Result := WideCompareStr(Blob1.GetUnicodeString, Blob2.GetUnicodeString);
{$ELSE}
Result := AnsiCompareStr(Blob1.GetString, Blob2.GetString);
{$ENDIF}
}
[platform notes]
zeosdbo-6.6.1-beta
delphi7
TZRowAccessor.CompareBuffers doesn't handle stUnicodeStream right way.
the code is:
Code: Select all
function TZRowAccessor.CompareBuffers(Buffer1, Buffer2: PZRowBuffer;
ColumnIndices: TIntegerDynArray; ColumnDirs: TBooleanDynArray): Integer;
...
else if FColumnTypes[ColumnIndex] = stAsciiStream then
Result := AnsiCompareStr(Blob1.GetString, Blob2.GetString)
else if FColumnTypes[ColumnIndex] = stBinaryStream then
Result := CompareStr(Blob1.GetString, Blob2.GetString)
else if FColumnTypes[ColumnIndex] = stAsciiStream then
{$IFNDEF VER130BELOW}
Result := WideCompareStr(Blob1.GetUnicodeString, Blob2.GetUnicodeString);
{$ELSE}
Result := AnsiCompareStr(Blob1.GetString, Blob2.GetString);
{$ENDIF}
Code: Select all
function TZRowAccessor.CompareBuffers(Buffer1, Buffer2: PZRowBuffer;
ColumnIndices: TIntegerDynArray; ColumnDirs: TBooleanDynArray): Integer;
...
else if FColumnTypes[ColumnIndex] = stAsciiStream then
Result := AnsiCompareStr(Blob1.GetString, Blob2.GetString)
else if FColumnTypes[ColumnIndex] = stBinaryStream then
Result := CompareStr(Blob1.GetString, Blob2.GetString)
// here goes the difference
else if FColumnTypes[ColumnIndex] = stUnicodeStream then
{$IFNDEF VER130BELOW}
Result := WideCompareStr(Blob1.GetUnicodeString, Blob2.GetUnicodeString);
{$ELSE}
Result := AnsiCompareStr(Blob1.GetString, Blob2.GetString);
{$ENDIF}
[suggested solution]
(scope)
======== [component\ZAbstractDataset.pas] ========
function TZRowAccessor.CompareBuffers(Buffer1, Buffer2: PZRowBuffer;
ColumnIndices: TIntegerDynArray; ColumnDirs: TBooleanDynArray): Integer;
(origin)
{
else if FColumnTypes[ColumnIndex] = stAsciiStream then
{$IFNDEF VER130BELOW}
Result := WideCompareStr(Blob1.GetUnicodeString, Blob2.GetUnicodeString);
{$ELSE}
Result := AnsiCompareStr(Blob1.GetString, Blob2.GetString);
{$ENDIF}
}
(change into)
{
else if FColumnTypes[ColumnIndex] = stUnicodeStream then
{$IFNDEF VER130BELOW}
Result := WideCompareStr(Blob1.GetUnicodeString, Blob2.GetUnicodeString);
{$ELSE}
Result := AnsiCompareStr(Blob1.GetString, Blob2.GetString);
{$ENDIF}
}
[platform notes]
zeosdbo-6.6.1-beta
delphi7