Re: [GENERAL] pgsql pg_connect
От | Ross J. Reedstrom |
---|---|
Тема | Re: [GENERAL] pgsql pg_connect |
Дата | |
Msg-id | 19991028101037.B29773@wallace.ece.rice.edu обсуждение исходный текст |
Ответ на | pgsql pg_connect (Jurgen Defurne <defurnj@glo.be>) |
Список | pgsql-general |
Jurgen - In general, libpgtcl questions are best addressed to the 'interfaces' list. The PgAccess program that comes with postgresql is a tcl program, and it handles the problem with a catch. Here's the proc that does it (rewrapped for email): proc {open_database} {} { global dbc host pport dbname username password newusername\ newpassword sdbname newdbname newhost newpport pref pgsql cursor_clock if {$newusername!=""} { set connres [catch {set newdbc [pg_connect -conninfo\ "host=$newhost port=$newpport dbname=$newdbname\ user=$newusername password=$newpassword"]} msg] } { set connres [catch {set newdbc [pg_connect $newdbname\ -host $newhost -port $newpport]} msg] } if {$connres} { cursor_normal show_error "Error trying to connect to database \"$newdbname\"\ on host $newhost\n\nPostgreSQL error message: $msg" return $msg } { catch {pg_disconnect $dbc} set dbc $newdbc set host $newhost set pport $newpport set dbname $newdbname ...other stuff deleted... } } On Thu, Oct 28, 1999 at 01:33:54PM +0200, Jurgen Defurne wrote: > Hello, people on the mailing list, > > load libpgtcl.so > > set connection [pg_connect notanexistingdatabase] > > it is not at all possible to recover the running program from this > error. I have tried this using catch, but to no avail. This is the > result : > > Connection to database failed > FATAL 1: Database notadatabase does not exist in pg_database > while executing > "pg_connect notadatabase" > (file "connect.tcl" line 10) > > Or, this is an error in Tcl, or this is not good enough thought out in > libpgtcl. > > Why do I say this about libpgtcl ? Ross -- Ross J. Reedstrom, Ph.D., <reedstrm@rice.edu> NSBRI Research Scientist/Programmer Computer and Information Technology Institute Rice University, 6100 S. Main St., Houston, TX 77005
В списке pgsql-general по дате отправления: