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_bind_param

Description

The cci_bind_param function binds data in the bind variable of prepared statement. Converts value of the given a_type to an actual binding type and stores it. Subsequently, whenever 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 last set value is configured.

If NULL is bound to the database, there can be two scenarios.

  • value is a NULL pointer.
  • u_type is CCI_U_TYPE_NULL.

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 to convert binding data by the value argument. For the definition of the identifier for each type, see the table below.

The reason these types are used is to inform information converting convert A-type data which C language can interpret into U-type data which database can interpret. 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 "CUBRID SQL Guide > Data Types > Implicit Type Conversion > Rules."

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_NCHAR

CCI_A_TYPE_STR

CCI_U_TYPE_VARNCHAR

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_MONETARY

CCI_A_TYPE_DOUBLE

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

Syntax

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)

  • req_handle : (IN) Request handle of a prepared statement
  • index : (IN) Location of binding' it starts with 1.
  • a_type : (IN) Data type of value
  • value : (IN) Data value to bind
  • u_type : (IN) Data type to be applied to the database
  • flag : (IN) bind_flag (CCI_BIND_PTR)
Return Value
  • Error code (0 : success)
Error Codes
  • CCI_ER_REQ_HANDLE
  • CCI_ER_TYPE_CONVERSION
  • CCI_ER_BIND_INDEX
  • CCI_ER_ATYPE
  • CCI_ER_NO_MORE_MEMORY