Re: [GENERAL] Large objects - SOS

Поиск
Список
Период
Сортировка
От Nigel J. Andrews
Тема Re: [GENERAL] Large objects - SOS
Дата
Msg-id Pine.LNX.4.21.0302041247370.20150-100000@ponder.fairway2k.co.uk
обсуждение исходный текст
Ответ на Large objects - SOS  (mjoseph@inautix.com)
Список pgsql-novice
On Tue, 4 Feb 2003 mjoseph@inautix.com wrote:

> Hi,
> I need to create a large object - a photograph and work with it. I would be
> using ODBC (application on Windows NT , db server on Linux)
> The doc at
> http://gborg.postgresql.org/project/psqlodbc/faq/faq.php?faq_id=52
> suggests creating a custom type like this.
> create type lo (
>    internallength=4,
>    externallength=10,
>    input=int4in,
>    output=int4out,
>    default='',
>    passedbyvalue
> );
>
> I need to define the input & output functions (int4in and int4out).
> Can someone give me a clue as to how these functions should be defined?
> Some sample code would really help me.


If it were up to me I would base64 encode the data and store it in a bytea type
column. Obviously retrieval involves decoding the base64.  Note though, using
the database functions to encode/decode the data defeats the object of the
encoding, which is to avoid all possible special character interpretion by the
parser (and possibly the wire protocol).

As I understand it, bytea should mostly work without encoding the data if you
can quote the data correctly. However, my very quick experiments didn't work
first time so I advised the client to go the easy route. I hope to revisit this
my self again soon (when I get the time).


--
Nigel J. Andrews


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

Предыдущее
От: Simon Mitchell
Дата:
Сообщение: Re: [GENERAL] Creation of VIEWS not working....
Следующее
От: "Scott Morrison"
Дата:
Сообщение: