From: | Laurent <laurent(at)presenceweb(dot)com> |
---|---|
To: | pgsql-interfaces(at)postgresql(dot)org, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | import large objects with libpq |
Date: | 2001-03-02 14:29:54 |
Message-ID: | 3A9FAE62.1FE3184B@presenceweb.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-interfaces |
I need to store a blob in a database. I use libpq - C Library
I read theses urls
http://www.postgresql.org/devel-corner/docs/postgres/lo-interfaces.html
http://www.postgresql.org/devel-corner/docs/postgres/lo-sample.html
I understand that there are two possibilities
The first possibility is
- creat blob with lo_creat
- open it with lo_open
- read my file with any C function and write data to the blob with
lo_write
- then close the blob with lo_close
The second seems more easier
- import the file to blob with lo_import
After connection, I try to use
lobjOid = lo_import(conn, "myfile.doc") ;
but this command fails and returns
"lo_import: could not open inv object oid 561441"
I don't know what can i resolve this pb.
So I try the other possibility.
I copied importFile function from lo-sample.html.
Then I call it with
lobjOid = importFile(conn, in_filename);
The creation of the bloc is successfull with
lobjId = lo_creat(conn, INV_READ | INV_WRITE);
but the open of the bloc fails with
lobj_fd = lo_open(conn, lobjId, INV_WRITE);
I get the message : lo_lseek: invalid large obj descriptor (0)
I'm a bite disappointed, I beg you help.
I 'm looking forward to hearing you.
From | Date | Subject | |
---|---|---|---|
Next Message | Raymond Chui | 2001-03-02 14:30:14 | Does PostgreSQL support Constant Expression (Alias Name)? |
Previous Message | Matthias Teege | 2001-03-02 14:29:22 | Convert to upper |
From | Date | Subject | |
---|---|---|---|
Next Message | Peter T Mount | 2001-03-02 15:11:46 | Re: large object descriptor |
Previous Message | Peter T Mount | 2001-03-02 14:26:32 | Re: JDBC error codes to detect duplicates? |