Tcl Namespace Support

PostgreSQL Tcl Interface Documentation
Prev | Fast Backward | Chapter 1. pgtcl - Tcl Binding Library | Fast Forward | Next

# 1.4. Tcl Namespace Support

With version 1.5, there is proper Tcl namespace support built into pgtcl. There are commands now that mirror the pg_ commands, but use the Tcl namespace convention. For example, there are commands now called: pg::connect, pg::result, etc. However, due to this, there are some incapabilities. For example, pg_exec has a counterpart called pg::sqlexec, since doing a namespace import ::pg::* would clobber the builtin Tcl commmand exec. The old command names, pg_*, are still there for backwards compatibility, but might be phased out eventually.

So, one can use Tcl's namespace mechanisms now with pgtcl. For eaxmple, you can import that namespace:

    namespace import ::pg::*

    set conn [connect template1 -host $host -port $port]

Prev | Home | Next
pg_lo_export | Up | Connection/result handles as commands