X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id DE7AF30ED84 for ; Mon, 16 Jun 2003 17:58:38 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 16368-10 for ; Mon, 16 Jun 2003 14:58:28 -0300 (ADT) Received: from mailrtr04.ntelos.net (mailrtr04.ntelos.net [216.12.0.104]) by svr1.postgresql.org (Postfix) with ESMTP id 1CFB730E358 for ; Mon, 16 Jun 2003 14:58:28 -0300 (ADT) Received: from wsogmm2.com (chas-108-70.access.ntelos.net [216.12.108.70]) by mailrtr04.ntelos.net (8.12.9/8.12.9) with ESMTP id h5GHwOP2011026; Mon, 16 Jun 2003 13:58:25 -0400 From: JL Organization: JCI To: "rino.79" , Subject: Re: Info Date: Mon, 16 Jun 2003 13:57:20 -0400 User-Agent: KMail/1.5.1 References: <000a01c331d8$edd28680$0df4623e@79> In-Reply-To: <000a01c331d8$edd28680$0df4623e@79> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200306161357.20600.JLT@WVInter.Net> X-Archive-Number: 200306/52 X-Sequence-Number: 4263 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}