Range Check Error in ZPlainPostgresqlDriver

Forum related to PostgreSQL

Moderators: gto, cipto_kh, EgonHugeist, olehs

Post Reply
Paulonki
Fresh Boarder
Fresh Boarder
Posts: 8
Joined: 24.03.2006, 17:50

Range Check Error in ZPlainPostgresqlDriver

Post 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
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post 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
Paulonki
Fresh Boarder
Fresh Boarder
Posts: 8
Joined: 24.03.2006, 17:50

Post by Paulonki »

Thanks

Problem solved.


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

Post 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
plamendp
Fresh Boarder
Fresh Boarder
Posts: 11
Joined: 02.09.2005, 16:57

Post 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
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post 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
plamendp
Fresh Boarder
Fresh Boarder
Posts: 11
Joined: 02.09.2005, 16:57

Post 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
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Patch committed. SVN Testing branch revision 167.
User avatar
firmos
n00blet
n00blet
Posts: 40
Joined: 23.01.2006, 10:02

Post 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
Post Reply