You can defer execution of the SQLPrepare statement by enabling the deferred-PREPARE feature. This feature works primarily with dynamic SQL statements where the application does a series of SQLPrepare and SQLExecute statements. It optimizes the number of round-trip messages to the database server by not sending SQLPrepare statements to the database server until the application calls SQLExecute on that statement.
When deferred-PREPARE is enabled, the following behavior is expected of the application:
You can enable the deferred-PREPARE feature for an ODBC application in either of the following ways:
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/reset it again as a statement attribute. The default is DISABLED for the connection attribute.
The SQL_INFX_ATTR_DEFERRED_PREPARE attribute can be set in any connection state between C2 and C5 (both included) when setting it using SQLSetConnectAttr, whereas it can be set using SQLSetStmtAttr only when the statement is in S1 (allocated) state. The value of the SQL_INFX_ATTR_DEFERRED_PREPARE attribute can be retrieved using SQLGetConnectAttr or SQLSetStmtAttr.
Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]