Importing large objects from the client side programatically. - Mailing list pgsql-general

From Andrew Maclean
Subject Importing large objects from the client side programatically.
Date
Msg-id e7ddbec60904292320q637fb411gbd802464978ae034@mail.gmail.com
Whole thread Raw
Responses Re: Importing large objects from the client side programatically.  ("Daniel Verite" <daniel@manitou-mail.org>)
List pgsql-general
I am using C++ and trying to programatically import a large object
from the client side into a server. I am using QT and, for the server
side I can pass a command like:
insert into x values('x1',lo_import('c:/temp/x1.txt'));
Which works.

However this will not work from the client side.
For the client side there is a psql function \lo_import that works if
I run psql and do something like:
\lo_import('c:/temp/x1.txt')
insert into x values('x1',:LASTOID);

I understand the function \lo_import first sends the data to the
server and then creates the blob returning the oid of it.

How can I do this in an SQL query?

Do I have to write a function on the server in psql using commands like
\lo_import('c:/temp/x1.txt')
insert into x values('x1',:LASTOID);

and then call this in an sql statement?

Will this work or what do people usually do?

Thanks for any help


Andrew



--
___________________________________________
Andrew J. P. Maclean
Centre for Autonomous Systems
The Rose Street Building J04
The University of Sydney  2006  NSW
AUSTRALIA
Ph: +61 2 9351 3283
Fax: +61 2 9351 7474
URL: http://www.acfr.usyd.edu.au/
___________________________________________

pgsql-general by date:

Previous
From: Michele Petrazzo - Unipex
Date:
Subject: pg_dump and pg_restore problem
Next
From: Craig Ringer
Date:
Subject: Re: could not bind IPv4 socket