diff --git a/doc/src/sgml/libpgtcl.sgml b/doc/src/sgml/libpgtcl.sgml index d1e795f6ba..5114cc2b52 100644 --- a/doc/src/sgml/libpgtcl.sgml +++ b/doc/src/sgml/libpgtcl.sgml @@ -156,6 +156,48 @@ proc getDBs { {host "localhost"} {port "5432"} } { + +Loading <application>pgtcl</application> into your application + + + Before using pgtcl commands, you must load + libpgtcl into your Tcl application. This is normally + done with the Tcl load command. Here is an example: + + + load libpgtcl[info sharedlibextension] + + + The use of info sharedlibextension is recommended in + preference to hard-wiring .so or .sl into + the program. + + + + The load command will fail unless the system's dynamic loader + knows where to look for the libpgtcl shared library file. + You may need to work with ldconfig, or set the environment + variable LD_LIBRARY_PATH, or use some equivalent facility for + your platform to make it work. + + + + libpgtcl in turn depends on libpq, so the + dynamic loader must also be able to find the libpq shared + library. In practice this is seldom an issue, since both of these + shared libraries are normally stored in the same directory, but it + can be a stumbling block in some configurations. + + + + If you use a custom executable for your application, you might choose + to statically bind libpgtcl into the executable and thereby + avoid the load command and the potential problems of dynamic + linking. See the source code for pgtclsh for an example. + + + + <application>pgtcl</application> Command Reference Information @@ -817,8 +859,7 @@ loop over the result of a SELECT statement 1997-12-24 -pg_select dbHandle queryString - arrayVar queryProcedure +pg_select dbHandle queryString arrayVar queryProcedure @@ -874,18 +915,9 @@ pg_select dbHandle Outputs - - - - resultHandle - - - - the return result is either an error message or a handle for a query result. - - - - + +None. + @@ -908,6 +940,37 @@ given chunk of code for each tuple in the result. queryProcedure is executed. + + + In addition to the field values, the following special entries are +made in the array: + + + +.headers + +A list of the column names returned by the SELECT. + + + + +.numcols + +The number of columns returned by the SELECT. + + + + +.tupno + +The current tuple number, starting at zero and incrementing +for each iteration of the loop body. + + + + + + @@ -918,7 +981,7 @@ This would work if table table has fields control (and, perhaps, other fields): pg_select $pgconn "SELECT * FROM table" array { - puts [format "%5d %s" array(control) array(name)] + puts [format "%5d %s" $array(control) $array(name)] }