Home | Previous Page | Next Page   Improving Application Performance >

Delaying Execution of the SQLPREPARE Statement

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:

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 ]