Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

create large object by tcl

1 view
Skip to first unread message

Eric

unread,
Feb 19, 2004, 10:37:34 PM2/19/04
to
I am using PostGreSQL 7.3.4
I would like to ask why the following code cannot get back what I have
inserted before (abcdefghijklmnopqrstuvwxyz) correctly? I found a
large object was created successfully by the code but the code content
was empty.
(select * from pg_largeobject;)


(The "$conn has been tested and was found no problem accessing the
database. It only fails to create large objects using Tcl)

Thank you


set objOid [pg_lo_creat $conn "INV_READ|INV_WRITE"]
set fd [pg_lo_open $conn $objOid w]
set buf abcdefghijklmnopqrstuvwxyz
pg_lo_write $conn $fd $buf 26
pg_lo_close $conn $fd

set fd2 [pg_lo_open $conn $objOid r]
pg_lo_read $conn $fd2 buf2 26
puts stdout $buf2
pg_lo_close $conn $fd2

Eric

unread,
Feb 20, 2004, 5:24:22 AM2/20/04
to
I have checked the program again.

If I use the libpgtcl library, I find it can only get a file
descriptor of '-1' returned by pg_lo_open.

If I use pgintcl, I find it can only get a file descriptor of '0'
returned by pg_lo_open, followed by an error message:

"
ERROR: lo_write: invalid large obj descriptor (0)
while executing
"error $res(error)"
(procedure "pgtcl::callfn" line 45)
invoked from within
"pgtcl::callfn $db [pgtcl::getfnoid $db $fname] result $arginfo $args"
(procedure "pg_callfn_int" line 2)
invoked from within
"pg_callfn_int $db lowrite "I $len" $lofd $buf"
(procedure "pg_lo_write" line 5)
invoked from within
"pg_lo_write $conn $fd1 $buf 50"
(file "./accessdatabase.tcl" line 30)
"

May I know why a valid file descriptor cannot be returned?
Thank you


hehe...@yahoo.com.hk (Eric) wrote in message news:<f2ccb7a1.04021...@posting.google.com>...

0 new messages