Page 1 of 1

ERangeError ZQuery.Open in ZPlainPostgreSqlDriver

Posted: 10.12.2006, 01:09
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

Posted: 10.12.2006, 09:32
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