Bug report: Postgres bytea fields twice decoded.
Posted: 04.11.2005, 19:32
First, sorry my english.
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
....
wrong code:
As you can see, the line with ,
implicitly decode the field's content two times, since GetString also
calls DecodeString. It's :
I've fixed it not calling GetString instead GetRawString:
niztor.-
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)));