Debian Codegraph @

doc/html/pgtcl-commandhandles.html

raw symbols SCIP
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2 "http://www.w3.org/TR/html4/loose.dtd">
3 <html>
4 <head>
5 <meta name="generator" content="HTML Tidy for HTML5 for Linux version 5.6.0">
6 <title>Connection/result handles as commands</title>
7 <meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.79">
8 <link rev="MADE" href="mailto:[email protected]">
9 <link rel="HOME" title="PostgreSQL Tcl Interface Documentation" href="index.html">
10 <link rel="UP" title="pgtcl - Tcl Binding Library" href="libpgtcl.html">
11 <link rel="PREVIOUS" title="Tcl Namespace Support" href="pgtcl-tclnamespace.html">
12 <link rel="NEXT" title="Example Program" href="pgtcl-examplesect.html">
13 <link rel="STYLESHEET" type="text/css" href="stylesheet.css">
14 </head>
15 <body class="SECT1">
16 <div class="NAVHEADER">
17 <table summary="Header navigation table" width="100%" border="0" cellpadding="0" cellspacing="0">
18 <tr>
19 <th colspan="5" align="center" valign="bottom">PostgreSQL Tcl Interface Documentation</th>
20 </tr>
21 <tr>
22 <td width="10%" align="left" valign="top"><a href="pgtcl-tclnamespace.html" accesskey="P">Prev</a></td>
23 <td width="10%" align="left" valign="top"><a href="libpgtcl.html">Fast Backward</a></td>
24 <td width="60%" align="center" valign="bottom">Chapter 1. <span class="APPLICATION">pgtcl</span> - Tcl Binding Library</td>
25 <td width="10%" align="right" valign="top"><a href="libpgtcl.html">Fast Forward</a></td>
26 <td width="10%" align="right" valign="top"><a href="pgtcl-examplesect.html" accesskey="N">Next</a></td>
27 </tr>
28 </table>
29 <hr align="left" width="100%"></div>
30 <div class="SECT1">
31 <h1 class="SECT1"><a name="PGTCL-COMMANDHANDLES" id="PGTCL-COMMANDHANDLES">1.5. Connection/result handles as commands</a></h1>
32 <p>Starting with version 1.5, you can use the connection/result handle as a Tcl command. What this means is that when a handle for a connection or result is generated, a corresponding Tcl command is also generate. For example, you can do the following:</p>
33 <pre class="PROGRAMLISTING">set conn [pg::connect template1 -host $host -port $port]
34 set res [$conn exec "SELECT datname FROM pg_database ORDER BY datname;"]
35 set datnames [$res -list]
36 $res -clear
37 rename $conn {} ;# or $conn disconnect</pre>
38 <p>Note that deleting the command (<tt class="COMMAND">rename $conn {}</tt>), has the same effect as <tt class="COMMAND">pg::result $res -clear</tt> (if it is a result handle), and <tt class="COMMAND">pg::disconnect</tt> (if it is a connection handle). Also, if that command gets overloaded with a proc definition, then that has the same effect as deleting the command.</p>
39 </div>
40 <div class="NAVFOOTER">
41 <hr align="left" width="100%">
42 <table summary="Footer navigation table" width="100%" border="0" cellpadding="0" cellspacing="0">
43 <tr>
44 <td width="33%" align="left" valign="top"><a href="pgtcl-tclnamespace.html" accesskey="P">Prev</a></td>
45 <td width="34%" align="center" valign="top"><a href="index.html" accesskey="H">Home</a></td>
46 <td width="33%" align="right" valign="top"><a href="pgtcl-examplesect.html" accesskey="N">Next</a></td>
47 </tr>
48 <tr>
49 <td width="33%" align="left" valign="top">Tcl Namespace Support</td>
50 <td width="34%" align="center" valign="top"><a href="libpgtcl.html" accesskey="U">Up</a></td>
51 <td width="33%" align="right" valign="top">Example Program</td>
52 </tr>
53 </table>
54 </div>
55 </body>
56 </html>