Re: binary data storage

From: Doug McNaught <doug(at)wireboard(dot)com>
To: Martín Marqués <martin(at)bugs(dot)unl(dot)edu(dot)ar>
Cc: Denis Gasparin <denis(at)edistar(dot)com>, PostgreSQL Mailing Lists-General <pgsql-general(at)postgresql(dot)org>
Subject: Re: binary data storage
Date: 2002-04-04 16:08:46
Message-ID: m3u1qr1m5t.fsf@varsoon.wireboard.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

=?iso-8859-15?q?Mart=EDn=20Marqu=E9s?= <martin(at)bugs(dot)unl(dot)edu(dot)ar> writes:

> I still don't get it.
> If I use pg_lo* to put my binary data in the database, where will it be,
> always talking about the structure of the database.
> Example:
> A table with 5 fields, and one is of type oid, and I want to insert data (a
> new row to the table) in which I have a binary file to put in the oid field.
>
> And how about if I have more then one oid field?
>
> I see no specification on which field the binary object will be inserted.

Here's the way it works:

You create the LO with lo_create() or lo_import(). These give you an
OID that is your "handle" for getting at the LO data. You then store
the OID in a column of type 'oid' in one or more of your tables.

To retrieve the LO data, fetch the OID from the table it lives in, and
use lo_open() and lo_read() to fetch the actual data.

Make sense?

-Doug
--
Doug McNaught Wireboard Industries http://www.wireboard.com/

Custom software development, systems and network consulting.
Java PostgreSQL Enhydra Python Zope Perl Apache Linux BSD...

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Neil Conway 2002-04-04 16:34:06 Re: binary data storage
Previous Message Doug McNaught 2002-04-04 15:04:43 Re: binary data storage