pg_exec
submits a command to the
PostgreSQL server and returns a result.
Command result handles start with the connection handle and add a
period and a result number.
The handle of the connection on which to execute the command.
The SQL command to execute.
Returns a result handle which can be used with pg_result to obtain the results of the command.
A Tcl error will be thown if an error occurs communicating with the database. Note that no Tcl error will be thrown if an invalid query is successfully sent to the server and a response successfully received. The result status must be checked after a normal return.
Be sure to free the result handle with
pg_result -clear
when you are done with it.
pg_exec
can be used to start a
COPY, after which the application reads directly from
or writes directly to the connection handle.
See Section 5.10 for an example.