PostgreSQL Tcl Interface Documentation | ||||
---|---|---|---|---|
Prev | Fast Backward | Next |
pgtcl is a Tcl package for client programs to interface with PostgreSQL servers. It makes most of the functionality of libpq available to Tcl scripts.
Table 1-1> gives an overview over the commands available in pgtcl. These commands are described further on subsequent pages.
Table 1-1. pgtcl Commands
Command | Namespace Command | Description |
---|---|---|
pg_connect |
pg::connect |
open a connection to the server |
pg_dbinfo |
pg::dbinfo |
returns data about the connection |
pg_disconnect |
pg::disconnect |
close a connection to the server |
pg_conndefaults |
pg::conndefaults |
get connection options and their defaults |
pg_exec |
pg::sqlexec |
send a command to the server |
pg_exec_prepared |
pg::exec_prepared |
send a request to execute a prepared statement, with parameters |
pg_result |
pg::result |
get information about a command result |
pg_select |
pg::select |
loop over the result of a query |
pg_execute |
pg::execute |
send a query and optionally loop over the results |
pg_null_value_string |
pg::null_value_string |
set string to be returned for null values in query results |
pg_quote |
pg::quote |
escape a string for inclusion into SQL statements |
pg_escape_string |
pg::escape_string |
escape a binary string for inclusion into SQL statements |
pg_escape_bytea |
pg::escape_bytea |
escape a binary string for inclusion into SQL statements |
pg_unescape_bytea |
pg::unescape_bytea |
unescape a binary string from the backend |
pg_listen |
pg::listen |
set or change a callback for asynchronous notification messages |
pg_on_connection_loss |
pg::on_connection_loss |
set or change a callback for unexpected connection loss |
pg_sendquery |
pg::sendquery |
issue pg_exec-style command asynchronously |
pg_sendquery_prepared |
pg::sendquery_prepared |
send an asynchronous request to execute a prepared statement, with parameters |
pg_getresult |
pg::getresult |
check on results from asynchronously issued commands |
pg_isbusy |
pg::isbusy |
check to see if the connection is busy processing a query |
pg_blocking |
pg::blocking |
set a database connection to be either blocking or nonblocking |
pg_cancelrequest |
pg::cancelrequest |
request PostgreSQL abandon processing of the current command |
pg_lo_creat |
pg::lo_creat |
create a large object |
pg_lo_open |
pg::lo_open |
open a large object |
pg_lo_close |
pg::lo_close |
close a large object |
pg_lo_read |
pg::lo_read |
read from a large object |
pg_lo_write |
pg::lo_write |
write to a large object |
pg_lo_lseek |
pg::lo_lseek |
seek to a position in a large object |
pg_lo_tell |
pg::lo_tell |
return the current seek position of a large object |
pg_lo_truncate |
pg::lo_truncate |
Truncate (or pad) a large object to a specified length |
pg_lo_unlink |
pg::lo_unlink |
delete a large object |
pg_lo_import |
pg::lo_import |
import a large object from a file |
pg_lo_export |
pg::lo_export |
export a large object to a file |
pg_sqlite |
pg::sqlite |
bridge between pgtcl and the Tcl sqlite package (when compiled with sqlite bridge) |
pg_copy_complete |
pg::copy_complete |
Complete COPY FROM stdin operation after finished writing |
The pg_lo_*
commands are interfaces to the large object features of PostgreSQL. The functions are designed to mimic the analogous file system functions in the standard Unix file system interface. The pg_lo_*
commands should be used within a BEGIN/COMMIT transaction block because the descriptor returned by pg_lo_open
is only valid for the current transaction. pg_lo_import
and pg_lo_export
must be used in a BEGIN/COMMIT transaction block.
The pg_sqlite
command is only included if Sqlite 3 is installed. It can be disabled at compile time with "./configure --without-sqlite3".