Large Objects

From: "Eid, Bilal" <Bilal_Eid(at)NAI(dot)com>
To: "'pgsql-sql(at)postgresql(dot)org'" <pgsql-sql(at)postgresql(dot)org>
Subject: Large Objects
Date: 1999-07-05 23:57:36
Message-ID: E336B070B4B1D111B8F000A0C99D75440141CFEC@ca-exchange4.nai.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi everyone,

My name is Bilal Eid, I'm software Engineer "consultant" at Network
Associates.

I'm in middle of an ODBC application for the PostgreSQL. On Linux platform.
This application is a security application for Network Associates. I need
your help with the following issue.

The problem I'm facing is that the table and its columns are too large, Some
columns are exceeding 16K, and the whole table might come close to 64k in
total.

I understand that the solution is to use the Large Object technique as it
mention in FAQ, and its syntax Chapter 15 of PostgreSQL Programmer's Guide.

It works fine when I used the interactive on-line tool "psql", following the
example of "Built in registered functions":

CREATE TABLE image (
name text,
raster oid
);

INSERT INTO image (name, raster)
VALUES ('beautiful image', lo_import('/etc/motd'));

SELECT lo_export(image.raster, "/tmp/motd") from image
WHERE name = 'beautiful image';

The problem with that is I have to read and write to a file. In my case I'm
reading from a buffer so I can not use this technique as it.

The other way "programming one using the Large Object Functions:

Oid lo_creat(PGconn *conn, int mode) inv_oid =
lo_creat(INV_READ|INV_WRITE|INV_ARCHIVE);
Oid lo_import(PGconn *conn, text *filename)
int lo_open(PGconn *conn, Oid lobjId, int mode, ...)
int lo_export(PGconn *conn, Oid lobjId, text *filename)
int lo_write(PGconn *conn, int fd, char *buf, int len)
int lo_lseek(PGconn *conn, int fd, int offset, int whence)
int lo_close(PGconn *conn, int fd)

As you see, according to these functions the object will be created and
attached to the database not to a specific table in the database, I tried a
lot of possibility I could think of to make it work. to accessing an
existing object on a table and read/write from it from/to a buffer, but with
out any success.

Again, and in short, I need to attach an object to a table using the iODBC
application and using buffer instead of file as input/output.
Is there any way to do that? I need your help and may be some example to
follow.
Please, Help me I'm running out of time.

Note: I'm already connected to the database at the time of read/write to the
table.

Your help is gratefully appreciated
And thank you in advance

Network Associates Inc.

Bilal Eid

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Chris Bitmead 1999-07-06 00:17:57 Re: [SQL] Large Objects
Previous Message timbert 1999-07-05 12:54:05 Problems with jdbc & pgsql 6.5