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

This function is used to bind data in the bind variable of prepared statement. Converts value of the given a_type to an actual binding type and saves it. Subsequently, whenever cci_execute() is called, the saved 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 application programs, 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 identitier 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*)

T_CCI_U_TYPE is a type supported by the CUBRID database. For the definition of the identifier for each type, see the table below. These two types are used in the cci_bind_param() function to deliver the information required to convert the A type data that can be understood by the C language to the U type data that can be understood by the database. T_CCI_A_TYPE and T_CCI_U_TYPE enums are all defined in the cas_cci.h file.

u_type

value Type

CCI_U_TYPE_CHAR

char**

CCI_U_TYPE_STRING

char**

CCI_U_TYPE_NCHAR

char**

CCI_U_TYPE_VARNCHAR

char**

CCI_U_TYPE_BIT

T_CCI_BIT*

CCI_U_TYPE_VARBIT

T_CCI_BIT*

CCI_U_TYPE_NUMERIC

char**

CCI_U_TYPE_INT

int*

CCI_U_TYPE_SHORT

int*

CCI_U_TYPE_MONETARY

Double*

CCI_U_TYPE_FLOAT

float*

CCI_U_TYPE_DOUBLE

Double*

CCI_U_TYPE_DATE

T_CCI_DATE*

CCI_U_TYPE_TIME

T_CCI_DATE*

CCI_U_TYPE_TIMESTAMP

T_CCI_DATE*

CCI_U_TYPE_OBJECT

char**

CCI_U_TYPE_BIGINT

int64_t*
(Windows : __int64*)

CCI_U_TYPE_DATETIME

T_CCI_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 SQL statement
  • index : (IN) One-based binding location it starts with 1.
  • a_type : (IN) Data type of value
  • value : (IN) Data value to be bound
  • 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 Code
  • CCI_ER_REQ_HANDLE
  • CCI_ER_TYPE_CONVERSION
  • CCI_ER_BIND_INDEX
  • CCI_ER_ATYPE
  • CCI_ER_NO_MORE_MEMORY