Re: Large objects - SOS

From: "Nigel J(dot) Andrews" <nandrews(at)investsystems(dot)co(dot)uk>
To: mjoseph(at)inautix(dot)com
Cc: pgsql-admin(at)postgresql(dot)org, pgsql-novice(at)postgresql(dot)org, pgsql-general(at)postgresql(dot)org
Subject: Re: Large objects - SOS
Date: 2003-02-04 12:53:34
Message-ID: Pine.LNX.4.21.0302041247370.20150-100000@ponder.fairway2k.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-general pgsql-novice

On Tue, 4 Feb 2003 mjoseph(at)inautix(dot)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

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Peter De Muer (Work) 2003-02-04 13:06:04 Re: 7.3.1 update gives PHP libpq.so.2 problem
Previous Message Jules Alberts 2003-02-04 12:36:47 7.3.1 update gives PHP libpq.so.2 problem

Browse pgsql-general by date

  From Date Subject
Next Message Bruno Wolff III 2003-02-04 12:59:54 Re: Dealing with complex queries
Previous Message mjoseph 2003-02-04 12:22:58 Large objects - SOS

Browse pgsql-novice by date

  From Date Subject
Next Message brew 2003-02-04 15:22:27 Re: upgrade from 7.0 to 7.2
Previous Message mjoseph 2003-02-04 12:22:58 Large objects - SOS