TZRowAccessor.CompareBuffers

The official tester's forum for ZeosLib 7.1. Ask for help, post proposals or solutions.
Post Reply
User avatar
aebi
Fresh Boarder
Fresh Boarder
Posts: 24
Joined: 02.05.2006, 10:26

TZRowAccessor.CompareBuffers

Post 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
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Re: TZRowAccessor.CompareBuffers

Post 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:
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
User avatar
aebi
Fresh Boarder
Fresh Boarder
Posts: 24
Joined: 02.05.2006, 10:26

Re: TZRowAccessor.CompareBuffers

Post by aebi »

Hi,

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

With best regards
Andreas
Post Reply