Hitachi

Hitachi Advanced Database Application Development Guide


19.4.2 a_rdb_SQLBindArrayParams() (bind dynamic parameters in batch mode)

Organization of this subsection

(1) Function

This CLI function binds (associates) the dynamic parameters in an SQL statement with an area for specifying their values.

This CLI function binds multiple sets of dynamic parameters in any of the following SQL statements in the batch mode:

You use this CLI function to perform batch transfer of dynamic parameter values. For details about batch transfer of dynamic parameter values, see 5.15 Batch transfer of dynamic parameter values.

(2) Format

signed short a_rdb_SQLBindArrayParams
(
  void                          *ConnectionHandle,  /* In  */
  void                          *StatementHandle,   /* In  */
  int                            ArrayCount,        /* In  */
  unsigned short                 ParameterCount,    /* In  */
  a_rdb_SQLParameterInfo_t      *ParameterInfo[],   /* In  */
  unsigned long long             RowCount[],        /* Out */
  void                          *Option             /* In  */
)

(3) Arguments

ConnectionHandle

Specifies a connection handle.

StatementHandle

Specifies a statement handle.

ArrayCount

Specifies the number of ParameterInfo and RowCount arrays.

ParameterCount

Specifies the number of dynamic parameters to which values are to be assigned.

Specify the number of dynamic parameters acquired by a_rdb_SQLNumParams().

ParameterInfo[]

Specifies an array of addresses for the parameter information area in which the addresses of the value storage areas are to be set. Provide an area in which as many a_rdb_SQLParameterInfo_t structures as is specified for ParameterCount can be placed consecutively for each array, and then specify the start addresses of those areas as the values for the array.

For details about the a_rdb_SQLParameterInfo_t structure, see 19.7.5 a_rdb_SQLParameterInfo_t structure (parameter information).

RowCount[]

Specifies the start addresses of the array in which the numbers of rows resulting from SQL statement processing are stored. If NULL is specified, no numbers of results rows are acquired.

After an SQL statement has been executed by a_rdb_SQLExecute(), the number of results rows obtained by using each set of dynamic parameter values is stored in each array.

If an error occurs during SQL statement execution, the numbers of results rows obtained up to the point of the error are stored. However, if the processing is rolled back because of an SQL statement error, zero is set in all arrays.

Option

Specifies NULL.

(4) Return value

  1. If a_rdb_SQLBindArrayParams() terminates normally, a_rdb_RC_SQL_SUCCESS is returned.

  2. If the dynamic parameters have been bound successfully but the disk containing client message log files has become full, a_rdb_RC_SQL_WARNING is returned.

  3. If an error occurs while messages cannot be output to the client message log file, the error cause code is returned. For details about the error cause code, see 19.8 Return values of the CLI functions.

(5) Notes

  1. You must apply boundary alignment to the start addresses of the data storage areas of the a_rdb_SQLParameterInfo_t structure. For details about boundary alignment, see (2) Boundary alignment in 18.2.6 Notes about using the CLI functions.

  2. When a_rdb_SQLBindArrayParams() is used to associate dynamic parameters and then a_rdb_SQLExecute() is executed, the processing continues unless the SQL statement results in an error. Even if a specified set of dynamic parameter values results in zero as the number of results rows during processing, the processing still continues.

  3. The total number of results rows that have been stored in the RowCount[] array is stored in RowCount of the a_rdb_SQLResultInfo_t structure.

  4. a_rdb_SQLBindArrayParams() cannot be executed in the following cases:

    • Connection has not been established.

    • An invalid statement handle is specified.

    • A value smaller than zero is specified as the number of arrays.

    • The number of dynamic parameters specified does not match the number of dynamic parameters acquired by a_rdb_SQLNumParams().

    • An attempt was made to execute a_rdb_SQLBindArrayParams() on an SQL statement that is not DELETE, INSERT, or UPDATE.