Importing large objects from the client side programatically.

From: Andrew Maclean <andrew(dot)amaclean(at)gmail(dot)com>
To: General <pgsql-general(at)postgresql(dot)org>
Subject: Importing large objects from the client side programatically.
Date: 2009-04-30 06:20:20
Message-ID: e7ddbec60904292320q637fb411gbd802464978ae034@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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/
___________________________________________

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michele Petrazzo - Unipex 2009-04-30 06:43:23 pg_dump and pg_restore problem
Previous Message Craig Ringer 2009-04-30 06:13:50 Re: recover corrupt DB?