Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit d79bb2f

Browse files
committed
quick doc cleanup for libpgtcl from D'Arcy
1 parent 0263870 commit d79bb2f

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

doc/libpgtcl.doc

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ The pgtcl package provides the following commands.
1717
pg_connect - opens a connection to the backend server
1818
pg_disconnect - closes a connection
1919
pg_exec - send a query to the backend
20+
pg_select - loop over the result of a select statement
2021
pg_result - manipulate the results of a query
2122

2223
pg_lo_creat - create a large object
@@ -54,7 +55,25 @@ The pgtcl package provides the following commands.
5455
the return result is either an error message or a handle for a query
5556
result. Handles start with the prefix "pgp"
5657

57-
4) pg_result: get information about a query result
58+
4) pg_select: loop over the result of a select statement
59+
60+
syntax:
61+
pg_select connection query var proc
62+
63+
The query must be a select statement. Anything else returns an error.
64+
The var variable is an array name used in the loop. It is filled
65+
out with the result of the query for each tuple using the field
66+
names as the associative indeces. Proc is the procedure that is
67+
run for each tuple found.
68+
69+
example: (DB is set to database name)
70+
set conn [pg_connect $DB]
71+
pg_select $conn "SELECT * from table" array {
72+
puts [format "%5d %s" array(control) array(name)]
73+
}
74+
pg_disconnect $conn
75+
76+
5) pg_result: get information about a query result
5877

5978
syntax:
6079
pg_result result ?option?

0 commit comments

Comments
 (0)