I'm using Delphi 6 SP2 on Win2k. Have someone tried to run an app with Direct SQL having Range Checking enabled?
Then, I get the range checking error in uMysqlVio, Line 959: ip_addr := inet_addr(PHost);
- and it happens everytime I run it.
I could post the source code of the demo, if someone's interested - it's really only testing the connection.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It isnt a bug .. actually is just a simple mistake .. for some strange reasons delphi reports range checking errors on large integers if you use cardinal data-type. To fix this problem just replace in line 735 (uMysqlVio new version - vio_open var section) the
ip_addr:cardinal;
with
ip_addr:longint;
I hope there arent any other places where there is something similar :), but nevertheless if you get a range checking on a cardinal just switch it to a longint.
Regards,
Cristian Nicola
ps
From delphi help
Longint signed 32-bit
Cardinal unsigned 32-bit
The range checking error comes when the sign bit is used (altough it is still a valid cardinal value).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm using Delphi 6 SP2 on Win2k. Have someone tried to run an app with Direct SQL having Range Checking enabled?
Then, I get the range checking error in uMysqlVio, Line 959: ip_addr := inet_addr(PHost);
- and it happens everytime I run it.
I could post the source code of the demo, if someone's interested - it's really only testing the connection.
It isnt a bug .. actually is just a simple mistake .. for some strange reasons delphi reports range checking errors on large integers if you use cardinal data-type. To fix this problem just replace in line 735 (uMysqlVio new version - vio_open var section) the
ip_addr:cardinal;
with
ip_addr:longint;
I hope there arent any other places where there is something similar :), but nevertheless if you get a range checking on a cardinal just switch it to a longint.
Regards,
Cristian Nicola
ps
From delphi help
Longint signed 32-bit
Cardinal unsigned 32-bit
The range checking error comes when the sign bit is used (altough it is still a valid cardinal value).
You could just typecast the result of inet_addr to cardinal:
ip_addr := cardinal(inet_addr(pchar(host)));
in line 959.