Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

Versions available for this page: CUBRID 8.2.1 |  CUBRID 8.3.0 |  CUBRID 8.3.1 |  CUBRID 8.4.0 |  CUBRID 8.4.1 |  CUBRID 8.4.3 |  CUBRID 9.0.0 | 



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.

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 the macro (CCI_QUERY_RESULT_RESULT, CCI_QUERY_RESULT_ERR_MSG, CCI_QUERY_RESULT_STMT_TYPE) available in the cci_execute_array() function to get the information about the execution result.

However, 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.


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)

  • conn_handle : (IN) Connection handle
  • num_sql_stmt : (IN) The number of sql_stmts
  • sql_stmt : (IN) SQL statement array
  • query_result : (OUT) The results of sql_stmt
  • err_buf : (OUT) Database error buffer
Return Value
  • Success : The number of executed queries
  • Failure : Negative number
Error Code

char **queries;


  int n_queries, n_executed;



  count = 3;

  queries = (char **) malloc (count * sizeof (char *));

  queries[0] =

    "insert into athlete(name, gender, nation_code, event) values('Ji-sung Park', 'M', 'KOR', 'Soccer')";

  queries[1] =

    "insert into athlete(name, gender, nation_code, event) values('Joo-young Park', 'M', 'KOR', 'Soccer')";

  queries[2] =

    "select * from athlete order by code desc for orderby_num() < 3";

//calling cci_execute_batch()

  n_executed = cci_execute_batch (con, count, queries, &result, &cci_error);

  if (n_executed < 0)


      printf ("execute_batch: %d, %s\n", cci_error.err_code,


      goto handle_error;


  printf ("%d statements were executed.\n", n_executed);


  for (i = 1; i <= n_executed; i++)


      printf ("query %d\n", i);

      printf ("result count = %d\n", CCI_QUERY_RESULT_RESULT (result, i));

      printf ("error message = %s\n", CCI_QUERY_RESULT_ERR_MSG (result, i));

      printf ("statement type = %d\n",

              CCI_QUERY_RESULT_STMT_TYPE (result, i));



  error = cci_query_result_free (result, n_executed);

  if (error < 0)                                                                                                                            


      printf ("query_result_free: %d\n", error);   

      goto handle_error;