I am trying to use large objects from TCL. May I don't read the man
page right ...
 TCL code:

#!/usr/local/pgsql/bin/pgtclsh

        set CONN [pg_connect nccbor]
        
        puts "create : [set LOID [pg_lo_creat $CONN "INV_READ|INV_WRITE"]]"
        
        puts "open (w): [set LOFD [pg_lo_open $CONN $LOID w]]"
        set STR "sdlfkjhlskdjfh lakjdhfljkadsfhlkjas"
        set SIZ [string length $STR]
        puts "write : [pg_lo_write $CONN $LOFD $STR $SIZ]"
        puts "close : [pg_lo_close $CONN $LOFD]"
        
        puts "open (r): [set LOFD [pg_lo_open $CONN $LOID r]]"
        puts "read : [pg_lo_read $CONN $LOFD STR 10240]"
        puts $STR
        puts "close : [pg_lo_close $CONN $LOFD]"

        pg_disconnect $CONN

Output of code :

 ./test_lo.tcl 
create : 93377
open (w): 0
write : 35
close : -1
open (r): -1
read : -1
oid
close : -1

 Does anyone know what I've done wrong?

-- 
the four stages of competence:

1 unconscious incompetence:
  I don't even know that I don't know how to do X
2 conscious incompetence
  I do know that I don't know how to do X
3 conscious competence
  I do know how to X, but I have to think about it
4 unconscious competence
  I know how to X and I do it without thinking about it

(Think of e.g. driving a car)

Kurt Seel, Systems Engineer
Unified Technologies Corp.
Phone : 610 964 8200
Email : kseel@ut{anti-spam]corp.com

 To send me email, remove the {anti-spam] from the above address.

Reply via email to