Skip to content

CCI API reference: LOBs, collections and OIDs

View as Markdown

Part of the CCI API reference; see the CCI overview for how to build and use CCI programs.

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)

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 handle
  • blob: (OUT) LOB locator
  • error_buf: (OUT) Error buffer

Returns: Error code (0: success)

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 handle
  • blob: (OUT) LOB locator
  • start_pos: (IN) Index location of LOB data file
  • length: (IN) LOB data length from buffer
  • buf: (IN) Data buffer to read
  • error_buf: (OUT) Error buffer

Returns: Size of read value (>= 0: success), Error code (< 0: error)

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)

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 handle
  • blob: (OUT) LOB locator
  • start_pos: (IN) Index location of LOB data file
  • length: (IN) Data length from buffer
  • buf: (OUT) Data buffer to write
  • error_buf: (OUT) Error buffer

Returns: Size of written value (>= 0: success), Error code (< 0: error)

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)

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 handle
  • clob: (OUT) LOB locator
  • error_buf: (OUT) Error buffer

Returns: Error code (0: success)

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 handle
  • clob: (IN) LOB locator
  • start_pos: (IN) Index location of LOB data file
  • length: (IN) LOB data length from buffer
  • buf: (IN) Data buffer to read
  • error_buf: (OUT) Error buffer

Returns: Size of read value (>= 0: success), Error code (< 0: Error)

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)

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 handle
  • clob: (IN) LOB locator
  • start_pos: (IN) Index location of LOB data file
  • length: (IN) Data length from buffer
  • buf: (OUT) Data buffer to write
  • error_buf: (OUT) Error buffer

Returns: Size of written value (>= 0: success), Error code (< 0: Error)

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 handle
  • oid_str: (IN) oid
  • col_attr: (IN) Collection attribute name
  • col_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

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 handle
  • oid_str: (IN) oid
  • col_attr: (IN) Collection attribute name
  • index: (IN) Index
  • err_buf: (OUT) Database error buffer

Returns: Error code

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 handle
  • oid_str: (IN) oid
  • col_attr: (IN) Collection attribute name
  • index: (IN) Index
  • value: (IN) Sequential element (string)
  • err_buf: (OUT) Database error buffer

Returns: Error code

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 handle
  • oid_str: (IN) oid
  • col_attr: (IN) Collection attribute name
  • index: (IN) Index
  • value: (IN) Sequential value
  • err_buf: (OUT) Database error buffer

Returns: Error code

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 handle
  • oid_str: (IN) oid
  • col_attr: (IN) collection attribute name
  • value: (IN) set element
  • err_buf: (OUT) Database error buffer

Returns: Error code

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 handle
  • oid_str: (IN) oid
  • col_attr: (IN) collection attribute name
  • value: (IN) set element (string)
  • err_buf: (OUT) Database error buffer

Returns: Error code

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 handle
  • oid_str: (IN) oid
  • col_attr: (IN) Collection attribute name
  • col_size: (OUT) Collection size (-1: NULL)
  • err_buf: Database error buffer

Returns: Error code (0: success)

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 handle
  • class_name: (IN) Table name
  • attr_name: (IN) Column name
  • buf: (OUT) Buffer that receives the type string
  • buf_size: (IN) Size of buf
  • err_buf: (OUT) Database error buffer

Returns: Error code (0: success)

#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)

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 handle
  • oid_str_buf: (OUT) OID string

Returns: Error code (0: success)

#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

#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

#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

#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

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 cmd is CCI_OID_IS_INSTANCE

      • 0 : Non-instance
      • 1 : Instance
      • < 0 : error
    • When cmd is CCI_OID_DROP, CCI_OID_LOCK_READ or CCI_OID_LOCK_WRITE

      Error 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 handle
  • cmd: (IN) CCI_OID_DROP, CCI_OID_IS_INSTANCE, CCI_OID_LOCK_READ, CCI_OID_LOCK_WRITE
  • oid_str: (IN) oid
  • err_buf: (OUT) Database error buffer

Returns:

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 handle
  • oid_str: (IN) oid
  • attr_name: (IN) A list of attributes
  • err_buf: (OUT) Database error buffer

Returns: Success: Request handle, Failure: Error code

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 handle
  • oid_str: (IN) oid
  • out_buf: (OUT) Out buffer
  • out_buf_len: (IN) out_buf length
  • err_buf: (OUT) Database error buffer

Returns: Error code

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 handle
  • oid_str: (IN) oid
  • attr_name: (IN) The list of attribute names
  • new_val_str: (IN) The list of new values
  • err_buf: (OUT) Database error buffer

Returns: Error code (0: success)

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_val
a_type[0] = CCI_A_TYPE_INT
attr_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 handle
  • oidstr: (IN) oid
  • attr_name: (IN) A list of attribute names
  • new_val: (IN) A new value array
  • a_type: (IN) new_val type array
  • err_buf: (OUT) Database error buffer

Returns: Error code (0: success)

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

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
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 pointer
  • index: (IN) set index (base: 1)
  • a_type: (IN) Type
  • value: (OUT) Result buffer
  • indicator: (OUT) null indicator

Returns: Error code

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 pointer
  • u_type: (IN) Element type
  • size: (IN) set size
  • value: (IN) set element
  • indicator: (IN) null indicator array

Returns: Error code

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