Page 1 of 1

TZRowAccessor.CompareBuffers

Posted: 18.08.2014, 09:37
by aebi
Hello,

in some situation there seems to be a problem in the function mentioned above :
...
stInteger:
Result := PInteger(ValuePtr1)^ - PInteger(ValuePtr2)^;
...

the "old" value in my integer-column is somewhat with 3.000.000, the new one is about -2.147.480.000.

Both values are inside the signed-integer-range (-2.147.483.648 .. +2.147.483.647), but the result of
3.000.000 - (-2.147.480.000) = 2.150.480.000 is not - Delphi raises an exception.

Same situation may occur with Int64, because the function "CompareInt64" uses the same calculation and "Integer" as result.

Because "CompareInt64" inside "CompareBuffers" (and also the other "CompareXY" functions) normally just return "1", "0" or "-1", will it be possible to do this also with "stInteger" (but with a different calculation, of cause) ?

Thanks,
with best regards
Andreas

Re: TZRowAccessor.CompareBuffers

Posted: 24.08.2014, 22:12
by EgonHugeist
Hi,

you're damn right! Did commit a fix with better code alignment: R3281 \testing-7.2 (SVN). This will resolve this longstanding bug! :nurse:

Re: TZRowAccessor.CompareBuffers

Posted: 25.08.2014, 06:37
by aebi
Hi,

Thank You for the patch, it is very helpfull for me.

With best regards
Andreas