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_get_result_info

Description

If the prepared statement is SELECT, the T_CCI_COL_INFO struct that stores the column information about the execution result can be obtained by using this function. If it is not SELECT, NULL is returned and the num value becomes 0.

You can access the T_CCI_COL_INFO struct directly to get the column information from the struct, but you can also use a macro to get the information, which is defined as follows. The address of the T_CCI_COL_INFO struct and the column index are specified as parameters for each macro. The macro can be called only for the SELECT query. Note that the validity check is not performed for each parameter entered in each macro. If the return type of the macro is char*, do not free the memory pointer.

Macro

Return Type

Meaning

CCI_GET_RESULT_INFO_TYPE

T_CCI_U_TYPE

column type

CCI_GET_RESULT_INFO_SCALE

short

column scale

CCI_GET_RESULT_INFO_PRECISION

int

column precision

CCI_GET_RESULT_INFO_NAME

char*

column name

CCI_GET_RESULT_INFO_ATTR_NAME

char*

column attribute name

CCI_GET_RESULT_INFO_CLASS_NAME

char*

column class name

CCI_GET_RESULT_INFO_IN_NON_NULL

char(0 or 1)

whether a column is NULL

Syntax

T_CCI_COL_INFO* cci_get_result_info(int req_handle, T_CCI_CUBRID_STMT *stmt_type, int *num)

  • req_handle: (IN) Request handle for the prepared statement
  • stmt_type: (OUT) Command type
  • num: (OUT) The number of columns in the SELECT statement (if stmt_type is CUBRID_STMT_SELECT)
Return Value
  • Success: Result info pointer
  • Failure: NULL
Example

col_info = cci_get_result_info (req, &stmt_type, &col_count);

  if (col_info == NULL)

    {

      printf ("get_result_info error: %d, %s ", cci_error.err_code,

              cci_error.err_msg);

      goto handle_error;

    }

  for (i = 1; i <= col_count; i++)

    {

      printf ("%-12s = %d ", "type", CCI_GET_RESULT_INFO_TYPE (col_info, i));

      printf ("%-12s = %d ", "scale",

              CCI_GET_RESULT_INFO_SCALE (col_info, i));

      printf ("%-12s = %d ", "precision",

              CCI_GET_RESULT_INFO_PRECISION (col_info, i));

      printf ("%-12s = %s ", "name", CCI_GET_RESULT_INFO_NAME (col_info, i));

      printf ("%-12s = %s ", "attr_name",

              CCI_GET_RESULT_INFO_ATTR_NAME (col_info, i));

      printf ("%-12s = %s ", "class_name",

              CCI_GET_RESULT_INFO_CLASS_NAME (col_info, i));

      printf ("%-12s = %s ", "is_non_null",

              CCI_GET_RESULT_INFO_IS_NON_NULL (col_info,i) ? "true" : "false");