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 | 

cci_prepare

Description

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 or CCI_PREPARE_INCLUDE_OID can be configured in flag. If CCI_PREPARE_UPDATABLE is configured, updatable result set is created and CCI_PREPARE_INCLUDE_OID is automatically configured. However, not all updatable result sets 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. In order to update result set, you can use cci_oid_put or cci_oid_put2 function.

The conditions of updatable queries are as follows:

  • Must be SELECT.
  • OID can be included in the query result.
  • The column to be updated must be the one that belongs to the table specified in the FROM clause.
Syntax

int cci_prepare(int conn_handle, char *sql_stmt, char flag,T_CCI_ERROR *err_buf)

  • conn_handle: (IN) Connection handle
  • sql_stmt: (IN) SQL statement
  • flag: (IN) prepare flag (CCI_PREPARE_UPDATABLE or CCI_PREPARE_INCLUDE_OID)
  • err_buf: (OUT) Database error buffer
Return Value
  • Success: Request handle ID (int)
  • Failure: Error code
Error Code
  • CCI_ER_CON_HANDLE
  • CCI_ER_DBMS
  • CCI_ER_COMMUNICATION
  • CCI_ER_STR_PARAM
  • CCI_ER_NO_MORE_MEMORY
  • CCI_ER_CONNECT
  • CCI_ER_QUERY_TIMEOUT
  • CCI_ER_LOGIN_TIMEOUT