pg_result resultHandle resultOption
The handle for a query result.
Specifies one of several possible options.
-statusthe status of the result.
-errorthe error message, if the status indicates error; otherwise an empty string.
-connthe connection that produced the result.
-oidif the command was an INSERT, the OID of the inserted tuple; otherwise 0.
-numTuplesthe number of tuples returned by the query.
-numAttrsthe number of attributes in each tuple.
-assign arrayNameassign the results to an array, using subscripts of the form (tupno,attributeName).
-assignbyidx arrayName
?appendstr?assign the results to an array using the first
attribute's value and the remaining attributes' names
as keys. If appendstr is
given then it is appended to each key. In short, all
but the first field of each tuple are stored into the
array, using subscripts of the form (firstFieldValue,fieldNameAppendStr).
-getTuple
tupleNumberreturns the fields of the indicated tuple in a list. Tuple numbers start at zero.
-tupleArray tupleNumber
arrayNamestores the fields of the tuple in array arrayName, indexed by field names.
Tuple numbers start at zero.
-attributesreturns a list of the names of the tuple attributes.
-lAttributesreturns a list of sublists, {name ftype fsize} for each tuple attribute.
-clearclear the result query object.
pg_result returns information
about a query result created by a prior pg_exec.
You can keep a query result around for as long as you need it,
but when you are done with it, be sure to free it by executing
pg_result -clear. Otherwise, you
have a memory leak, and Pgtcl
will eventually start complaining that you've created too many
query result objects.