'cubrid_cci'에 해당되는 글 2건

  1. 2012.06.08 CUBRID CCI Error Codes and Messages
  2. 2012.05.22 [Cubrid] cci example code

CUBRID CCI Error Codes and Messages

ITWeb/개발일반 2012.06.08 17:51


[원본링크]

CUBRID CCI Error Codes and Messages


The following list displays the error messages raised in CUBRID CCI API.


CCI Error Code NumberCCI Error CodeError MessageNote
0CCI_ER_NO_ERROR
-1CCI_ER_DBMS"CUBRID DBMS Error"Fails to database connection.
-2CCI_ER_CON_HANDLE"Invalid connection handle"
-3CCI_ER_NO_MORE_MEMORY"Memory allocation error"Insufficient memory
-4CCI_ER_COMMUNICATION"Cannot communicate with server"
-5CCI_ER_NO_MORE_DATA"Invalid cursor position"
-6CCI_ER_TRAN_TYPE"Unknown transaction type"
-7CCI_ER_STRING_PARAM"Invalid string argument"string parameter is NULL or an empty string.
-8CCI_ER_TYPE_CONVERSION"Type conversion error"Cannot convert the given value into an actual data type.
-9CCI_ER_BIND_INDEX"Parameter index is out of range"Index that binds data is not valid.
-10CCI_ER_ATYPE"Invalid T_CCI_A_TYPE value"
-11CCI_ER_NOT_BIND
-12CCI_ER_PARAM_NAME"Invalid T_CCI_DB_PARAM value"
-13CCI_ER_COLUMN_INDEX"Column index is out of range"
-14CCI_ER_SCHEMA_TYPE
-15CCI_ER_FILE"Cannot open file"Fails to open/read/write a file.
-16CCI_ER_CONNECT"Cannot connect to CUBRID CAS"Fails to connect the CAS when trying connection to the server.
-17CCI_ER_ALLOC_CON_HANDLE"Cannot allocate connection handle"
-18CCI_ER_REQ_HANDLE"Cannot allocate request handle"
-19CCI_ER_INVALID_CURSOR_POS"Invalid cursor position"
-20CCI_ER_OBJECT"Invalid oid string"
-21CCI_ER_CAS
-22CCI_ER_HOSTNAME"Unknown host name"
-23CCI_ER_OID_CMD"Invalid T_CCI_OID_CMD value"
-24CCI_ER_BIND_ARRAY_SIZE"Array binding size is not specified"
-25CCI_ER_ISOLATION_LEVEL"Unknown transaction isolation level"
-26CCI_ER_SET_INDEX"Invalid set index"Invalid index is specified when an set element in the T_SET is retrieved.
-27CCI_ER_DELETED_TUPLE"Current row was deleted"
-28CCI_ER_SAVEPOINT_CMD"Invalid T_CCI_SAVEPOINT_CMD value"Invalid T_CCI_SAVEPOINT_CMD value is used as an argument of cci_savepoint() function.
-29CCI_ER_THREAD_RUNNING"Thread is running"The thread is still executed when cci_execute() is executed with CCI_EXEC_THREAD flaged and check the result of thread execution through cci_get_thread_result().
-30CCI_ER_INVALID_URL"Invalid url string"
-31CCI_ER_INVALID_LOB_READ_POS
-32CCI_ER_INVALID_LOB_HANDLE
-33CCI_ER_NO_PROPERTY
-34CCI_ER_PROPERTY_TYPE
-35CCI_ER_INVALID_DATASOURCE
-36CCI_ER_DATASOURCE_TIMEOUT
-37CCI_ER_DATASOURCE_TIMEDWAIT
-38CCI_ER_LOGIN_TIMEOUT
-39CCI_ER_QUERY_TIMEOUT
-99CCI_ER_NOT_IMPLEMENTED

신고
크리에이티브 커먼즈 라이선스
Creative Commons License
Trackback 0 : Comment 0

[Cubrid] cci example code

ITWeb/개발일반 2012.05.22 00:33

[Source Code]

// http://www.cubrid.org/manual/841/ko/CCI%20API
// http://www.cubrid.org/manual/841/ko/C%20Type%20Definition
#include <stdio.h>
#include <cas_cci.h>

int main (int argc, char *argv[]) {

    int con = 0, req = 0, rowCount = 0, res;

    T_CCI_ERROR error;
    T_CCI_QUERY_RESULT *queryResult;

    printf("Program started!\n");

    if ((con=cci_connect("SERVER_IP", SERVER_PORT, "DB_NAME", "USER", "PASSWORD"))<0) {
        printf( "%s(%d): cci_connect fail\n", __FILE__, __LINE__);
        return -1;
    }

    if ((req=cci_prepare(con, "select name from demodb where id=1", 0,&error))<0) {
        printf( "%s(%d): cci_prepare fail(%d)\n", __FILE__, __LINE__,error.err_code);
        goto handle_error;
    }

    printf("Prepare ok!(%d)\n",req);
    printf("========================================\n");

    if ((res=cci_execute(req, 0, 0, &error))<0) {
        printf( "%s(%d): cci_execute fail(%d)\n", __FILE__, __LINE__,error.err_code);
        goto handle_error;
    }

    if ((res=cci_execute_result(req, &queryResult, &error))<0) {
        printf( "%s(%d): cci_execute_result fail(%d)\n", __FILE__, __LINE__,error.err_code);
        goto handle_error;
    }

    rowCount = CCI_QUERY_RESULT_RESULT(queryResult, 1);

    if ( rowCount > 0 ) {
        printf("This is virus(%d).\n", rowCount);
    } else {
        printf("This is clean(%d).\n", rowCount);
    }

    if ((res=cci_close_req_handle(req))<0) {
           printf( "%s(%d): cci_close_req_handle fail", __FILE__, __LINE__);
           goto handle_error;
    }

    if ((res=cci_disconnect(con, &error))<0) {
          printf( "%s(%d): cci_disconnect fail(%d)", __FILE__, __LINE__,error.err_code);
          goto handle_error;
    }

    printf("Program ended!\n");

    return 0;

handle_error:

    if (req > 0) cci_close_req_handle(req);
    if (con > 0) cci_disconnect(con, &error);

    printf("Program failed!\n");

    return -1;
}


[Build]

- 위치

mkdir -p /home/jjeong/workspace/cubrid

cd  /home/jjeong/workspace/cubrid

- prerequisite

http://www.cubrid.org/manual/841/en/CCI%20API

CUBRID-CCI-Linux-8.4.0.2027.tar.gz

tar -xvzf CUBRID-CCI-Linux-8.4.0.2027.tar.gz

ln -s cubrid-cci-8.4.0.2027 libcubrid

- gcc

gcc cubrildMini.c ./libcubrid/lib/libcascci.a -I./libcubrid/include -lpthread -lnsl -o cubridMini


신고
크리에이티브 커먼즈 라이선스
Creative Commons License
tags : CCI, cubrid, cubrid_cci
Trackback 0 : Comment 0

티스토리 툴바