integer overflow exception

In this forum we will discuss things relating the ZEOSLib 6.6.x stable versions

Moderators: gto, EgonHugeist

Post Reply
vincentfranssen
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 08.09.2005, 09:57

integer overflow exception

Post by vincentfranssen »

I get an unexpected integer overflow when i try to update an integerfield of a postgres 8.4 table thats holding a value over 0x3FFFFFFF.

Tested combinations Delphi 7/Zeos6.6.6/Postgresl8.4

Example Code 1: Works

zquery1.edit;
zquery1.fieldByName('identifier').asInteger:= 1073741823; // = 0x3FFFFFFF;
zquery1.post;

zquery1.edit;
zquery1.fieldByName('identifier').asInteger:= -1073741823; // = 0x3FFFFFFF;
zquery1.post;

Identifier is an integer field of a postgresql 8.4 table

Example Code 2: Fails

zquery1.edit;
zquery1.fieldByName('identifier').asInteger:= 1073741824; // = 0x40000000;
zquery1.post;

zquery1.edit;
zquery1.fieldByName('identifier').asInteger:= -1073741824; // = -0x40000000;
zquery1.post;

Example Code 3 : Works But is of course no solution

zquery1.edit;
zquery1.fieldByName('identifier').asInteger:= 0; ;
zquery1.post;

zquery1.edit;
zquery1.fieldByName('identifier').asInteger:= 1073741824; // = 0x40000000;
zquery1.post;

zquery1.edit;
zquery1.fieldByName('identifier').asInteger:= 0;
zquery1.post;

zquery1.edit;
zquery1.fieldByName('identifier').asInteger:= -1073741824; // = -0x40000000;;
zquery1.post;
Post Reply