CCI API reference: LOBs, collections and OIDs
Part of the CCI API reference; see the CCI overview for how to build and use CCI programs.
cci_blob_free
Section titled “cci_blob_free”int cci_blob_free(T_CCI_BLOB blob)The cci_blob_free function frees memory of blob struct.
- CCI_ER_INVALID_LOB_HANDLE
Returns: Error code (0: success)
cci_blob_new
Section titled “cci_blob_new”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.
- 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
Parameters
conn_handle: (IN) Connection handleblob: (OUT) LOB locatorerror_buf: (OUT) Error buffer
Returns: Error code (0: success)
cci_blob_read
Section titled “cci_blob_read”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.
- 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
Parameters
conn_handle: (IN) Connection handleblob: (OUT) LOB locatorstart_pos: (IN) Index location of LOB data filelength: (IN) LOB data length from bufferbuf: (IN) Data buffer to readerror_buf: (OUT) Error buffer
Returns: Size of read value (>= 0: success), Error code (< 0: error)
cci_blob_size
Section titled “cci_blob_size”long long cci_blob_size(T_CCI_BLOB* blob)The cci_blob_size function returns data file size that is specified in blob.
- CCI_ER_INVALID_LOB_HANDLE
Parameters
blob: (OUT) LOB locator
Returns: Size of BLOB data file (>= 0: success), Error code (< 0: error)
cci_blob_write
Section titled “cci_blob_write”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.
- 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
Parameters
conn_handle: (IN) Connection handleblob: (OUT) LOB locatorstart_pos: (IN) Index location of LOB data filelength: (IN) Data length from bufferbuf: (OUT) Data buffer to writeerror_buf: (OUT) Error buffer
Returns: Size of written value (>= 0: success), Error code (< 0: error)
cci_clob_free
Section titled “cci_clob_free”int cci_clob_free(T_CCI_CLOB clob)The cci_clob_free function frees memory of CLOB struct.
- CCI_ER_INVALID_LOB_HANDLE
Parameters
clob: (IN) LOB locator
Returns: Error code (0: success)
cci_clob_new
Section titled “cci_clob_new”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.
- 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
Parameters
conn_handle: ((IN) Connection handleclob: (OUT) LOB locatorerror_buf: (OUT) Error buffer
Returns: Error code (0: success)
cci_clob_read
Section titled “cci_clob_read”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.
- 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
Parameters
conn_handle: (IN) Connection handleclob: (IN) LOB locatorstart_pos: (IN) Index location of LOB data filelength: (IN) LOB data length from bufferbuf: (IN) Data buffer to readerror_buf: (OUT) Error buffer
Returns: Size of read value (>= 0: success), Error code (< 0: Error)
cci_clob_size
Section titled “cci_clob_size”long long cci_clob_size(T_CCI_CLOB* clob)The cci_clob_size function returns data file size that is specified in clob.
- CCI_ER_INVALID_LOB_HANDLE
Parameters
clob: (IN) LOB locator
Returns: Size of CLOB data file (>= 0: success), Error code (< 0: error)
cci_clob_write
Section titled “cci_clob_write”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.
- 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
Parameters
conn_handle: (IN) Connection handleclob: (IN) LOB locatorstart_pos: (IN) Index location of LOB data filelength: (IN) Data length from bufferbuf: (OUT) Data buffer to writeerror_buf: (OUT) Error buffer
Returns: Size of written value (>= 0: success), Error code (< 0: Error)
cci_col_get
Section titled “cci_col_get”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:
SELECT a FROM C, TABLE(set_attr) AS t(a) WHERE C = oid;That is, the number of members becomes the number of records.
- CCI_ER_CON_HANDLE
- CCI_ER_CONNECT
- CCI_ER_OBJECT
- CCI_ER_DBMS
Parameters
conn_handle: (IN) Connection handleoid_str: (IN) oidcol_attr: (IN) Collection attribute namecol_size: (OUT) Collection size (-1 : null)col_type: (OUT) Collection type (set, multiset, sequence: u_type)err_buf: (OUT) Database error buffer
Returns: Request handle
cci_col_seq_drop
Section titled “cci_col_seq_drop”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);
* **CCI_ER_CON_HANDLE*** **CCI_ER_CONNECT*** **CCI_ER_OBJECT*** **CCI_ER_DBMS**Parameters
conn_handle: (IN) Connection handleoid_str: (IN) oidcol_attr: (IN) Collection attribute nameindex: (IN) Indexerr_buf: (OUT) Database error buffer
Returns: Error code
cci_col_seq_insert
Section titled “cci_col_seq_insert”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);
* **CCI_ER_CON_HANDLE*** **CCI_ER_CONNECT*** **CCI_ER_OBJECT*** **CCI_ER_DBMS**Parameters
conn_handle: (IN) Connection handleoid_str: (IN) oidcol_attr: (IN) Collection attribute nameindex: (IN) Indexvalue: (IN) Sequential element (string)err_buf: (OUT) Database error buffer
Returns: Error code
cci_col_seq_put
Section titled “cci_col_seq_put”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);
* **CCI_ER_CON_HANDLE*** **CCI_ER_CONNECT*** **CCI_ER_OBJECT*** **CCI_ER_DBMS**Parameters
conn_handle: (IN) Connection handleoid_str: (IN) oidcol_attr: (IN) Collection attribute nameindex: (IN) Indexvalue: (IN) Sequential valueerr_buf: (OUT) Database error buffer
Returns: Error code
cci_col_set_add
Section titled “cci_col_set_add”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);
* **CCI_ER_CON_HANDLE*** **CCI_ER_CONNECT*** **CCI_ER_OBJECT*** **CCI_ER_DBMS**Parameters
conn_handle: (IN) Connection handleoid_str: (IN) oidcol_attr: (IN) collection attribute namevalue: (IN) set elementerr_buf: (OUT) Database error buffer
Returns: Error code
cci_col_set_drop
Section titled “cci_col_set_drop”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);
* **CCI_ER_CON_HANDLE*** **CCI_ER_QUERY_TIMEOUT*** **CCI_ER_LOGIN_TIMEOUT*** **CCI_ER_COMMUNICATION**Parameters
conn_handle: (IN) Connection handleoid_str: (IN) oidcol_attr: (IN) collection attribute namevalue: (IN) set element (string)err_buf: (OUT) Database error buffer
Returns: Error code
cci_col_size
Section titled “cci_col_size”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.
- CCI_ER_CON_HANDLE
- CCI_ER_CONNECT
- CCI_ER_OBJECT
- CCI_ER_DBMS
Parameters
conn_handle: (IN) Connection handleoid_str: (IN) oidcol_attr: (IN) Collection attribute namecol_size: (OUT) Collection size (-1: NULL)err_buf: Database error buffer
Returns: Error code (0: success)
cci_get_attr_type_str
Section titled “cci_get_attr_type_str”int cci_get_attr_type_str(int conn_handle, char *class_name, char *attr_name, char *buf, int buf_size, T_CCI_ERROR *err_buf)The cci_get_attr_type_str function writes the data type of a column, as a string such as INTEGER or CHARACTER VARYING(128), into buf.
- CCI_ER_CON_HANDLE
- CCI_ER_INVALID_ARGS (class_name or attr_name is NULL)
- CCI_ER_COMMUNICATION
- CCI_ER_DBMS
Example
char type[64];T_CCI_ERROR err;
if (cci_get_attr_type_str (con, "orders", "ship_address", type, sizeof (type), &err) == 0) { printf ("orders.ship_address: %s\n", type); }Parameters
conn_handle: (IN) Connection handleclass_name: (IN) Table nameattr_name: (IN) Column namebuf: (OUT) Buffer that receives the type stringbuf_size: (IN) Size of buferr_buf: (OUT) Database error buffer
Returns: Error code (0: success)
CCI_GET_COLLECTION_DOMAIN
Section titled “CCI_GET_COLLECTION_DOMAIN”#define CCI_GET_COLLECTION_DOMAIN(u_type)If u_type is set, multiset, or sequence type, this macro gets the domain of the set, multiset or sequence. If u_type is not a set type, the return value is the same as u_type.
Returns: Type (CCI_U_TYPE)
cci_get_cur_oid
Section titled “cci_get_cur_oid”int cci_get_cur_oid(int req_handle, char *oid_str_buf)The cci_get_cur_oid function gets OID of the currently fetched records if CCI_INCLUDE_OID is configured in execution. The OID is represented in string for a page, slot, or volume.
- CCI_ER_REQ_HANDLE
Parameters
conn_handle: (IN) Request handleoid_str_buf: (OUT) OID string
Returns: Error code (0: success)
CCI_IS_SET_TYPE
Section titled “CCI_IS_SET_TYPE”#define CCI_IS_SET_TYPE(u_type)The CCI_IS_SET_TYPE macro check whether u_type is set type.
Parameters
u_type: (IN)
Returns: 1 : set, 0 : not set
CCI_IS_MULTISET_TYPE
Section titled “CCI_IS_MULTISET_TYPE”#define CCI_IS_MULTISET_TYPE(u_type)The CCI_IS_SET_TYPE macro check whether u_type is multiset type.
Parameters
u_type: (IN)
Returns: 1 : multiset, 0 : not multiset
CCI_IS_SEQUENCE_TYPE
Section titled “CCI_IS_SEQUENCE_TYPE”#define CCI_IS_SEQUENCE_TYPE(u_type)The CCI_IS_SET_TYPE macro check whether u_type is sequence type.
Parameters
u_type: (IN)
Returns: 1 : sequence, 0 : not sequence
CCI_IS_COLLECTION_TYPE
Section titled “CCI_IS_COLLECTION_TYPE”#define CCI_IS_COLLECTION_TYPE(u_type)The CCI_IS_SET_TYPE macro check whether u_type is collection (set, multiset, sequence) type.
Parameters
u_type: (IN)
Returns: 1 : collection (set, multiset, sequence), 0 : not collection
cci_oid
Section titled “cci_oid”int cci_oid(int conn_handle, T_CCI_OID_CMD cmd, char *oid_str, T_CCI_ERROR *err_buf)By the value of cmd argument, it executes the following behavior.
- CCI_OID_DROP: Deletes the given oid.
- CCI_OID_IS_INSTANCE: Checks whether the given oid is an instance oid.
- CCI_OID_LOCK_READ: Sets read lock on the given oid.
- CCI_OID_LOCK_WRITE: Sets write lock on the given oid.
-
When
cmdis CCI_OID_IS_INSTANCE- 0 : Non-instance
- 1 : Instance
- < 0 : error
-
When
cmdis CCI_OID_DROP, CCI_OID_LOCK_READ or CCI_OID_LOCK_WRITEError code (0: success)
- CCI_ER_CON_HANDLE
- CCI_ER_CONNECT
- CCI_ER_OID_CMD
- CCI_ER_OBJECT
- CCI_ER_DBMS
-
Parameters
conn_handle: (IN) Connection handlecmd: (IN) CCI_OID_DROP, CCI_OID_IS_INSTANCE, CCI_OID_LOCK_READ, CCI_OID_LOCK_WRITEoid_str: (IN) oiderr_buf: (OUT) Database error buffer
Returns:
cci_oid_get
Section titled “cci_oid_get”int cci_oid_get(int conn_handle, char *oid_str, char **attr_name, T_CCI_ERROR *err_buf)The cci_oid_get function gets the attribute values of the given oid. attr_name is an array of the attributes, and it must end with NULL. If attr_name is NULL, the information of all attributes is fetched. The request handle has the same form as when the SQL statement "SELECT attr_name FROM oid_class WHERE oid_class = oid" is executed.
- CCI_ER_CON_HANDLE
- CCI_ER_NO_MORE_MEMORY
- CCI_ER_CONNECT
Parameters
conn_handle: (IN) Connection handleoid_str: (IN) oidattr_name: (IN) A list of attributeserr_buf: (OUT) Database error buffer
Returns: Success: Request handle, Failure: Error code
cci_oid_get_class_name
Section titled “cci_oid_get_class_name”int cci_oid_get_class_name(int conn_handle, char *oid_str, char *out_buf, int out_buf_len, T_CCI_ERROR *err_buf)The cci_oid_get_class_name function gets the class name of the given oid.
- CCI_ER_CON_HANDLE
- CCI_ER_CONNECT
- CCI_ER_OBJECT
- CCI_ER_DBMS
Parameters
conn_handle: (IN) Connection handleoid_str: (IN) oidout_buf: (OUT) Out bufferout_buf_len: (IN) out_buf lengtherr_buf: (OUT) Database error buffer
Returns: Error code
cci_oid_put
Section titled “cci_oid_put”int cci_oid_put(int conn_handle, char *oid_str, char **attr_name, char **new_val_str, T_CCI_ERROR *err_buf)The cci_oid_put function configures the attr_name attribute values of the given oid to new_val_str. The last value of attr_name must be NULL. Any value of any type must be represented as a string. The value represented as a string is applied to the database after being converted depending on the attribute type on the server. To insert a NULL value, configure the value of new_val_str [i] to NULL.
- CCI_ER_CON_HANDLE
- CCI_ER_CONNECT
Parameters
conn_handle: (IN) Connection handleoid_str: (IN) oidattr_name: (IN) The list of attribute namesnew_val_str: (IN) The list of new valueserr_buf: (OUT) Database error buffer
Returns: Error code (0: success)
cci_oid_put2
Section titled “cci_oid_put2”int cci_oid_put2(int conn_handle, char *oidstr, char **attr_name, void **new_val, int *a_type, T_CCI_ERROR *err_buf)The cci_oid_put2 function sets the attr_name attribute values of the given oid to new_val. The last value of attr_name must be NULL. To insert a NULL value, set the value of new_val [i] to NULL.
- CCI_ER_CON_HANDLE
- CCI_ER_CONNECT
The type of new_val [i] for a_type is shown in the table below.
Type of new_val[i] for a_type
| 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 *) |
char *attr_name[array_size]void *attr_val[array_size]int a_type[array_size]int int_val
...
attr_name[0] = "attr_name0"attr_val[0] = &int_vala_type[0] = CCI_A_TYPE_INTattr_name[1] = "attr_name1"attr_val[1] = "attr_val1"a_type[1] = CCI_A_TYPE_STR
...attr_name[num_attr] = NULL
res = cci_put2(con_h, oid_str, attr_name, attr_val, a_type, &error)Parameters
conn_handle: (IN) Connection handleoidstr: (IN) oidattr_name: (IN) A list of attribute namesnew_val: (IN) A new value arraya_type: (IN) new_val type arrayerr_buf: (OUT) Database error buffer
Returns: Error code (0: success)
cci_set_element_type
Section titled “cci_set_element_type”int cci_set_element_type(T_CCI_SET set)The cci_set_element_type function gets the element type of the T_CCI_SET type value.
Parameters
set: (IN) cci set pointer
Returns: Type
cci_set_free
Section titled “cci_set_free”void cci_set_free(T_CCI_SET set)The cci_set_free function releases the memory allocated to the type value of T_CCI_SET fetched by CCI_A_TYPE_SET with cci_get_data. The T_CCI_SET type value can be created through fetching cci_get_data or cci_set_make function.
Parameters
set: (IN) cci set pointer
cci_set_get
Section titled “cci_set_get”int cci_set_get(T_CCI_SET set, int index, T_CCI_A_TYPE a_type, void *value, int *indicator)The cci_set_get function gets the index -th data for the type value of T_CCI_SET.
- CCI_ER_SET_INDEX
- CCI_ER_TYPE_CONVERSION
- CCI_ER_NO_MORE_MEMORY
- CCI_ER_COMMUNICATION
The data type of value for a_type is 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_DATE | T_CCI_DATE * |
| CCI_A_TYPE_BIGINT | int64_t * (For Windows: __int64 *) |
Parameters
set: (IN) cci set pointerindex: (IN) set index (base: 1)a_type: (IN) Typevalue: (OUT) Result bufferindicator: (OUT) null indicator
Returns: Error code
cci_set_make
Section titled “cci_set_make”int cci_set_make(T_CCI_SET *set, T_CCI_U_TYPE u_type, int size, void *value, int *indicator)The cci_set_make function makes a set of a new CCI_A_TYPE_SET type. The created set is sent to the server as CCI_A_TYPE_SET by cci_bind_param. The memory for the set created by cci_set_make() must be freed by cci_set_free. The type of value for u_type is shown in the table below.
Parameters
set: (OUT) cci set pointeru_type: (IN) Element typesize: (IN) set sizevalue: (IN) set elementindicator: (IN) null indicator array
Returns: Error code
cci_set_size
Section titled “cci_set_size”int cci_set_size(T_CCI_SET set)The cci_set_size function gets the number of elements for the type value of T_CCI_SET.
Parameters
set: (IN) cci set pointer
Returns: Size