Thread: pgsql and pictures

pgsql and pictures

From
WZhang
Date:
I try to setup a table with one column has pictures. The client side will
be on windows.
By follow the instruction on the ODBC site I setup a new type lo on the
database.
I was able to export some MS Access table with imageobject
in one of the columns to the PostgreSQL server running on a linux
server. And I could import the table back with the imageobject.
I would like to write a client in Python to do the same thing.
Here is my problems and question:

1)When I creat table using this with psql :
     CREATE table image(id integer, image oid)
and insert a image using this:
     Insert into image(1, lo_import('\tmp\picture1.jpb')
Then I go back to windows and use access import the table image, all I get
is the (1, 16678) not the picture itself.
I said Ok,  I will create a table from psql on the server like this:
    CREATE table image(id integer, image lo)
now I do not know how to insert a record from there.

2)When I try to wirte the client myself, what command I should use to
retrieve a table with one column a image? if I fetchall() the image table
I will get (1, 16678), how do I get the image?

Could anybody give me some example or idea on how to do this.

Thanks.


Wenhua