Re: lo wrappers - still working on it

Eric G. Miller <egm2@jps.net>

From: "Eric G. Miller" <egm2@jps.net>
To: PG-General <pgsql-general@postgresql.org>
Date: 2001-07-04T04:25:07Z
Lists: 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>