This method is ued to execute a query by using the data bound to a prepared SQL statement. max_col_size specifies the maximum size of a column when it is fetched by the SELECT statement. If the type of the column is CHAR, VARCHAR, NCHAR, VARNCHAR, BIT or VARBIT, the maximum size is the size of the column to be transferred to the client. If max_col_size is 0, all data is retrieved.
If the SQL statement used during preparation is composed of multiple queries, all queries are executed when CCI_EXEC_QUERY_ALL flag has been set, and only the first query is executed if flag has not been set.
If CCI_EXEC_QUERY_ALL flag has been set,
- The return value is the result of the first query.
- If an error occurs in one of the queries, the execution is considered as a failure.
- For a query composed of q1; q2; q3, if q1 succeeds and q2 occurs an error, the result of q1 is valid. That is, when an error occurs, rollback is not executed for previously successful queries.
- If the query is executed successfully, you can get the result of the second query with cci_next_result.
int cci_execute(int req_handle, char flag, int max_col_size, T_CCI_ERROR *err_buf)
- req_handle : (IN) Request handle of a prepared SQL statement
- flag : (IN) Exec flag
- CCI_EXEC_ASYNC : Async query
- max_col_size : (IN) The size of the column to be fetched
- err_buf : (OUT) Database error buffer
- Success :
- SELECT (sync mode) : The number of results, (async mode) : 0
- INSERT, UPDATE : The number of tuples reflected
- Others : 0
- Failure : Error code