|
3 | 3 |
|
4 | 4 | <Para>
|
5 | 5 | pgtcl is a tcl package for front-end programs to interface with <ProductName>Postgres</ProductName>
|
6 |
| -backends. pgtcl does not use the libpq library but communicates to |
7 |
| -the backend directly via the frontend-backend protocol. Thus, it is |
8 |
| -more efficient than previous postgres->tcl bindings which are layered |
9 |
| -on top of libpq. In addition, pgtcl can handle multiple backend |
10 |
| -connections from a single frontend application. |
| 6 | +backends. It makes most of the functionality of libpq available to |
| 7 | +tcl scripts. |
11 | 8 | </Para>
|
12 | 9 |
|
13 | 10 | <Para>
|
@@ -42,17 +39,25 @@ the standard Unix file system interface.
|
42 | 39 | <ENTRY>pg_disconnect</ENTRY>
|
43 | 40 | <ENTRY>closes a connection</ENTRY>
|
44 | 41 | </ROW>
|
| 42 | + <ROW> |
| 43 | + <ENTRY>pg_conndefaults</ENTRY> |
| 44 | + <ENTRY>get connection options and their defaults</ENTRY> |
| 45 | + </ROW> |
45 | 46 | <ROW>
|
46 | 47 | <ENTRY>pg_exec</ENTRY>
|
47 | 48 | <ENTRY>send a query to the backend</ENTRY>
|
48 | 49 | </ROW>
|
| 50 | + <ROW> |
| 51 | + <ENTRY>pg_result</ENTRY> |
| 52 | + <ENTRY>manipulate the results of a query</ENTRY> |
| 53 | + </ROW> |
49 | 54 | <ROW>
|
50 | 55 | <ENTRY>pg_select</ENTRY>
|
51 | 56 | <ENTRY>loop over the result of a select statement</ENTRY>
|
52 | 57 | </ROW>
|
53 | 58 | <ROW>
|
54 |
| - <ENTRY>pg_result</ENTRY> |
55 |
| - <ENTRY>manipulate the results of a query</ENTRY> |
| 59 | + <ENTRY>pg_listen</ENTRY> |
| 60 | + <ENTRY>establish a callback for NOTIFY messages</ENTRY> |
56 | 61 | </ROW>
|
57 | 62 |
|
58 | 63 | <ROW>
|
@@ -101,8 +106,7 @@ the standard Unix file system interface.
|
101 | 106 | </Para>
|
102 | 107 |
|
103 | 108 | <Para>
|
104 |
| -Some commands equivalent to libpq commands are provided for connection |
105 |
| -and query operations. |
| 109 | +These commands are described further on subsequent pages. |
106 | 110 | </Para>
|
107 | 111 |
|
108 | 112 | <Para>
|
@@ -142,7 +146,7 @@ proc getDBs { {host "localhost"} {port "5432"} } {
|
142 | 146 | </Sect1>
|
143 | 147 |
|
144 | 148 | <Sect1>
|
145 |
| -<Title>Reference Information</Title> |
| 149 | +<Title>pgtcl Command Reference Information</Title> |
146 | 150 |
|
147 | 151 | <REFENTRY ID="PGTCL-PGCONNECT-1">
|
148 | 152 | <REFMETA>
|
@@ -235,7 +239,7 @@ pg_connect <REPLACEABLE CLASS="PARAMETER">dbName</REPLACEABLE> <OPTIONAL>-host <
|
235 | 239 | <LISTITEM>
|
236 | 240 | <PARA>
|
237 | 241 | The return result is either an error message or a handle for a database
|
238 |
| - connection. Handles start with the prefix "pgp" |
| 242 | + connection. Handles start with the prefix "pgsql" |
239 | 243 | </PARA>
|
240 | 244 | </LISTITEM>
|
241 | 245 | </VARLISTENTRY>
|
@@ -414,7 +418,114 @@ pg_exec <REPLACEABLE CLASS="PARAMETER">dbHandle</REPLACEABLE> <REPLACEABLE CLASS
|
414 | 418 | </TITLE>
|
415 | 419 | <PARA>
|
416 | 420 | <FUNCTION>pg_exec</FUNCTION> submits a query to the <ProductName>Postgres</ProductName> backend and returns a result.
|
417 |
| - Handles start with the prefix "pgp". |
| 421 | + |
| 422 | +Query result handles start with the connection handle and add a period |
| 423 | +and a result number. |
| 424 | +</PARA> |
| 425 | +</REFSECT1> |
| 426 | + |
| 427 | +<REFENTRY ID="PGTCL-PGLISTEN-1"> |
| 428 | +<REFMETA> |
| 429 | +<REFENTRYTITLE>pg_listen</REFENTRYTITLE> |
| 430 | +<REFMISCINFO>PGTCL - Asynchronous Notify</REFMISCINFO> |
| 431 | +</REFMETA> |
| 432 | +<REFNAMEDIV> |
| 433 | +<REFNAME>pg_listen |
| 434 | +</REFNAME> |
| 435 | +<REFPURPOSE>sets or changes a callback for asynchronous NOTIFY messages |
| 436 | +</REFPURPOSE> |
| 437 | +<INDEXTERM ID="IX-PGTCL-PGLISTEN-1"><PRIMARY>pgtcl</PRIMARY><SECONDARY>notify</SECONDARY></INDEXTERM> |
| 438 | +<INDEXTERM ID="IX-PGTCL-PGLISTEN-2"><PRIMARY>notify</PRIMARY></INDEXTERM> |
| 439 | +</REFNAMEDIV> |
| 440 | +<REFSYNOPSISDIV> |
| 441 | +<REFSYNOPSISDIVINFO> |
| 442 | +<DATE>1998-5-22</DATE> |
| 443 | +</REFSYNOPSISDIVINFO> |
| 444 | +<SYNOPSIS> |
| 445 | +pg_listen <REPLACEABLE CLASS="PARAMETER">dbHandle</REPLACEABLE> <REPLACEABLE CLASS="PARAMETER">notifyName</REPLACEABLE> <REPLACEABLE CLASS="PARAMETER">callbackCommand</REPLACEABLE> |
| 446 | +</SYNOPSIS> |
| 447 | + |
| 448 | +<REFSECT2 ID="R2-PGTCL-PGLISTEN-1"> |
| 449 | +<REFSECT2INFO> |
| 450 | +<DATE>1998-5-22</DATE> |
| 451 | +</REFSECT2INFO> |
| 452 | +<TITLE>Inputs |
| 453 | +</TITLE> |
| 454 | +<VARIABLELIST> |
| 455 | +<VARLISTENTRY> |
| 456 | +<TERM> |
| 457 | + <REPLACEABLE CLASS="PARAMETER">dbHandle</REPLACEABLE> |
| 458 | +</TERM> |
| 459 | +<LISTITEM> |
| 460 | +<PARA>Specifies a valid database handle. |
| 461 | +</PARA> |
| 462 | +</LISTITEM> |
| 463 | +</VARLISTENTRY> |
| 464 | +<VARLISTENTRY> |
| 465 | +<TERM> |
| 466 | + <REPLACEABLE CLASS="PARAMETER">notifyName</REPLACEABLE> |
| 467 | +</TERM> |
| 468 | +<LISTITEM> |
| 469 | +<PARA>Specifies the notification name to start or stop listening to. |
| 470 | +</PARA> |
| 471 | +</LISTITEM> |
| 472 | +</VARLISTENTRY> |
| 473 | +<VARLISTENTRY> |
| 474 | +<TERM> |
| 475 | + <REPLACEABLE CLASS="PARAMETER">callbackCommand</REPLACEABLE> |
| 476 | +</TERM> |
| 477 | +<LISTITEM> |
| 478 | +<PARA>If present and not empty, provides the command string to execute |
| 479 | +when a matching notification arrives. |
| 480 | +</PARA> |
| 481 | +</LISTITEM> |
| 482 | +</VARLISTENTRY> |
| 483 | +</VARIABLELIST> |
| 484 | +</REFSECT2> |
| 485 | + |
| 486 | +<REFSECT2 ID="R2-PGTCL-PGLISTEN-2"> |
| 487 | +<REFSECT2INFO> |
| 488 | +<DATE>1998-5-22</DATE> |
| 489 | +</REFSECT2INFO> |
| 490 | +<TITLE>Outputs |
| 491 | +</TITLE> |
| 492 | +<VARIABLELIST> |
| 493 | +<VARLISTENTRY> |
| 494 | +<TERM> |
| 495 | + None |
| 496 | +</TERM> |
| 497 | +<LISTITEM> |
| 498 | +<PARA> |
| 499 | +</PARA> |
| 500 | +</LISTITEM> |
| 501 | +</VARLISTENTRY> |
| 502 | +</VARIABLELIST> |
| 503 | +</REFSECT2> |
| 504 | +</REFSYNOPSISDIV> |
| 505 | + |
| 506 | +<REFSECT1 ID="R1-PGTCL-PGLISTEN-1"> |
| 507 | +<REFSECT1INFO> |
| 508 | +<DATE>1998-5-22</DATE> |
| 509 | +</REFSECT1INFO> |
| 510 | +<TITLE>Description |
| 511 | +</TITLE> |
| 512 | +<PARA><FUNCTION>pg_listen</FUNCTION> creates, changes, or cancels a request |
| 513 | +to listen for asynchronous NOTIFY messages from the |
| 514 | +<ProductName>Postgres</ProductName> backend. With a callbackCommand |
| 515 | +parameter, the request is established, or the command string of an already |
| 516 | +existing request is replaced. With no callbackCommand parameter, a prior |
| 517 | +request is canceled. |
| 518 | +</PARA> |
| 519 | +After a <PARA><FUNCTION>pg_listen</FUNCTION> request is established, |
| 520 | +the specified command string is executed whenever a NOTIFY message bearing |
| 521 | +the given name arrives from the backend. This occurs when any |
| 522 | +<ProductName>Postgres</ProductName> client application issues a NOTIFY command |
| 523 | +referencing that name. (Note that the name can be, but does not have to be, |
| 524 | +that of an existing relation in the database.) |
| 525 | +The command string is executed from the Tcl idle loop. That is the normal |
| 526 | +idle state of an application written with Tk. In non-Tk Tcl shells, you can |
| 527 | +execute <FUNCTION>update</FUNCTION> or <FUNCTION>vwait</FUNCTION> to cause |
| 528 | +the idle loop to be entered. |
418 | 529 | </PARA>
|
419 | 530 | </REFSECT1>
|
420 | 531 |
|
|
0 commit comments