Re: Blob handling with Delphi... - Mailing list pgsql-general

From John R Pierce
Subject Re: Blob handling with Delphi...
Date
Msg-id 4DA561DC.80409@hogranch.com
Whole thread Raw
In response to Blob handling with Delphi...  (Durumdara <durumdara@gmail.com>)
List pgsql-general
On 04/13/11 1:28 AM, Durumdara wrote:
> Hi!
>
> PG9.0, Delphi 6, Zeos.
>
> I want to use PGSQL bytea field as normal BLOB field in Delphi.
>
> But when I insert a value into this field, for example all characters
> (chr 0..255), and I fetch, and save it as blob stream into a file, I
> got interesting result, not what I stored here previously.
>
> It is got \x prefix, and it is stored hexadecimal values.
>
> Is it normal, and I needs to convert this format to readable before I
> use it, or I can get same result as in other databases/adapters (the
> stream saved BlobField.SaveToFile have equal content as
> BlobField.LoadFromFile)...
>
> Many DBAware components can show the blob directly as Image. With PG's
> \x prefix this won't working well... :-(
>

in 9.0, the default encoding for BYTEA changed, and if your client
interface doesnt undersatnd the new encoding (and isn't using the libpq
entry points for handling byte encoding), it will fail like this..
there's a SET variable that will restore the old behavior.

See

http://www.postgresql.org/docs/current/static/runtime-config-client.html#GUC-BYTEA-OUTPUThttp://www.postgresql.org/docs/current/static/runtime-config-client.html#GUC-BYTEA-OUTPUT

     SET bytea_output='escape';

should revert to the previous behavior, and may well fix your problem
with delphi

pgsql-general by date:

Previous
From: Durumdara
Date:
Subject: Blob handling with Delphi...
Next
From: "Henry C."
Date:
Subject: Speeding up replication startup/recovery