Re: Binary data in PostgreSQL

Поиск
Список
Период
Сортировка
От Bas Scheffers
Тема Re: Binary data in PostgreSQL
Дата
Msg-id 10408.80.177.109.207.1077444581.squirrel@io.scheffers.net
обсуждение исходный текст
Ответ на Binary data in PostgreSQL  (Holger Marzen <holger@marzen.de>)
Список pgsql-general
Although I am not using it for massive files (small jpegs with people's
mugshots) I have been storing them in a bytea column without problems.

I am using Tcl in AOLserver and it is easy to insert and retrieve the
files. To insert/update, you use hex encoded files, so simply do:
"binary scan $binaryString H* hexdata" to get the hex string and in the
SQL you simply use "decode('$hexdata', 'hex')" as value.

When you retrieve the data, the encoding is a bit, well, weird. (see the
manual) but because it is using backslash escaping of special character
into they ascii values, in Tcl it is dead easy to convert back to binary
data:
set bindata [subst -novariables -nocommands $pgdata].

Hope that helps,
Bas.

В списке pgsql-general по дате отправления:

Предыдущее
От: Jonathan Bartlett
Дата:
Сообщение: Re: Binary data in PostgreSQL
Следующее
От: greg@turnstep.com
Дата:
Сообщение: DBD::Pg 1.32 ready for testing