ERangeError ZQuery.Open in ZPlainPostgreSqlDriver

Forum related to version 6.5.1 (alpha) and 6.6.x (beta) of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
piornik
Fresh Boarder
Fresh Boarder
Posts: 1
Joined: 10.12.2006, 01:01

ERangeError ZQuery.Open in ZPlainPostgreSqlDriver

Post by piornik »

When value is null or is empty function raise ERangeCheckError. Please path the sources. (ZeosDBO 6.6.0 - beta)

function TZPostgreSQL8PlainDriver.DecodeBYTEA(value: string): string;
var decoded,dest:pchar;
len:Longword;
von,nach:string;
begin
decoded:=ZPlainPostgreSql8.PQunescapeBytea(pansichar(value),@len);
SetLength(result,len);
dest:=pchar(result);
if len>0 then Move(decoded^,result[1],len);
ZPlainPostgreSql8.PQFreemem(decoded);
end;

Regards
Krzysztof
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 piornik,

This error has already been reported a few times.
Now the code in our repository looks like this :

Code: Select all

function TZPostgreSQL8PlainDriver.DecodeBYTEA(value: string): string;
var decoded:pchar;
    len:Longword;
begin
  decoded:=ZPlainPostgreSql8.PQUnescapeBytea(pansichar(value),@len);
  SetLength(result,len);
  if (len > 0) then Move(decoded^,result[1],len);
  ZPlainPostgreSql8.PQFreemem(decoded);
end;
It will be in next release.
If you take the most recent SVN build (Trunk) it should be OK. (See release announcement for a link)

Mark
Post Reply