Enabling the AUTOFREE feature

You can enable the AUTOFREE feature for an ODBC application in two ways.

About this task

The SQL_INFX_ATTR_AUTO_FREE attribute can be set in any connection state between C2 and C5 (both included) when setting it using SQLSetConnectAttr, whereas it can be set by using SQLSetStmtAttr only when the statement is in S1 (allocated) state. The value of the SQL_INFX_ATTR_AUTO_FREE attribute can be retrieved by using SQLGetConnectAttr or SQLSetStmtAttr.

You can enable the AUTOFREE feature for an ODBC application in either of the following ways:

Procedure

  • Set the SQL_INFX_ATTR_AUTO_FREE attribute with SQLSetConnectAttr.

    When you use SQLSetConnectAttr to enable this attribute, all new allocated statements for that connection inherit the attribute value. The only way to change this attribute value per statement is to set and reset it again as a statement attribute. The default is DISABLED for the connection attribute.

  • Set the SQL_INFX_ATTR_AUTO_FREE attribute with SQLSetStmtAttr.