I've found a bug in zeos's handling of bytea blob fields. It is
double decoding blob fields.
zeosdbo-6.5.1-alpha_cvs_13-10-2005.zip
ZDbcPostgresSqlResultSet.pas:
scope
Code: Select all
function TZPostgreSQLResultSet.GetBlob(ColumnIndex: Integer): IZBlob;
var
BlobOid: Oid;
Stream: TStream;
begin
{$IFNDEF DISABLE_CHECKING}
wrong code:
Code: Select all
if (GetMetadata.GetColumnType(ColumnIndex) = stAsciiStream) then
Stream := TStringStream.Create(GetString(ColumnIndex))
else
Stream := TStringStream.Create(DecodeString(GetString(ColumnIndex)));
Code: Select all
DecodeString(GetString(ColumnIndex))
implicitly decode the field's content two times, since GetString also
calls DecodeString. It's :
Code: Select all
function TZPostgreSQLResultSet.GetString(ColumnIndex: Integer): String;
begin
Result := DecodeString(GetRawString(ColumnIndex));
end;
I've fixed it not calling GetString instead GetRawString:
Code: Select all
else
Stream := TStringStream.Create(DecodeString(GetRawString(ColumnIndex)));