Thread: A doubt in pgtcl

A doubt in pgtcl

From
Senthil
Date:
Dear Sir,I have just started to program in pgtcl.I have to write a procedure for 
connecting to a table and fetching records and inserting them.What should 
I do to catch the error conditions?The postmaster runs in a separate 
terminal and Tcl in another one.The errors may be non existing table 
name,field name or errors like query fetching many rows as result.Please 
give me a solution for this problem.Thanking you.

Yours truly,
Senthil J



Re: A doubt in pgtcl

From
Brett Schwarz
Date:
[Hummmm, wonder why it didn't have pgsql-interfaces in
the reply-to]


You can use pg_result to get any error info. For
example:

set han [pg_connect ...]

set result [pg_exec $han "SELECT * FROM bogus_table"]

set stat [pg_result $result -status]

if {$stat ne "PGRES_TUPLES_OK"} {
   puts "GOT ERROR: [pg_result $result -error]"
}


HTH,
   --brett



--- Senthil <senthil_j@chain-sys.com> wrote:
> Dear Sir,
>     I have just started to program in pgtcl.I have to
> write a procedure for 
> connecting to a table and fetching records and
> inserting them.What should 
> I do to catch the error conditions?The postmaster
> runs in a separate 
> terminal and Tcl in another one.The errors may be
> non existing table 
> name,field name or errors like query fetching many
> rows as result.Please 
> give me a solution for this problem.Thanking you.
> 
> Yours truly,
> Senthil J
> 
> 
> ---------------------------(end of
> broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
> 
>               
http://www.postgresql.org/docs/faqs/FAQ.html


    
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/