The cci_prepare function prepares SQL execution by acquiring request handle for SQL statements. If a SQL statement consists of multiple queries, the preparation is performed only for the first query. With the parameter of this function, an address to T_CCI_ERROR where connection handle, SQL statement, flag, and error information are stored.
CCI_PREPARE_UPDATABLE, CCI_PREPARE_INCLUDE_OID, or CCI_PREPARE_HOLDABLE can be configured in flag. If CCI_PREPARE_UPDATABLE is configured, updatable resultset is created and CCI_PREPARE_INCLUDE_OID is automatically configured. CCI_PREPARE_UPDATABLE and CCI_PREPARE_HOLDABLE can not be used simultaneously in flag.
The default value of whether to keep result set after commit is cursor holdability. Thus, if you want to configure CCI_PREPARE_UPDATABLE in flag of ci_prepare(), you should call cci_set_holdable(conn, 0) first before calling cci_prepare() so that cursor cannot be maintained.
However, not all updatable resultsets are created even though CCI_PREPARE_UPDATABLE is configured. So you need to check if the results are updatable by using cci_is_updatable after preparation. You can use cci_oid_put or cci_oid_put2 to update result sets.
The conditions of updatable queries are as follows:
If CCI_PREPARE_HOLDABLE is set, a cursor is holded as long as result set is closed or connection is disconnected after the statement is committed (see CUBRID SQL Guide > Transaction Lock >Cursor Holdability).
int cci_prepare(int conn_handle, char *sql_stmt, char flag,T_CCI_ERROR *err_buf)