CUBRID Engine  latest
cubrid_api.c File Reference
#include "config.h"
#include <stdlib.h>
#include <assert.h>
#include "api_handle.h"
#include "api_common.h"
Include dependency graph for cubrid_api.c:

Go to the source code of this file.

Macros

#define API_BH_INTERFACE   ifs__
 
#define API_RID   rid__
 
#define API_DECLARE
 
#define API_HOUSEKEEP_BEGIN(h__, TYPE__, p__)
 
#define API_HOUSEKEEP_END()   (void) bh_root_unlock(rid__)
 
#define API_CHECK_HANDLE(s__, ht__)
 
#define API_RETURN(c)
 
#define API_IMPL_TBL   (&Cubrid_api_function_table)
 

Functions

int ci_create_connection (CI_CONNECTION *conn)
 
int ci_conn_connect (CI_CONNECTION conn, const char *host, unsigned short port, const char *databasename, const char *user_name, const char *password)
 
int ci_conn_close (CI_CONNECTION conn)
 
int ci_conn_create_statement (CI_CONNECTION conn, CI_STATEMENT *stmt)
 
int ci_conn_set_option (CI_CONNECTION conn, CI_CONNECTION_OPTION option, void *arg, size_t size)
 
int ci_conn_get_option (CI_CONNECTION conn, CI_CONNECTION_OPTION option, void *arg, size_t size)
 
int ci_conn_commit (CI_CONNECTION conn)
 
int ci_conn_rollback (CI_CONNECTION conn)
 
int ci_conn_get_error (CI_CONNECTION conn, int *err, char *msg, size_t size)
 
int ci_stmt_close (CI_STATEMENT stmt)
 
int ci_stmt_add_batch_query (CI_STATEMENT stmt, const char *sql, size_t len)
 
int ci_stmt_add_batch (CI_STATEMENT stmt)
 
int ci_stmt_clear_batch (CI_STATEMENT stmt)
 
int ci_stmt_execute_immediate (CI_STATEMENT stmt, char *sql, size_t len, CI_RESULTSET *rs, int *r)
 
int ci_stmt_execute (CI_STATEMENT stmt, CI_RESULTSET *rs, int *r)
 
int ci_stmt_execute_batch (CI_STATEMENT stmt, CI_BATCH_RESULT *br)
 
int ci_stmt_get_option (CI_STATEMENT stmt, CI_STATEMENT_OPTION option, void *arg, size_t size)
 
int ci_stmt_set_option (CI_STATEMENT stmt, CI_STATEMENT_OPTION option, void *arg, size_t size)
 
int ci_stmt_prepare (CI_STATEMENT stmt, const char *sql, size_t len)
 
int ci_stmt_register_out_parameter (CI_STATEMENT stmt, int index)
 
int ci_stmt_get_resultset_metadata (CI_STATEMENT stmt, CI_RESULTSET_METADATA *r)
 
int ci_stmt_get_parameter_metadata (CI_STATEMENT stmt, CI_PARAMETER_METADATA *r)
 
int ci_stmt_get_parameter (CI_STATEMENT stmt, int index, CI_TYPE type, void *addr, size_t len, size_t *outlen, bool *isnull)
 
int ci_stmt_set_parameter (CI_STATEMENT stmt, int index, CI_TYPE type, void *val, size_t size)
 
int ci_stmt_get_resultset (CI_STATEMENT stmt, CI_RESULTSET *res)
 
int ci_stmt_affected_rows (CI_STATEMENT stmt, int *out)
 
int ci_stmt_get_query_type (CI_STATEMENT stmt, CUBRID_STMT_TYPE *type)
 
int ci_stmt_get_start_line (CI_STATEMENT stmt, int *line)
 
int ci_stmt_next_result (CI_STATEMENT stmt, bool *exist_result)
 
int ci_stmt_get_first_error (CI_STATEMENT stmt, int *line, int *col, int *errcode, char *err_msg, size_t size)
 
int ci_stmt_get_next_error (CI_STATEMENT stmt, int *line, int *col, int *errcode, char *err_msg, size_t size)
 
int ci_res_get_resultset_metadata (CI_RESULTSET res, CI_RESULTSET_METADATA *r)
 
int ci_res_fetch (CI_RESULTSET res, int offset, CI_FETCH_POSITION pos)
 
int ci_res_fetch_tell (CI_RESULTSET res, int *offset)
 
int ci_res_clear_updates (CI_RESULTSET res)
 
int ci_res_delete_row (CI_RESULTSET res)
 
int ci_res_get_value (CI_RESULTSET res, int index, CI_TYPE type, void *addr, size_t len, size_t *outlen, bool *isnull)
 
int ci_res_get_value_by_name (CI_RESULTSET res, const char *name, CI_TYPE type, void *addr, size_t len, size_t *outlen, bool *isnull)
 
int ci_res_update_value (CI_RESULTSET res, int index, CI_TYPE type, void *addr, size_t len)
 
int ci_res_apply_row (CI_RESULTSET res)
 
int ci_res_close (CI_RESULTSET res)
 
int ci_batch_res_query_count (CI_BATCH_RESULT br, int *count)
 
int ci_batch_res_get_result (CI_BATCH_RESULT br, int index, int *ret, int *nr)
 
int ci_batch_res_get_error (CI_BATCH_RESULT br, int index, int *err_code, char *err_msg, size_t size)
 
int ci_pmeta_get_count (CI_PARAMETER_METADATA pmeta, int *count)
 
int ci_pmeta_get_info (CI_PARAMETER_METADATA pmeta, int index, CI_PMETA_INFO_TYPE type, void *arg, size_t size)
 
int ci_rmeta_get_count (CI_RESULTSET_METADATA rmeta, int *count)
 
int ci_rmeta_get_info (CI_RESULTSET_METADATA rmeta, int index, CI_RMETA_INFO_TYPE type, void *arg, size_t size)
 
int ci_oid_delete (CI_OID *oid)
 
int ci_oid_get_classname (CI_OID *oid, char *name, size_t size)
 
int ci_oid_get_resultset (CI_OID *oid, CI_RESULTSET *rs)
 
int ci_collection_new (CI_CONNECTION conn, CI_COLLECTION *coll)
 
int ci_collection_free (CI_COLLECTION coll)
 
int ci_collection_length (CI_COLLECTION coll, long *length)
 
int ci_collection_insert (CI_COLLECTION coll, long pos, CI_TYPE type, void *ptr, size_t size)
 
int ci_collection_update (CI_COLLECTION coll, long pos, CI_TYPE type, void *ptr, size_t size)
 
int ci_collection_delete (CI_COLLECTION coll, long pos)
 
int ci_collection_get_elem_domain_info (CI_COLLECTION coll, long pos, CI_TYPE *type, int *precision, int *scale)
 
int ci_collection_get (CI_COLLECTION coll, long pos, CI_TYPE type, void *addr, size_t len, size_t *outlen, bool *isnull)
 

Macro Definition Documentation

#define API_BH_INTERFACE   ifs__
#define API_CHECK_HANDLE (   s__,
  ht__ 
)
Value:
do { \
if((s__)->handle_type != (ht__)) \
{ \
} \
} while (0)
handle_type
Definition: api_common.h:58
if(extra_options)
Definition: dynamic_load.c:958
#define API_IMPL_TBL
Definition: cubrid_api.c:74
#define API_RETURN(c)
Definition: cubrid_api.c:68
#define ER_INTERFACE_INVALID_HANDLE
Definition: error_code.h:1176

Definition at line 59 of file cubrid_api.c.

Referenced by ci_batch_res_get_error(), ci_batch_res_get_result(), ci_batch_res_query_count(), ci_collection_delete(), ci_collection_free(), ci_collection_get(), ci_collection_get_elem_domain_info(), ci_collection_insert(), ci_collection_length(), ci_collection_new(), ci_collection_update(), ci_conn_close(), ci_conn_commit(), ci_conn_connect(), ci_conn_create_statement(), ci_conn_get_error(), ci_conn_get_option(), ci_conn_rollback(), ci_conn_set_option(), ci_oid_delete(), ci_oid_get_classname(), ci_oid_get_resultset(), ci_pmeta_get_count(), ci_pmeta_get_info(), ci_res_apply_row(), ci_res_clear_updates(), ci_res_close(), ci_res_delete_row(), ci_res_fetch(), ci_res_fetch_tell(), ci_res_get_resultset_metadata(), ci_res_get_value(), ci_res_get_value_by_name(), ci_res_update_value(), ci_rmeta_get_count(), ci_rmeta_get_info(), ci_stmt_add_batch(), ci_stmt_add_batch_query(), ci_stmt_affected_rows(), ci_stmt_clear_batch(), ci_stmt_execute(), ci_stmt_execute_batch(), ci_stmt_execute_immediate(), ci_stmt_get_first_error(), ci_stmt_get_next_error(), ci_stmt_get_option(), ci_stmt_get_parameter(), ci_stmt_get_parameter_metadata(), ci_stmt_get_query_type(), ci_stmt_get_resultset(), ci_stmt_get_resultset_metadata(), ci_stmt_get_start_line(), ci_stmt_next_result(), ci_stmt_prepare(), ci_stmt_register_out_parameter(), ci_stmt_set_option(), and ci_stmt_set_parameter().

#define API_DECLARE
Value:
int retval__; \
int API_RID
#define API_RID
Definition: cubrid_api.c:31
#define API_BH_INTERFACE
Definition: cubrid_api.c:30
struct bh_interface_s BH_INTERFACE
Definition: api_handle.h:29

Definition at line 33 of file cubrid_api.c.

Referenced by ci_batch_res_get_error(), ci_batch_res_get_result(), ci_batch_res_query_count(), ci_collection_delete(), ci_collection_free(), ci_collection_get(), ci_collection_get_elem_domain_info(), ci_collection_insert(), ci_collection_length(), ci_collection_new(), ci_collection_update(), ci_conn_close(), ci_conn_commit(), ci_conn_connect(), ci_conn_create_statement(), ci_conn_get_error(), ci_conn_get_option(), ci_conn_rollback(), ci_conn_set_option(), ci_oid_delete(), ci_oid_get_classname(), ci_oid_get_resultset(), ci_pmeta_get_count(), ci_pmeta_get_info(), ci_res_apply_row(), ci_res_clear_updates(), ci_res_close(), ci_res_delete_row(), ci_res_fetch(), ci_res_fetch_tell(), ci_res_get_resultset_metadata(), ci_res_get_value(), ci_res_get_value_by_name(), ci_res_update_value(), ci_rmeta_get_count(), ci_rmeta_get_info(), ci_stmt_add_batch(), ci_stmt_add_batch_query(), ci_stmt_affected_rows(), ci_stmt_clear_batch(), ci_stmt_execute(), ci_stmt_execute_batch(), ci_stmt_execute_immediate(), ci_stmt_get_first_error(), ci_stmt_get_next_error(), ci_stmt_get_option(), ci_stmt_get_parameter(), ci_stmt_get_parameter_metadata(), ci_stmt_get_query_type(), ci_stmt_get_resultset(), ci_stmt_get_resultset_metadata(), ci_stmt_get_start_line(), ci_stmt_next_result(), ci_stmt_prepare(), ci_stmt_register_out_parameter(), ci_stmt_set_option(), and ci_stmt_set_parameter().

#define API_HOUSEKEEP_BEGIN (   h__,
  TYPE__,
  p__ 
)
Value:
do { \
BH_BIND *bind__; \
retval__ = bh_get_rid ((h__), &rid__); \
if (retval__ != NO_ERROR) \
API_IMPL_TBL->err_set(retval__); \
retval__ = bh_root_lock (rid__, &ifs__); \
if (retval__ != NO_ERROR) \
API_IMPL_TBL->err_set(retval__); \
retval__ = ifs__->lookup (ifs__, (h__), &bind__); \
if (retval__ != NO_ERROR) \
{ \
API_IMPL_TBL->err_set(retval__); \
} \
(p__) = (TYPE__)bind__; \
} while (0)
int bh_root_unlock(int rrid)
Definition: api_handle.c:944
#define NO_ERROR
Definition: error_code.h:46
int bh_root_lock(int rrid, BH_INTERFACE **bhifs)
Definition: api_handle.c:908
struct bh_bind_s BH_BIND
Definition: api_handle.h:30
if(extra_options)
Definition: dynamic_load.c:958
#define API_IMPL_TBL
Definition: cubrid_api.c:74
int bh_get_rid(BIND_HANDLE bh, int *rid)
Definition: api_handle.c:802

Definition at line 38 of file cubrid_api.c.

Referenced by ci_batch_res_get_error(), ci_batch_res_get_result(), ci_batch_res_query_count(), ci_collection_delete(), ci_collection_free(), ci_collection_get(), ci_collection_get_elem_domain_info(), ci_collection_insert(), ci_collection_length(), ci_collection_new(), ci_collection_update(), ci_conn_close(), ci_conn_commit(), ci_conn_connect(), ci_conn_create_statement(), ci_conn_get_error(), ci_conn_get_option(), ci_conn_rollback(), ci_conn_set_option(), ci_oid_delete(), ci_oid_get_classname(), ci_oid_get_resultset(), ci_pmeta_get_count(), ci_pmeta_get_info(), ci_res_apply_row(), ci_res_clear_updates(), ci_res_close(), ci_res_delete_row(), ci_res_fetch(), ci_res_fetch_tell(), ci_res_get_resultset_metadata(), ci_res_get_value(), ci_res_get_value_by_name(), ci_res_update_value(), ci_rmeta_get_count(), ci_rmeta_get_info(), ci_stmt_add_batch(), ci_stmt_add_batch_query(), ci_stmt_affected_rows(), ci_stmt_clear_batch(), ci_stmt_execute(), ci_stmt_execute_batch(), ci_stmt_execute_immediate(), ci_stmt_get_first_error(), ci_stmt_get_next_error(), ci_stmt_get_option(), ci_stmt_get_parameter(), ci_stmt_get_parameter_metadata(), ci_stmt_get_query_type(), ci_stmt_get_resultset(), ci_stmt_get_resultset_metadata(), ci_stmt_get_start_line(), ci_stmt_next_result(), ci_stmt_prepare(), ci_stmt_register_out_parameter(), ci_stmt_set_option(), and ci_stmt_set_parameter().

#define API_HOUSEKEEP_END ( )    (void) bh_root_unlock(rid__)

Definition at line 56 of file cubrid_api.c.

Referenced by ci_conn_close().

#define API_RETURN (   c)
Value:
do { \
return (c); \
} while (0)
#define API_HOUSEKEEP_END()
Definition: cubrid_api.c:56

Definition at line 68 of file cubrid_api.c.

Referenced by ci_batch_res_get_error(), ci_batch_res_get_result(), ci_batch_res_query_count(), ci_collection_delete(), ci_collection_free(), ci_collection_get(), ci_collection_get_elem_domain_info(), ci_collection_insert(), ci_collection_length(), ci_collection_new(), ci_collection_update(), ci_conn_close(), ci_conn_commit(), ci_conn_connect(), ci_conn_create_statement(), ci_conn_get_error(), ci_conn_get_option(), ci_conn_rollback(), ci_conn_set_option(), ci_oid_delete(), ci_oid_get_classname(), ci_oid_get_resultset(), ci_pmeta_get_count(), ci_pmeta_get_info(), ci_res_apply_row(), ci_res_clear_updates(), ci_res_close(), ci_res_delete_row(), ci_res_fetch(), ci_res_fetch_tell(), ci_res_get_resultset_metadata(), ci_res_get_value(), ci_res_get_value_by_name(), ci_res_update_value(), ci_rmeta_get_count(), ci_rmeta_get_info(), ci_stmt_add_batch(), ci_stmt_add_batch_query(), ci_stmt_affected_rows(), ci_stmt_clear_batch(), ci_stmt_execute(), ci_stmt_execute_batch(), ci_stmt_execute_immediate(), ci_stmt_get_first_error(), ci_stmt_get_next_error(), ci_stmt_get_option(), ci_stmt_get_parameter(), ci_stmt_get_parameter_metadata(), ci_stmt_get_query_type(), ci_stmt_get_resultset(), ci_stmt_get_resultset_metadata(), ci_stmt_get_start_line(), ci_stmt_next_result(), ci_stmt_prepare(), ci_stmt_register_out_parameter(), ci_stmt_set_option(), and ci_stmt_set_parameter().

#define API_RID   rid__

Definition at line 31 of file cubrid_api.c.

Referenced by ci_conn_close().

Function Documentation

int ci_batch_res_get_error ( CI_BATCH_RESULT  br,
int  index,
int *  err_code,
char *  err_msg,
size_t  size 
)
int ci_batch_res_get_result ( CI_BATCH_RESULT  br,
int  index,
int *  ret,
int *  nr 
)
int ci_batch_res_query_count ( CI_BATCH_RESULT  br,
int *  count 
)
int ci_collection_get ( CI_COLLECTION  coll,
long  pos,
CI_TYPE  type,
void *  addr,
size_t  len,
size_t *  outlen,
bool isnull 
)
int ci_collection_get_elem_domain_info ( CI_COLLECTION  coll,
long  pos,
CI_TYPE *  type,
int *  precision,
int *  scale 
)
int ci_collection_insert ( CI_COLLECTION  coll,
long  pos,
CI_TYPE  type,
void *  ptr,
size_t  size 
)
int ci_collection_new ( CI_CONNECTION  conn,
CI_COLLECTION *  coll 
)
int ci_collection_update ( CI_COLLECTION  coll,
long  pos,
CI_TYPE  type,
void *  ptr,
size_t  size 
)
int ci_conn_commit ( CI_CONNECTION  conn)
int ci_conn_connect ( CI_CONNECTION  conn,
const char *  host,
unsigned short  port,
const char *  databasename,
const char *  user_name,
const char *  password 
)
int ci_conn_create_statement ( CI_CONNECTION  conn,
CI_STATEMENT *  stmt 
)
int ci_conn_get_error ( CI_CONNECTION  conn,
int *  err,
char *  msg,
size_t  size 
)
int ci_conn_get_option ( CI_CONNECTION  conn,
CI_CONNECTION_OPTION  option,
void *  arg,
size_t  size 
)
int ci_conn_rollback ( CI_CONNECTION  conn)
int ci_conn_set_option ( CI_CONNECTION  conn,
CI_CONNECTION_OPTION  option,
void *  arg,
size_t  size 
)
int ci_create_connection ( CI_CONNECTION *  conn)

Definition at line 85 of file cubrid_api.c.

References API_IMPL_TBL.

int ci_oid_get_classname ( CI_OID *  oid,
char *  name,
size_t  size 
)
int ci_pmeta_get_count ( CI_PARAMETER_METADATA  pmeta,
int *  count 
)
int ci_pmeta_get_info ( CI_PARAMETER_METADATA  pmeta,
int  index,
CI_PMETA_INFO_TYPE  type,
void *  arg,
size_t  size 
)
int ci_res_apply_row ( CI_RESULTSET  res)
int ci_res_clear_updates ( CI_RESULTSET  res)
int ci_res_close ( CI_RESULTSET  res)
int ci_res_delete_row ( CI_RESULTSET  res)
int ci_res_fetch ( CI_RESULTSET  res,
int  offset,
CI_FETCH_POSITION  pos 
)
int ci_res_fetch_tell ( CI_RESULTSET  res,
int *  offset 
)
int ci_res_get_resultset_metadata ( CI_RESULTSET  res,
CI_RESULTSET_METADATA *  r 
)
int ci_res_get_value ( CI_RESULTSET  res,
int  index,
CI_TYPE  type,
void *  addr,
size_t  len,
size_t *  outlen,
bool isnull 
)
int ci_res_get_value_by_name ( CI_RESULTSET  res,
const char *  name,
CI_TYPE  type,
void *  addr,
size_t  len,
size_t *  outlen,
bool isnull 
)
int ci_res_update_value ( CI_RESULTSET  res,
int  index,
CI_TYPE  type,
void *  addr,
size_t  len 
)
int ci_rmeta_get_count ( CI_RESULTSET_METADATA  rmeta,
int *  count 
)
int ci_rmeta_get_info ( CI_RESULTSET_METADATA  rmeta,
int  index,
CI_RMETA_INFO_TYPE  type,
void *  arg,
size_t  size 
)
int ci_stmt_add_batch ( CI_STATEMENT  stmt)
int ci_stmt_add_batch_query ( CI_STATEMENT  stmt,
const char *  sql,
size_t  len 
)
int ci_stmt_affected_rows ( CI_STATEMENT  stmt,
int *  out 
)
int ci_stmt_clear_batch ( CI_STATEMENT  stmt)
int ci_stmt_close ( CI_STATEMENT  stmt)
int ci_stmt_execute ( CI_STATEMENT  stmt,
CI_RESULTSET *  rs,
int *  r 
)
int ci_stmt_execute_batch ( CI_STATEMENT  stmt,
CI_BATCH_RESULT *  br 
)
int ci_stmt_execute_immediate ( CI_STATEMENT  stmt,
char *  sql,
size_t  len,
CI_RESULTSET *  rs,
int *  r 
)
int ci_stmt_get_first_error ( CI_STATEMENT  stmt,
int *  line,
int *  col,
int *  errcode,
char *  err_msg,
size_t  size 
)
int ci_stmt_get_next_error ( CI_STATEMENT  stmt,
int *  line,
int *  col,
int *  errcode,
char *  err_msg,
size_t  size 
)
int ci_stmt_get_option ( CI_STATEMENT  stmt,
CI_STATEMENT_OPTION  option,
void *  arg,
size_t  size 
)
int ci_stmt_get_parameter ( CI_STATEMENT  stmt,
int  index,
CI_TYPE  type,
void *  addr,
size_t  len,
size_t *  outlen,
bool isnull 
)
int ci_stmt_get_parameter_metadata ( CI_STATEMENT  stmt,
CI_PARAMETER_METADATA *  r 
)
int ci_stmt_get_query_type ( CI_STATEMENT  stmt,
CUBRID_STMT_TYPE type 
)
int ci_stmt_get_resultset ( CI_STATEMENT  stmt,
CI_RESULTSET *  res 
)
int ci_stmt_get_resultset_metadata ( CI_STATEMENT  stmt,
CI_RESULTSET_METADATA *  r 
)
int ci_stmt_get_start_line ( CI_STATEMENT  stmt,
int *  line 
)
int ci_stmt_next_result ( CI_STATEMENT  stmt,
bool exist_result 
)
int ci_stmt_prepare ( CI_STATEMENT  stmt,
const char *  sql,
size_t  len 
)
int ci_stmt_register_out_parameter ( CI_STATEMENT  stmt,
int  index 
)
int ci_stmt_set_option ( CI_STATEMENT  stmt,
CI_STATEMENT_OPTION  option,
void *  arg,
size_t  size 
)
int ci_stmt_set_parameter ( CI_STATEMENT  stmt,
int  index,
CI_TYPE  type,
void *  val,
size_t  size 
)