Executing Statements Directly

    To execute a statement directly and one time only
  1. If the statement has parameter markers, for each parameter
    1. Call SQLBindParameter to bind a program buffer to the statement parameter.

      If the parameter is a data-at-execution text or image parameter, set it up. For more information, see Using Data-at-Execution Parameters.

    2. Put the data values into the bound program buffer.
  2. Call SQLExecDirect to execute the statement.
  3. If data-at-execution text or image parameters are used, handle them. For more information, see Using Data-at-Execution Parameters.
    To execute a statement directly using multiple sets of parameters
  1. Call SQLParamOptions to set the number of sets (S) of parameters.
  2. For each parameter marker
    1. Allocate an array of S parameter buffers to store data values.
    2. Allocate an array of S parameter buffers to store data lengths.
    3. Call SQLBindParameter to bind the parameter's data value and data length arrays to the statement parameter.

      If the parameter is a data-at-execution text or image parameter, set it up. For more information, see Using Data-at-Execution Parameters.

    4. Put the S data values and S data lengths into the bound parameter arrays.
  3. Call SQLExecDirect to execute the statement multiple times. This will efficiently execute the statement S times, once for each set of parameters.
  4. If data-at-execution text or image parameters are used, handle them. For more information, see Using Data-at-Execution Parameters.