Importing large objects from the client side programatically.
Importing large objects from the client side programatically.
От:
Andrew Maclean <andrew.amaclean@gmail.com>
Дата:
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/
___________________________________________
Re: Importing large objects from the client side programatically.
От:
"Daniel Verite" <daniel@manitou-mail.org>
Дата:
Andrew Maclean wrote: > I am using C++ and trying to programatically import a large > object from the client side into a server. In that context, the simplest way is to use libpq's C functions: http://www.postgresql.org/docs/8.3/static/lo-interfaces.html Best regards, -- Daniel PostgreSQL-powered mail user agent and storage: http://www.manitou-mail.org