Please enable JavaScript to view this site.

ESL Documentation

Your application can submit a SQL statement for execution in two ways:

Direct - An application uses direct execution if it needs to execute a SQL statement once and does not need information about the result set prior to execution.

Prepared - An application uses prepared execution if it needs to execute the same SQL statement more than once or if it needs information about the result set prior to execution (such as number of columns).

Direct Execution

If your application does not require information about the result set prior to completion of the SQL request and will submit a statement only once, call EDSExecDirect to submit the SQL statement.

Prepared Execution

If your application will submit the SQL statement multiple times, possibly with intermediate changes to parameter values, prepare the request before execution.

The ESL application can perform the following two actions in any order after EDSAllocStmt and prior to EDSExecute:

Call EDSPrepare and pass the SQL statement as an argument.

If the SQL statement includes parameter markers, call EDSSetParam to associate ESL variables with corresponding parameter markers. If this is not the first execution of a SQL statement, you can reuse previously used variables.

 

Set parameter values for all parameter markers, and then call EDSExecute to submit the request.

If you do not set new parameter values prior to a subsequent call to EDSExecute, the driver reuses existing parameter values.

Preparing a statement before it is executed provides the following advantages:

It is the most efficient way to execute the statement more than once, especially if the statement is complex. The data source compiles the statement, produces an access plan, and returns an access plan identifier to the driver. The data source minimizes processing time by using the access plan each time it executes the statement.

It allows the driver to send an access plan identifier instead of an entire statement each time the statement is to be executed. This minimizes network traffic.

The driver can return information about a result set before executing the statement. (Refer to Retrieving Results, for details.)