:meta-keywords: CCI driver, CCI api, cubrid cci :meta-description: CUBRID CCI API Reference for your C-based back-end application. CCI API Reference ================= .. contents:: cci_bind_param -------------- .. c:function:: int cci_bind_param (int req_handle, int index, T_CCI_A_TYPE a_type, void *value, T_CCI_U_TYPE u_type, char flag) The **cci_bind_param** function binds data in the *bind* variable of prepared statement. This function converts *value* of the given *a_type* to an actual binding type and stores it. Subsequently, whenever :c:func:`cci_execute` is called, the stored data is sent to the server. If **cci_bind_param** () is called multiple times for the same *index*, the latest configured value is valid. :param req_handle: (IN) Request handle of a prepared statement :param index: (IN) Location of binding; it starts with 1. :param a_type: (IN) Data type of *value* :param value: (IN) Data value to bind :param u_type: (IN) Data type to be applied to the database :param flag: (IN) bind_flag(:c:type:`CCI_BIND_PTR`). :return: Error code (0: success) * **CCI_ER_BIND_INDEX** * **CCI_ER_CON_HANDLE** * **CCI_ER_NO_MORE_MEMORY** * **CCI_ER_REQ_HANDLE** * **CCI_ER_TYPE_CONVERSION** * **CCI_ER_USED_CONNECTION** To bind **NULL** to the database, choose one of below settings. * Set the value of *value* to a **NULL** pointer * Set the value of *u_type* to :c:macro:`CCI_U_TYPE_NULL` The following shows a part of code to bind NULL. .. code-block:: c res = cci_bind_param (req, 2 /* binding index*/, CCI_A_TYPE_STR, NULL, CCI_U_TYPE_STRING, CCI_BIND_PTR); or .. code-block:: c res = cci_bind_param (req, 2 /* binding index*/, CCI_A_TYPE_STR, data, CCI_U_TYPE_NULL, CCI_BIND_PTR); can be used. If **CCI_BIND_PTR** is configured for *flag*, the pointer of *value* variable is copied (shallow copy), but no value is copied. If it is not configured for *flag*, the value of *value* variable is copied (deep copy) by allocating memory. If multiple columns are bound by using the same memory buffer, **CCI_BIND_PTR** must not be configured for the *flag*. **T_CCI_A_TYPE** is a C language type that is used in CCI applications for data binding, and consists of primitive types such as int and float, and user-defined types defined by CCI such as **T_CCI_BIT** and **T_CCI_DATE**. The identifier for each type is defined as shown in the table below. +-----------------------------+-----------------------------+ | a_type | value type | +=============================+=============================+ | **CCI_A_TYPE_STR** | char \* | +-----------------------------+-----------------------------+ | **CCI_A_TYPE_INT** | int \* | +-----------------------------+-----------------------------+ | **CCI_A_TYPE_FLOAT** | float \* | +-----------------------------+-----------------------------+ | **CCI_A_TYPE_DOUBLE** | double \* | +-----------------------------+-----------------------------+ | **CCI_A_TYPE_BIT** | **T_CCI_BIT** \* | +-----------------------------+-----------------------------+ | **CCI_A_TYPE_SET** | **T_CCI_SET** | +-----------------------------+-----------------------------+ | **CCI_A_TYPE_DATE** | **T_CCI_DATE** \* | +-----------------------------+-----------------------------+ | **CCI_A_TYPE_BIGINT** | int64_t \* | | | (For Windows: __int64 \*) | +-----------------------------+-----------------------------+ | **CCI_A_TYPE_BLOB** | **T_CCI_BLOB** | +-----------------------------+-----------------------------+ | **CCI_A_TYPE_CLOB** | **T_CCI_CLOB** | +-----------------------------+-----------------------------+ **T_CCI_U_TYPE** is a column type of database and data bound though the *value* argument is converted into this type. The **cci_bind_param** () function uses two kinds of types to send information which is used to convert U-type data from A-type data; the U-type data can be interpreted by database language and the A-type data can be interpreted by C language. There are various A-type data that are allowed by U-type data. For example, **CCI_U_TYPE_INT** can receive **CCI_A_TYPE_STR** as A-type data including **CCI_A_TYPE_INT**. For information on type conversion, see :ref:`implicit-type-conversion`. Both **T_CCI_A_TYPE** and **T_CCI_U_TYPE** enum(s) are defined in the **cas_cci.h** file. The definition of each identifier is described in the table below. +--------------------------+------------------------------------+ | u_type | Corresponding a_type (default) | +==========================+====================================+ | **CCI_U_TYPE_CHAR** | **CCI_A_TYPE_STR** | +--------------------------+------------------------------------+ | **CCI_U_TYPE_STRING** | **CCI_A_TYPE_STR** | +--------------------------+------------------------------------+ | **CCI_U_TYPE_BIT** | **CCI_A_TYPE_BIT** | +--------------------------+------------------------------------+ | **CCI_U_TYPE_VARBIT** | **CCI_A_TYPE_BIT** | +--------------------------+------------------------------------+ | **CCI_U_TYPE_NUMERIC** | **CCI_A_TYPE_STR** | +--------------------------+------------------------------------+ | **CCI_U_TYPE_INT** | **CCI_A_TYPE_INT** | +--------------------------+------------------------------------+ | **CCI_U_TYPE_SHORT** | **CCI_A_TYPE_INT** | +--------------------------+------------------------------------+ | **CCI_U_TYPE_FLOAT** | **CCI_A_TYPE_FLOAT** | +--------------------------+------------------------------------+ | **CCI_U_TYPE_DOUBLE** | **CCI_A_TYPE_DOUBLE** | +--------------------------+------------------------------------+ | **CCI_U_TYPE_DATE** | **CCI_A_TYPE_DATE** | +--------------------------+------------------------------------+ | **CCI_U_TYPE_TIME** | **CCI_A_TYPE_DATE** | +--------------------------+------------------------------------+ | **CCI_U_TYPE_TIMESTAMP** | **CCI_A_TYPE_DATE** | +--------------------------+------------------------------------+ | **CCI_U_TYPE_OBJECT** | **CCI_A_TYPE_STR** | +--------------------------+------------------------------------+ | **CCI_U_TYPE_BIGINT** | **CCI_A_TYPE_BIGINT** | +--------------------------+------------------------------------+ | **CCI_U_TYPE_DATETIME** | **CCI_A_TYPE_DATE** | +--------------------------+------------------------------------+ | **CCI_U_TYPE_BLOB** | **CCI_A_TYPE_BLOB** | +--------------------------+------------------------------------+ | **CCI_U_TYPE_CLOB** | **CCI_A_TYPE_CLOB** | +--------------------------+------------------------------------+ | **CCI_U_TYPE_ENUM** | **CCI_A_TYPE_STR** | +--------------------------+------------------------------------+ When the string including the date is used as an input parameter of **DATE**, **DATETIME**, or **TIMESTAMP**, "YYYY/MM/DD" or "YYYY-MM-DD" is allowed for the date string type. Therefore, "2012/01/31" or "2012-01-31" is valid, but "01/31/2012" is invalid. The following is an example of having the string that includes the date as an input parameter of the date type. .. code-block:: c // "CREATE TABLE tbl(aa date, bb datetime)"; char *values[][3] = { {"1994/11/30", "1994/11/30 20:08:08"}, {"2008-10-31", "2008-10-31 20:08:08"} }; req = cci_prepare(conn, "insert into tbl (aa, bb) values ( ?, ?)", CCI_PREPARE_INCLUDE_OID, &error); for(i=0; i< 2; i++) { res = cci_bind_param(req, 1, CCI_A_TYPE_STR, values[i][0], CCI_U_TYPE_DATE, (char)NULL); res = cci_bind_param(req, 2, CCI_A_TYPE_STR, values[i][1], CCI_U_TYPE_DATETIME, (char)NULL); cci_execute(req, CCI_EXEC_QUERY_ALL, 0, err_buf); } cci_bind_param_array -------------------- .. c:function:: int cci_bind_param_array(int req_handle, int index, T_CCI_A_TYPE a_type, void *value, int *null_ind, T_CCI_U_TYPE u_type) The **cci_bind_param_array** function binds a parameter array for a prepared :c:func:`cci_execute_array` is called, data is sent to the server by the stored *value* pointer. If **cci_bind_param_array** () is called multiple times for the same *index*, the last configured value is valid. If **NULL** is bound to the data, a non-zero value is configured in *null_ind*. If *value* is a **NULL** pointer, or *u_type* is **CCI_U_TYPE_NULL**, all data are bound to **NULL** and the data buffer used by *value* cannot be reused. For the data type of *value* for *a_type*, see the :c:func:`cci_bind_param` function description. :param req_handle: (IN) Request handle of the prepared statement :param index: (IN) Binding location :param a_type: (IN) Data type of *value* :param value: (IN) Data value to be bound :param null_ind: (IN) **NULL** indicator array (0 : not **NULL**, 1 : **NULL**) :param u_type: (IN) Data type to be applied to the database. :return: Error code (0: success) * **CCI_ER_BIND_INDEX** * **CCI_ER_BIND_ARRAY_SIZE** * **CCI_ER_CON_HANDLE** * **CCI_ER_NO_MORE_MEMORY** * **CCI_ER_REQ_HANDLE** * **CCI_ER_TYPE_CONVERSION** * **CCI_ER_USED_CONNECTION** cci_bind_param_array_size ------------------------- .. c:function:: int cci_bind_param_array_size(int req_handle, int array_size) The **cci_bind_param_array_size** function determines the size of the array to be used in :c:func:`cci_bind_param_array`. **cci_bind_param_array_size** () must be called first before :c:func:`cci_bind_param_array` is used. :param req_handle: Request handle of a prepared statement :param array_size: (IN) binding array size :return: Error code (0: success) * **CCI_ER_CON_HANDLE** * **CCI_ER_REQ_HANDLE** * **CCI_ER_USED_CONNECTION** cci_bind_param_ex ----------------- .. c:function:: int cci_bind_param_ex (int req_handle, int index, T_CCI_A_TYPE a_type, void *value, int length, T_CCI_U_TYPE u_type, char flag) The **cci_bind_param_ex** function works as the same with :c:func:`cci_bind_param`. However, it has an additional argument, *length*, which specifies the byte length of a string if bound data is a string. :param req_handle: (IN) Request handle of the prepared statement :param index: (IN) Binding location, starting from 1 :param a_type: (IN) Data type of *value* :param value: (IN) Data value to be bound :param length: (IN) Byte length of a string to be bound :param u_type: (IN) Data type to be applied to the database. :param flag: (IN) bind_flag(:c:type:`CCI_BIND_PTR`). :return: Error code(0: success) The *length* argument can be used for binding a string which includes '\\0' as below. .. code-block:: c cci_bind_param_ex(statement, 1, CCI_A_TYPE_STR, "aaa\0bbb", 7, CCI_U_TYPE_STRING, 0); cci_blob_free ------------- .. c:function:: int cci_blob_free(T_CCI_BLOB blob) The **cci_blob_free** function frees memory of *blob* struct. :return: Error code (0: success) * **CCI_ER_INVALID_LOB_HANDLE** cci_blob_new ------------ .. c:function:: int cci_blob_new(int conn_handle, T_CCI_BLOB* blob, T_CCI_ERROR* error_buf) The **cci_blob_new** function creates an empty file where **LOB** data is stored and returns locator referring to the data to *blob* struct. :param conn_handle: (IN) Connection handle :param blob: (OUT) **LOB** locator :param error_buf: (OUT) Error buffer :return: Error code (0: success) * **CCI_ER_COMMUNICATION** * **CCI_ER_CON_HANDLE** * **CCI_ER_CONNECT** * **CCI_ER_DBMS** * **CCI_ER_INVALID_LOB_HANDLE** * **CCI_ER_LOGIN_TIMEOUT** * **CCI_ER_NO_MORE_MEMORY** * **CCI_ER_USED_CONNECTION** cci_blob_read ------------- .. c:function:: int cci_blob_read(int conn_handle, T_CCI_BLOB blob, long start_pos, int length, char *buf, T_CCI_ERROR* error_buf) The **cci_blob_read** function reads as much as data from *start_pos* to *length* of the **LOB** data file specified in *blob*; then it stores it in *buf* and returns it. :param conn_handle: (IN) Connection handle :param blob: (OUT) **LOB** locator :param start_pos: (IN) Index location of **LOB** data file :param length: (IN) **LOB** data length from buffer :param buf: (IN) Data buffer to read :param error_buf: (OUT) Error buffer :return: Size of read value (>= 0: success), Error code (< 0: error) * **CCI_ER_COMMUNICATION** * **CCI_ER_CON_HANDLE** * **CCI_ER_CONNECT** * **CCI_ER_DBMS** * **CCI_ER_INVALID_LOB_HANDLE** * **CCI_ER_INVALID_LOB_READ_POS** * **CCI_ER_LOGIN_TIMEOUT** * **CCI_ER_NO_MORE_MEMORY** * **CCI_ER_QUERY_TIMEOUT** * **CCI_ER_USED_CONNECTION** cci_blob_size ------------- .. c:function:: long long cci_blob_size(T_CCI_BLOB* blob) The **cci_blob_size** function returns data file size that is specified in *blob*. :param blob: (OUT) **LOB** locator :return: Size of **BLOB** data file (>= 0: success), Error code (< 0: error) * **CCI_ER_INVALID_LOB_HANDLE** cci_blob_write -------------- .. c:function:: int cci_blob_write(int conn_handle, T_CCI_BLOB blob, long start_pos, int length, const char *buf, T_CCI_ERROR* error_buf) The **cci_blob_write** function reads as much as data from *buf* to *length* and stores it from *start_pos* of the **LOB** data file specified in *blob*. :param conn_handle: (IN) Connection handle :param blob: (OUT) **LOB** locator :param start_pos: (IN) Index location of **LOB** data file :param length: (IN) Data length from buffer :param buf: (OUT) Data buffer to write :param error_buf: (OUT) Error buffer :return: Size of written value (>= 0: success), Error code (< 0: error) * **CCI_ER_COMMUNICATION** * **CCI_ER_CON_HANDLE** * **CCI_ER_CONNECT** * **CCI_ER_DBMS** * **CCI_ER_INVALID_LOB_HANDLE** * **CCI_ER_LOGIN_TIMEOUT** * **CCI_ER_NO_MORE_MEMORY** * **CCI_ER_QUERY_TIMEOUT** * **CCI_ER_USED_CONNECTION** cci_cancel ---------- .. c:function:: int cci_cancel(int conn_handle) Cancel the running query on the other thread. This function executes the same behavior as Statement.cancel() method in JAVA. :param conn_handle: (IN) Connection handle :return: Error code * **CCI_ER_COMMUNICATION** * **CCI_ER_CON_HANDLE** * **CCI_ER_CONNECT** The following shows how to cancel the query execution of a thread. .. code-block:: c /* gcc -o pthr pthr.c -m64 -I${CUBRID}/include -lnsl ${CUBRID}/lib/libcascci.so -lpthread */ #include #include #include #include #include #include #define QUERY "select * from db_class A, db_class B, db_class C, db_class D, db_class E" static void *thread_main (void *arg); static void *execute_statement (int con, char *sql_stmt); int main (int argc, char *argv[]) { int thr_id = 0, conn_handle = 0, res = 0; void *jret; pthread_t th; char url[1024]; T_CCI_ERROR error; snprintf (url, 1024, "cci:CUBRID:localhost:33000:demodb:PUBLIC::"); conn_handle = cci_connect_with_url_ex (url, NULL, NULL, &error); if (conn_handle < 0) { printf ("ERROR: %s\n", error.err_msg); return -1; } res = pthread_create (&th, NULL, &thread_main, (void *) &conn_handle); if (res < 0) { printf ("thread fork failed.\n"); return -1; } else { printf ("thread started\n"); } sleep (5); // If thread_main is still running, below cancels the query of thread_main. res = cci_cancel (conn_handle); if (res < 0) { printf ("cci_cancel failed\n"); return -1; } else { printf ("The query was canceled by cci_cancel.\n"); } res = pthread_join (th, &jret); if (res < 0) { printf ("thread join failed.\n"); return -1; } printf ("thread_main was cancelled with\n\t%s\n", (char *) jret); free (jret); res = cci_disconnect (conn_handle, &error); if (res < 0) { printf ("ERROR: %s\n", error.err_msg); return res; } return 0; } void * thread_main (void *arg) { int con = *((int *) arg); int ret_val; void *ret_ptr; T_CCI_ERROR error; cci_set_autocommit (con, CCI_AUTOCOMMIT_TRUE); ret_ptr = execute_statement (con, QUERY); return ret_ptr; } static void * execute_statement (int con, char *sql_stmt) { int col_count = 1, ind, i, req; T_CCI_ERROR error; char *buffer; char *error_msg; int res = 0; error_msg = (char *) malloc (128); if ((req = cci_prepare (con, sql_stmt, 0, &error)) < 0) { snprintf (error_msg, 128, "cci_prepare ERROR: %s\n", error.err_msg); goto conn_err; } if ((res = cci_execute (req, 0, 0, &error)) < 0) { snprintf (error_msg, 128, "cci_execute ERROR: %s\n", error.err_msg); goto execute_error; } if (res >= 0) { while (1) { res = cci_cursor (req, 1, CCI_CURSOR_CURRENT, &error); if (res == CCI_ER_NO_MORE_DATA) { break; } if (res < 0) { snprintf (error_msg, 128, "cci_cursor ERROR: %s\n", error.err_msg); return error_msg; } if ((res = cci_fetch (req, &error)) < 0) { snprintf (error_msg, 128, "cci_fetch ERROR: %s\n", error.err_msg); return error_msg; } for (i = 1; i <= col_count; i++) { if ((res = cci_get_data (req, i, CCI_A_TYPE_STR, &buffer, &ind)) < 0) { snprintf (error_msg, 128, "cci_get_data ERROR\n"); return error_msg; } } } } if ((res = cci_close_query_result (req, &error)) < 0) { snprintf (error_msg, 128, "cci_close_query_result ERROR: %s\n", error.err_msg); return error_msg; } execute_error: if ((res = cci_close_req_handle (req)) < 0) { snprintf (error_msg, 128, "cci_close_req_handle ERROR\n"); } conn_err: return error_msg; } cci_clob_free ------------- .. c:function:: int cci_clob_free(T_CCI_CLOB clob) The **cci_clob_free** function frees memory of **CLOB** struct. :param clob: (IN) **LOB** locator :return: Error code (0: success) * **CCI_ER_INVALID_LOB_HANDLE** cci_clob_new ------------ .. c:function:: int cci_clob_new(int conn_handle, T_CCI_CLOB* clob, T_CCI_ERROR* error_buf) The **cci_clob_new** function creates an empty file where **LOB** data is stored and returns locator referring to the data to *clob* struct. :param conn_handle: ((IN) Connection handle :param clob: (OUT) **LOB** locator :param error_buf: (OUT) Error buffer :return: Error code (0: success) * **CCI_ER_COMMUNICATION** * **CCI_ER_CON_HANDLE** * **CCI_ER_CONNECT** * **CCI_ER_DBMS** * **CCI_ER_INVALID_LOB_HANDLE** * **CCI_ER_LOGIN_TIMEOUT** * **CCI_ER_NO_MORE_MEMORY** * **CCI_ER_USED_CONNECTION** cci_clob_read ------------- .. c:function:: int cci_clob_read(int conn_handle, T_CCI_CLOB clob, long start_pos, int length, char *buf, T_CCI_ERROR* error_buf) The **cci_clob_read** function reads as much as data from *start_pos* to *length* in the **LOB** data file specified in *clob*; then it stores it in *buf* and returns it. :param conn_handle: (IN) Connection handle :param clob: (IN) **LOB** locator :param start_pos: (IN) Index location of **LOB** data file :param length: (IN) **LOB** data length from buffer :param buf: (IN) Data buffer to read :param error_buf: (OUT) Error buffer :return: Size of read value (>= 0: success), Error code (< 0: Error) * **CCI_ER_COMMUNICATION** * **CCI_ER_CON_HANDLE** * **CCI_ER_CONNECT** * **CCI_ER_DBMS** * **CCI_ER_INVALID_LOB_HANDLE** * **CCI_ER_INVALID_LOB_READ_POS** * **CCI_ER_LOGIN_TIMEOUT** * **CCI_ER_NO_MORE_MEMORY** * **CCI_ER_QUERY_TIMEOUT** * **CCI_ER_USED_CONNECTION** cci_clob_size ------------- .. c:function:: long long cci_clob_size(T_CCI_CLOB* clob) The **cci_clob_size** function returns data file size that is specified in *clob*. :param clob: (IN) **LOB** locator :return: Size of **CLOB** data file (>= 0: success), Error code (< 0: error) * **CCI_ER_INVALID_LOB_HANDLE** cci_clob_write -------------- .. c:function:: int cci_clob_write(int conn_handle, T_CCI_CLOB clob, long start_pos, int length, const char *buf, T_CCI_ERROR* error_buf) The **cci_clob_write** function reads as much as data from *buf* to *length* and then stores the value from *start_pos* in **LOB** data file specified in *clob*. :param conn_handle: (IN) Connection handle :param clob: (IN) **LOB** locator :param start_pos: (IN) Index location of **LOB** data file :param length: (IN) Data length from buffer :param buf: (OUT) Data buffer to write :param error_buf: (OUT) Error buffer :return: Size of written value (>= 0: success), Error code (< 0: Error) * **CCI_ER_COMMUNICATION** * **CCI_ER_CON_HANDLE** * **CCI_ER_CONNECT** * **CCI_ER_DBMS** * **CCI_ER_INVALID_LOB_HANDLE** * **CCI_ER_LOGIN_TIMEOUT** * **CCI_ER_NO_MORE_MEMORY** * **CCI_ER_QUERY_TIMEOUT** * **CCI_ER_USED_CONNECTION** cci_close_query_result ---------------------- .. c:function:: int cci_close_query_result(int req_handle, T_CCI_ERROR *err_buf) The **cci_close_query_result** funciton closes the resultset returned by :c:func:`cci_execute`, :c:func:`cci_execute_array` or :c:func:`cci_execute_batch`. If you run :c:func:`cci_prepare` repeatedly without closing the request handle(req_handle), it is recommended to call this function before calling :c:func:`cci_close_req_handle`. :param req_handle: (IN) Request handle :param err_buf: (OUT) Error buffer :return: Error code (0: success) * **CCI_ER_CON_HANDLE** * **CCI_ER_COMMUNICATION** * **CCI_ER_DBMS** * **CCI_ER_NO_MORE_MEMORY** * **CCI_ER_REQ_HANDLE** * **CCI_ER_RESULT_SET_CLOSED** * **CCI_ER_USED_CONNECTION** cci_close_req_handle -------------------- .. c:function:: int cci_close_req_handle(int req_handle) The **cci_close_req_handle** function closes the request handle obtained by :c:func:`cci_prepare`. :param req_handle: (IN) Request handle :return: Error code (0: success) * **CCI_ER_CON_HANDLE** * **CCI_ER_REQ_HANDLE** * **CCI_ER_COMMUNICATION** * **CCI_ER_DBMS** * **CCI_ER_NO_MORE_MEMORY** * **CCI_ER_USED_CONNECTION** cci_col_get ----------- .. c:function:: int cci_col_get (int conn_handle, char *oid_str, char *col_attr, int *col_size, int *col_type, T_CCI_ERROR *err_buf) The **cci_col_get** function gets an attribute value of collection type. If the name of the class is C, and the domain of *set_attr* is set (multiset, sequence), the query looks like as follows: .. code-block:: sql SELECT a FROM C, TABLE(set_attr) AS t(a) WHERE C = oid; That is, the number of members becomes the number of records. :param conn_handle: (IN) Connection handle :param oid_str: (IN) oid :param col_attr: (IN) Collection attribute name :param col_size: (OUT) Collection size (-1 : null) :param col_type: (OUT) Collection type (set, multiset, sequence: u_type) :param err_buf: (OUT) Database error buffer :return: Request handle * **CCI_ER_CON_HANDLE** * **CCI_ER_CONNECT** * **CCI_ER_OBJECT** * **CCI_ER_DBMS** cci_col_seq_drop ---------------- .. c:function:: int cci_col_seq_drop (int conn_handle, char *oid_str, char *col_attr, int index, T_CCI_ERROR *err_buf) The **cci_col_seq_drop** function drops the index-th (base: 1) member of the sequence attribute values. The following example shows how to drop the first member of the sequence attribute values. :: cci_col_seq_drop(conn_handle, oid_str, seq_attr, 1, err_buf); :param conn_handle: (IN) Connection handle :param oid_str: (IN) oid :param col_attr: (IN) Collection attribute name :param index: (IN) Index :param err_buf: (OUT) Database error buffer :return: Error code * **CCI_ER_CON_HANDLE** * **CCI_ER_CONNECT** * **CCI_ER_OBJECT** * **CCI_ER_DBMS** cci_col_seq_insert ------------------ .. c:function:: int cci_col_seq_insert (int conn_handle, char *oid_str, char *col_attr, int index, char *value, T_CCI_ERROR *err_buf) The **cci_col_seq_insert** function inserts one member at the index-th (base: 1) position of the sequence attribute values. The following example shows how to insert "a" at the first position of the sequence attribute values. :: cci_col_seq_insert(conn_handle, oid_str, seq_attr, 1, "a", err_buf); :param conn_handle: (IN) Connection handle :param oid_str: (IN) oid :param col_attr: (IN) Collection attribute name :param index: (IN) Index :param value: (IN) Sequential element (string) :param err_buf: (OUT) Database error buffer :return: Error code * **CCI_ER_CON_HANDLE** * **CCI_ER_CONNECT** * **CCI_ER_OBJECT** * **CCI_ER_DBMS** cci_col_seq_put --------------- .. c:function:: int cci_col_seq_put (int conn_handle, char *oid_str, char *col_attr, int index, char *value, T_CCI_ERROR *err_buf) The **cci_col_seq_put** function replaces the index-th (base: 1) member of the sequence attribute values with a new value. The following example shows how to replace the first member of the sequence attributes values with "a". :: cci_col_seq_put(conn_handle, oid_str, seq_attr, 1, "a", err_buf); :param conn_handle: (IN) Connection handle :param oid_str: (IN) oid :param col_attr: (IN) Collection attribute name :param index: (IN) Index :param value: (IN) Sequential value :param err_buf: (OUT) Database error buffer :return: Error code * **CCI_ER_CON_HANDLE** * **CCI_ER_CONNECT** * **CCI_ER_OBJECT** * **CCI_ER_DBMS** cci_col_set_add --------------- .. c:function:: int cci_col_set_add (int conn_handle, char *oid_str, char *col_attr, char *value, T_CCI_ERRROR *err_buf) The **cci_col_set_add** function adds one member to the set attribute values. The following example shows how to add "a" to the set attribute values. :: cci_col_set_add(conn_handle, oid_str, set_attr, "a", err_buf); :param conn_handle: (IN) Connection handle :param oid_str: (IN) oid :param col_attr: (IN) collection attribute name :param value: (IN) set element :param err_buf: (OUT) Database error buffer :return: Error code * **CCI_ER_CON_HANDLE** * **CCI_ER_CONNECT** * **CCI_ER_OBJECT** * **CCI_ER_DBMS** cci_col_set_drop ---------------- .. c:function:: int cci_col_set_drop (int conn_handle, char *oid_str, char *col_attr, char *value, T_CCI_ERROR *err_buf) The **cci_col_set_drop** function drops one member from the set attribute values. The following example shows how to drop "a" from the set attribute values. :: cci_col_set_drop(conn_handle, oid_str, set_attr, "a", err_buf); :param conn_handle: (IN) Connection handle :param oid_str: (IN) oid :param col_attr: (IN) collection attribute name :param value: (IN) set element (string) :param err_buf: (OUT) Database error buffer :return: Error code * **CCI_ER_CON_HANDLE** * **CCI_ER_QUERY_TIMEOUT** * **CCI_ER_LOGIN_TIMEOUT** * **CCI_ER_COMMUNICATION** cci_col_size ------------ .. c:function:: int cci_col_size (int conn_handle, char *oid_str, char *col_attr, int *col_size, T_CCI_ERROR *err_buf) The **cci_col_size** function gets the size of the set (seq) attribute. :param conn_handle: (IN) Connection handle :param oid_str: (IN) oid :param col_attr: (IN) Collection attribute name :param col_size: (OUT) Collection size (-1: NULL) :param err_buf: Database error buffer :return: Error code (0: success) * **CCI_ER_CON_HANDLE** * **CCI_ER_CONNECT** * **CCI_ER_OBJECT** * **CCI_ER_DBMS** cci_connect ----------- .. c:function:: int cci_connect(char *ip, int port, char *db_name, char *db_user, char *db_password) A connection handle to the database server is assigned and it tries to connect to the server. If it has succeeded, the connection handle ID is returned; if fails, an error code is returned. :param ip: (IN) A string that represents the IP address of the server (host name) :param port: (IN) Broker port (The port configured in the **$CUBRID/conf/cubrid_broker.conf** file) :param db_name: (IN) Database name :param db_user: (IN) Database user name :param db_passwd: (IN) Database user password :return: Success: Connection handle ID (int), Failure: Error code * **CCI_ER_NO_MORE_MEMORY** * **CCI_ER_HOSTNAME** * **CCI_ER_CON_HANDLE** * **CCI_ER_DBMS** * **CCI_ER_COMMUNICATION** * **CCI_ER_CONNECT** cci_connect_ex -------------- .. c:function:: int cci_connect_ex(char *ip, int port, char *db_name, char *db_user, char *db_password, T_CCI_ERROR * err_buf) The **cci_connect_ex** function returns **CCI_ER_DBMS** error and checks the error details in the database error buffer (*err_buf*) at the same time. In that point, it is different from :c:func:`cci_connect` and the others are the same as the :c:func:`cci_connect` function. :param ip: (IN) A string that represents the IP address of the server (host name) :param port: (IN) Broker port (The port configured in the **$CUBRID/conf/cubrid_broker.conf** file) :param db_name: (IN) Database name :param db_user: (IN) Database user name :param db_passwd: (IN) Database user password :param err_buf: Database error buffer :return: Success: Connection handle ID (int), Failure: Error code * **CCI_ER_NO_MORE_MEMORY** * **CCI_ER_HOSTNAME** * **CCI_ER_CON_HANDLE** * **CCI_ER_DBMS** * **CCI_ER_COMMUNICATION** * **CCI_ER_CONNECT** cci_connect_with_url -------------------- .. c:function:: int cci_connect_with_url (char *url, char *db_user, char *db_password) The **cci_connect_with_url** function connects a database by using connection information passed with a *url* argument. If broker's HA feature is used in CCI, you must specify the connection information of the standby broker server with altHosts property, which is used for the failover, in the *url* argument of this function. It returns the ID of a connection handle on success; it returns an error code on failure. For details about HA features of broker, see :ref:`duplexing-brokers`. :param url: (IN) A string that contains server connection information. :param db_user: (IN) Database user name. If this is NULL, it becomes <*db_user*> in *url*. If this is an empty string ("") or <*db_user*> in *url* is not specified, DB user name becomes **PUBLIC**. :param db_passwd: (IN) Database user password. If this is NULL, <*db_password*> in *url* is used. If <*db_password*> in *url* is not specified, DB password becomes an empty string (""). :return: Success: Connection handle ID (int), Failure: Error code * **CCI_ER_NO_MORE_MEMORY** * **CCI_ER_HOSTNAME** * **CCI_ER_INVALID_URL** * **CCI_ER_CON_HANDLE** * **CCI_ER_CONNECT** * **CCI_ER_DBMS** * **CCI_ER_COMMUNICATION** * **CCI_ER_LOGIN_TIMEOUT** :: ::= cci:CUBRID::::::[?] ::= [&] ::= altHosts= [ &rcTime=