Page 1 of 1

Range Check Error in ZPlainPostgresqlDriver

Posted: 15.09.2006, 21:15
by Paulonki
Hello,

An 'Range Check Error' is occurring in the Zeos when retrieving fields of the type text or bytea in ZPlainPostgresqlDriver - function DecodeBYTEA().
My envinronment is Delphi2005 and Postgresql 8.1.4.
Please, i need help or solution.

Regards,

Paulo

Posted: 17.09.2006, 08:50
by mdaems
Paulo,

As faras I remember we once had to add some special range check directives for PostGresql. I think the code for bytea has been changed recently and maybe this directives are not included yet. Maybe you could look for that ({R+} and {R-} Ithink)

Mark

Posted: 06.10.2006, 21:47
by Paulonki
Thanks

Problem solved.


Paulo

Posted: 06.10.2006, 22:29
by mdaems
Hi Paulo,

How did you solve? Did you change something? in case you did we want to know what in order to correct our sources as well.

Mark

Posted: 29.10.2006, 21:01
by plamendp
I got the same "Range check error" and instead of {$R-} I suggest the folowing:

Code: Select all

--- C:/Temp/Zeos/src/plain/ZPlainPostgreSqlDriver.pas	(revision 162)
+++ C:/Temp/Zeos/src/plain/ZPlainPostgreSqlDriver.pas	(working copy)
@@ -992,7 +992,7 @@
   decoded:=ZPlainPostgreSql8.PQunescapeBytea(pansichar(value),@len);
   SetLength(result,len);
   dest:=pchar(result);
-  Move(decoded^,result[1],len);
+  if (len > 0) then Move(decoded^,result[1],len);
   ZPlainPostgreSql8.PQFreemem(decoded);
 end;


The point is I don't like to use workarounds ($R-) insteat I prefer to fix the issue.

Plamen

Posted: 30.10.2006, 08:17
by mdaems
Good idea. Apparently my advice above was not correct anyway. The only place where we used this trick is in the ZdbcInterbaseUtils unit. If you use interbase, please feel free to have a look there as well. (I'm just the handyman, not a real experienced developer)
This one will get in ASAP. I hope it will pass the testing suite. (Ever used that tool for Zeoslib? You'll find it in the ZeosDboDevel.bpg package for D7)

Mark

Posted: 30.10.2006, 12:26
by plamendp
Never used Zeoslib testing suite but will give it a try.

I am using Zeos since 3-4 years with D7 and Postgresql. The reason I come back here was because an upgrade is underway: PostgreSQL 7.4 -> 8.1.5 and D7-> BDS 2006.

I'll take the oportunity to ask all people here if the ZeosLib for BDS 2006 (Delphi 10) + PostgreSQL 8.1.x could be taken as stable enough??

Also, having PostgreSQL 6-7 years experience (admin+user) I'll be glad if I can help Zeos Dev Team in D10 + Pg coding.

Regards,
Plamen

Posted: 31.10.2006, 20:08
by mdaems
Patch committed. SVN Testing branch revision 167.

Posted: 07.11.2006, 21:10
by firmos
plamendp wrote:Never used Zeoslib testing suite but will give it a try.
I'll take the oportunity to ask all people here if the ZeosLib for BDS 2006 (Delphi 10) + PostgreSQL 8.1.x could be taken as stable enough??
Also, having PostgreSQL 6-7 years experience (admin+user) I'll be glad if I can help Zeos Dev Team in D10 + Pg coding.
Hello,

we are using Pg 8.1.x in production environment with Delphi 2006 and freepascal. It is stable enough for us. We have a billing system running with 24/7 uptime.

If you have some time to spend on Pg coding for Zeos drop me a PM as i am coordinating the development. We would be really happy if we get experienced coders who join the team!

thanks,
helmut