Updated 2012-03-27 11:57:34 by Nobody

libpgtcl aka Pgtcl
 What: library/driver for accessing PostgreSQL database

 Where (v2.0): http://sourceforge.net/projects/pgtclng/
 Where (v1.7): http://pgfoundry.org/projects/pgtcl/
 Dead links:   http://postgresql.nextpath.com/
               http://gborg.postgresql.org/project/pgtcl/projdisplay.php
               http://gborg.postgresql.org/project/pgtclng/

 Description: Within the Postgres source distribution is the libpgtcl binding
              (in the src/interfaces directory).

              With release 1.4, Tcl 7 is no longer supported.
              Currently at version 2.0.
              Older versions of libpgtcl do not work well with newer (8.5+) Tcl versions, eg. data retrieval into an array.
 Updated: 03/2012
 Contact: See web site

libpgtcl is a C interface library that glues Tcl to PostgreSQL. It is also known as Pgtcl. (Technically, Pgtcl is the Tcl package that contains the libpgtcl library.) It links with PostgreSQL's libpq library to provide a thorough interface with PostgreSQL's capabilities. libpgtcl is TEA 3.1 compliant. It has a standard GNU configure script, and is known to work on many variants of Linux, FreeBSD, Mac OS X, and even Windows.

The configure script does a pretty good job of figuring out where the Tcl and PostgreSQL includes and libraries are. It looks for a tclConfig.sh (and can be told where to look, see the README) and find the Postgres stuff it needs via pg_config.

Quick-start guide to use of PostgreSQL with Tcl

Here's the database entry about it: libpgtcl (Postgres)

Is libpgtcl thread safe or no? I don't know

'Description of the app on the old Applications in Tcl and Tcl/Tk page'''

libpgtcl has also been separated from the main core. This is the client side Tcl binding to PostgreSQL.

Sample code:
 # connect to database, execute select query, retrieve data, print and quit

 package require Pgtcl

 set db [pg_connect -conninfo "dbname=postgres user=someuser password=somepassword"]

 set result [pg_exec $db "select * from sample_table;"]

 pg_result $result -assign some_array

 parray some_array

 pg_result $result -clear
 pg_disconnect $db