In CCI, multiple jobs can be processed simultaneously when using DML queries such as INSERT/UPDATE/DELETE. cci_execute_arrary() and cci_execute_batch() functions can be used to execute such batch jobs. Note that prepared statements cannot be used in the cci_execute_batch() function. The query result will be stored on the array of T_CCI_QUERY_RESULT structures.
Executes sql_stmt as many times as num_sql_stmt specified as a parameter and returns the number of queries executed with the query_result variable. You can use CCI_QUERY_RESULT_RESULT, CCI_QUERY_RESULT_ERR_MSG, and CCI_QUERY_RESULT_STMT_TYPE macros to get result of each query. Regarding the summary of these macros, see cci_execute_array().
Note that the validity check is not performed for each parameter entered in the macro. After using the query_result variable, you must delete the query result by using the cci_query_result_free() function.
If autocommit mode is on, each query in the array is committed after executing.
Caution In the previous version of 2008 R4.3, if the autocommit is on, all queries in the array were committed after all of them are executed.
int cci_execute_batch(int conn_handle, int num_sql_stmt, char **sql_stmt, T_CCI_QUERY_RESULT **query_result, T_CCI_ERROR *err_buf)
int n_queries, n_executed;
count = 3;
queries = (char **) malloc (count * sizeof (char *));
"insert into athlete(name, gender, nation_code, event) values('Ji-sung Park', 'M', 'KOR', 'Soccer')";
"insert into athlete(name, gender, nation_code, event) values('Joo-young Park', 'M', 'KOR', 'Soccer')";
"select * from athlete order by code desc for orderby_num() < 3";
n_executed = cci_execute_batch (con, count, queries, &result, &cci_error);
if (n_executed < 0)
printf ("execute_batch: %d, %s ", cci_error.err_code,
printf ("%d statements were executed. ", n_executed);
for (i = 1; i <= n_executed; i++)
printf ("query %d ", i);
printf ("result count = %d ", CCI_QUERY_RESULT_RESULT (result, i));
printf ("error message = %s ", CCI_QUERY_RESULT_ERR_MSG (result, i));
printf ("statement type = %d ",
CCI_QUERY_RESULT_STMT_TYPE (result, i));
error = cci_query_result_free (result, n_executed);
if (error < 0)
printf ("query_result_free: %d ", error);