From: | JL <JLT(at)WVInter(dot)Net> |
---|---|
To: | "rino(dot)79" <rino(dot)79(at)inwind(dot)it>, <pgsql-interfaces(at)postgresql(dot)org> |
Subject: | Re: Info |
Date: | 2003-06-16 17:57:20 |
Message-ID: | 200306161357.20600.JLT@WVInter.Net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-interfaces |
On Fri June 13 2003 14:23, rino.79 wrote:
> Hi, I'm Rino.
> My question is:
> How I can connect postgres database whit tcl/tk interface?
creates a new *.tcl file
__________________________
#!/usr/bin/tclsh
# Test of access to a database after install
# Table: customers
# One Field used in test: lname
#
# GRANT ALL customers TO user_whom_ever ;
#
# libarary for postgresQL 7.3.2
# /usr/lib/libpgtcl.so -> /usr/lib/pgtcl1.4/libpgtcl1.4.so
load /usr/lib/libpgtcl.so
set pgsetup "user=user_whom_ever dbname=mydatabase psic password='mypassword_if_any'"
# above used in the following way...
# pg_connect -conninfo "user=user_whom_ever dbname=mydatabase psic password='mypassword_if_any'"
set pgconn [pg_connect -conninfo $pgsetup]
puts "Connection string $pgsetup"
puts "__ Uppercase first character of customers last name ___\n"
pg_select $pgconn "Select DISTINCT substr(upper(lname),1,1) AS cid From customers LIMIT 18" arr {
puts [format "%s" $arr(cid) ]
}
pg_select $pgconn "SELECT count(*) AS cnt FROM customers" arr {
puts [format "First 18 DISTINCT 1st characters, from a total of: %s customers" $arr(cnt) ]
}
pg_disconnect $pgconn
Note: below, you may find a tar package with
more code and database for a in works project
for Linux
--
John Turner
http://Members.Ntelos.Net/~JLT
"Just because you do not know the answer,
does not mean that someone else does"
Sephen J. Gould {RIP}
From | Date | Subject | |
---|---|---|---|
Next Message | Glenn R Williams | 2003-06-16 20:34:49 | PL/Python import _sre module error |
Previous Message | Jan Wieck | 2003-06-16 17:35:08 | Re: Info |