Reduction of network flows with CLI array input chaining
CLI array
input chaining causes requests for the execution of prepared statements
to be held and queued at the client until the chain is ended. After
the chain is finished, all of the chained
SQLExecute()
function
requests at the client are sent to the server in a single network
flow.
The following sequence of events (presented as pseudocode) is an
example of how CLI array
input chaining can reduce the number of network flows to the server:
SQLPrepare (statement1)
SQLExecute (statement1)
SQLExecute (statement1)
/* the two execution requests for statement1 are sent to the server in
two network flows */
SQLPrepare (statement2)
/* enable chaining */
SQLSetStmtAttr (statement2, SQL_ATTR_CHAINING_BEGIN)
SQLExecute (statement2)
SQLExecute (statement2)
SQLExecute (statement2)
/* end chaining */
SQLSetStmtAttr (statement2, SQL_ATTR_CHAINING_END)
/* the three execution requests for statement2 are sent to the server
in a single network flow, instead of three separate flows */
If SQL_ERROR or SQL_SUCCESS_WITH_INFO is returned when you set
the SQL_ATTR_CHAINING_END statement attribute, then at least one statement
in the chain of statements returned SQL_ERROR or SQL_SUCCESS_WITH_INFO
when it was executed. Use the CLI diagnostic
functions SQLGetDiagRec()
and SQLGetDiagField()
to
retrieve the information about the cause of a returned message.
Restriction: The CLI driver
does not support array input chaining for compound SQL (compiled)
or compound SQL (inline) statements.