ERangeError in GetMySQLColumnInfoFromFieldHandle

The alpha/beta tester's forum for ZeosLib 7.0.x series

Report problems concerning our Delphi 2009+ version and new Zeoslib 7.0 features here.

This is a forum that will be removed once the 7.X version goes into stable!!

Moderators: gto, EgonHugeist, olehs

Locked
ga_301
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 13.09.2012, 14:28

ERangeError in GetMySQLColumnInfoFromFieldHandle

Post by ga_301 »

The type integer of the Fieldlength variable in ZdbcMySQLUtils.pas, function GetMySQLColumnInfoFromFieldHandle does not match the return type ULong of IZMySQLPlainDriver.GetFieldLength.

I get a range check error when executing my code.
Please check.

Kind regards
Gunnar Adams
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Post by EgonHugeist »

ga_301,

hi gunnar. What happens? Currently the PULong is defined as a allways 32Bit unsigned value. Which compiler do you use? Can you provide a little example which points me to the issue?
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
ga_301
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 13.09.2012, 14:28

Post by ga_301 »

Michael,
thanks for your response. I am using Delphi XE2, 32-bit with rangechecking turned on.
The method GetMySQLColumnInfoFromFieldHandle uses a local variable "fieldlength" which is declared as integer.
My issue is not with the Ulong type, but with the type of that variable in this function. I think, that assignment of an ulong to an integer variable is generally not a good idea and suggest to change the type of the fieldlength local variable in that function to either cardinal or ulong.
I am in the early stages of developing my database and it may be, that the rangecheck error I get may be caused by some unfortunate field type declaration. I have changed the type of "fieldlength" to cardinal and did not get this exception any longer.

Kind regards,
Gunnar
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Gunnar,

I replaced this Integer by a ULong in testing7.1 branch. That should be equal to Cardinal in meaning and is more consistent with the datatype of IZMySQLPlainDriver.GetFieldLength.
(SVN Rev. 2102) Will be backported to 7.0-patches in a few weeks.

Mark
Image
Locked