xcall SQL, SQLOP_FREE_RESULT, cmdhdr
This operation must be performed at the end of processing a query in order to release the resources used for storing the result set.
Parameters
cmdhdr (ST_SQL_CMDHDR), [in/out]
The fields of interest to this opcode in the cmdhdr structure (defined in SQL.DEF) are listed below.
Field |
Dir |
Notes |
---|---|---|
handle |
in |
handle to connection (returned from SQLOP_INIT_CONN) |
dbmsconid |
in |
|
opflags |
in |
Set to one of the SQL_xxx options in the table below |
cmdarg1,2 |
n/a |
|
rc |
out |
return code (0 = ok, see SQLERR_xxx) |
rcext |
out |
extended error code |
info1,2 |
n/a |
|
sqlstate |
out |
ANSI standard SQL state code |
reshdl |
in |
Result set handle. |
psthdl |
n/a |
|
opflags |
Value |
Notes |
---|---|---|
SQL_CLOSE |
0 |
Close and release result set resources. For ODBC, this does not de-allocate the statement or reset its associated statement attributes and bindings (so a new query can be issued using the prior attributes/bindings). |
SQL_DROP |
1 |
Close and release all resources associated with the last statement (result set, attributes, bindings). [ODBC] |
SQL_UNBIND |
2 |
Unbind any parameter bindings but leave the remaining statement resources in effect. [ODBC] |
SQL_RESET_PARAMS |
3 |
Reset any attributes previously set for the current statement but leave the remaining statement resources in effect. [ODBC] |
Notes
For MySQL, all options are equivalent to SQL_DROP. But for ODBC, which has considerably higher overhead to set up a statement, it is more efficient to use one of the other options in order to issue a new statement without having to establish your statement attributes again. Note that the SQL_UNBIND option only applies to explicit column/variable bindings.