Page 1 of 1
ERangeError in GetMySQLColumnInfoFromFieldHandle
Posted: 30.12.2012, 13:57
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
Posted: 01.01.2013, 13:30
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?
Posted: 03.01.2013, 12:30
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
Posted: 03.01.2013, 15:49
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