dbTalk Databases Forums  

create large object by tcl

comp.databases.postgresql.interfaces comp.databases.postgresql.interfaces


Discuss create large object by tcl in the comp.databases.postgresql.interfaces forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Eric
 
Posts: n/a

Default create large object by tcl - 02-19-2004 , 09:37 PM






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

Reply With Quote
  #2  
Old   
Eric
 
Posts: n/a

Default Re: create large object by tcl - 02-20-2004 , 04:24 AM






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


hehe88hk (AT) yahoo (DOT) com.hk (Eric) wrote in message news:<f2ccb7a1.0402191937.27396e48 (AT) posting (DOT) google.com>...
Quote:
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

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.