Re: lo wrappers - still working on it - Mailing list pgsql-general

From Eric G. Miller
Subject Re: lo wrappers - still working on it
Date
Msg-id 20010703212507.A6240@calico.local
Whole thread Raw
In response to lo wrappers - still working on it  (Scott Holmes <sholmes@pacificnet.net>)
Responses Re: lo wrappers - still working on it  (Scott Holmes <sholmes@pacificnet.net>)
List pgsql-general
On Tue, Jul 03, 2001 at 08:56:20PM -0700, Scott Holmes wrote:
> Perhaps someone can point me towards what I'm missing.  I've included my make
> command, the command for creating a function and the actual code I wrote
> (derived from the sample code in the docs).  Incidentally, this project is too
> far along to change to java or any other interface.  I currently am handling
> the files to be lo's as system files but the request is in to save them as
> blobs.

You've written a client-side program, but are trying to use it as a
server side function.  I don't think that'll work.  You don't want to be
using libpq for server side functions.  I don't know the Java interface, but
it seems you are trying to do what is already available via
lo_import/lo_export functions.  Maybe you could explain the interface
you need a little better.  Is it not possible to use the lo_import() and
lo_export functions that are already available? (Why they are hidden in
the Programmer's Guide is beyond me...).

SELECT lo_export (<table>.<column>, '/path/to/file') from <table>;
INSERT INTO <table> (<column>) VALUES (lo_import ('/path/to/file'));

Someone recently suggested using bytea fields for blobs as well...

--
Eric G. Miller <egm2@jps.net>

pgsql-general by date:

Previous
From: Scott Holmes
Date:
Subject: lo wrappers - still working on it
Next
From: "Andy Samuel"
Date:
Subject: Re: Red Hat Database Development