﻿# SQLOP\_FREE\_RESULT

__

**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](https://bitbucket.org/microsabio/exlib/src/master/909060/sql.def)) are listed below.

| **Field** | **Dir** | **Notes** |
|------|------|------|
| handle | in | handle to connection (returned from SQLOP\_INIT\_CONN) |
| dbmsconid | in | [DBMS Connector ID](dbmsconnectorid.md) |
| 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.