File cas_cgw_odbc.c
FileList > broker > cas_cgw_odbc.c
Go to the source code of this file
#include <inttypes.h>
#include "cas_cgw_odbc.h"
#include "cas_util.h"
#include "cas_log.h"
#include "cas_common.h"
#include "broker_config.h"
#include "broker_cas_cci.h"
#include "cas_cgw_execute.h"
#include <iconv.h>
Classes
Public Types
Public Attributes
Public Static Attributes
Public Functions
| Type |
Name |
| void |
cgw_cleanup (void)
|
| void |
cgw_cleanup_binder (T_COL_BINDER * first_col_binding)
|
| int |
cgw_col_bindings (SQLHSTMT hstmt, SQLSMALLINT num_cols, T_COL_BINDER ** col_binding, T_COL_BINDER ** col_binding_buff)
|
| int |
cgw_copy_tuple (T_COL_BINDER * src_col_binding, T_COL_BINDER * dst_col_binding)
|
| int |
cgw_cur_tuple (T_NET_BUF * net_buf, T_COL_BINDER * first_col_binding, int cursor_pos)
|
| int |
cgw_cursor_close (T_SRV_HANDLE * srv_handle)
|
| int |
cgw_database_connect (T_DBMS_TYPE dbms_type, const char * connect_url, char * db_name, char * db_user, char * db_passwd)
|
| void |
cgw_database_disconnect ()
|
| int |
cgw_endtran (SQLHDBC hdbc, int tran_type)
|
| int |
cgw_execute (T_SRV_HANDLE * srv_handle, SQLLEN * row_count)
|
| void |
cgw_free_stmt (T_SRV_HANDLE * srv_handle)
|
| int |
cgw_get_col_info (SQLHSTMT hstmt, int col_num, T_ODBC_COL_INFO * col_info)
|
| T_DBMS_TYPE |
cgw_get_dbms_type ()
|
| int |
cgw_get_driver_info (SQLHDBC hdbc, SQLUSMALLINT info_type, void * driver_info, SQLSMALLINT size)
|
| int |
cgw_get_handle (T_CGW_HANDLE ** cgw_handle)
|
| int |
cgw_get_num_cols (SQLHSTMT hstmt, SQLSMALLINT * num_cols)
|
| int |
cgw_get_stmt_handle (SQLHDBC hdbc, SQLHSTMT * stmt)
|
| int |
cgw_init (void)
|
| int |
cgw_init_odbc_handle (void)
|
| int |
cgw_is_database_connected ()
|
| T_DBMS_TYPE |
cgw_is_supported_dbms (char * dbms)
|
| int |
cgw_make_bind_value (T_CGW_HANDLE * handle, int num_bind, int argc, void ** argv, ODBC_BIND_INFO ** ret_val)
|
| int |
cgw_row_data (SQLHSTMT hstmt)
|
| int |
cgw_set_commit_mode (SQLHDBC hdbc, bool auto_commit)
|
| void |
cgw_set_dbms_type (T_DBMS_TYPE dbms_type)
|
| int |
cgw_set_execute_info (T_SRV_HANDLE * srv_handle, T_NET_BUF * net_buf, int stmt_type)
|
| int |
cgw_set_stmt_attr (SQLHSTMT hstmt, SQLINTEGER attr, SQLPOINTER val, SQLINTEGER len)
|
| int |
cgw_sql_prepare (SQLCHAR * sql_stmt)
|
Public Static Functions
| Type |
Name |
| void |
cgw_cleanup_handle (T_CGW_HANDLE * handle)
|
| int |
cgw_conv_mtow (wchar_t * destStr, char * sourStr)
|
| int |
cgw_count_number_of_digits (int num_bits)
|
| char * |
cgw_datatype_to_string (SQLLEN type)
|
| void |
cgw_error_msg (SQLHANDLE hHandle, SQLSMALLINT hType, RETCODE retcode)
|
| char |
cgw_get_charset (void)
|
| const char * |
cgw_get_dbms_name (T_DBMS_TYPE db_type)
|
| int |
cgw_get_stmt_Info (T_SRV_HANDLE * srv_handle, SQLHSTMT hstmt, T_NET_BUF * net_buf, int stmt_type)
|
| bool |
cgw_is_support_datatype (SQLSMALLINT data_type, SQLLEN type_size)
|
| void |
cgw_link_server_info (SQLHDBC hdbc)
|
| char |
cgw_odbc_type_to_cci_u_type (SQLLEN odbc_type, SQLLEN is_unsigned_type)
|
| char |
cgw_odbc_type_to_charset (SQLLEN odbc_type, SQLLEN is_unsigned_type)
|
| int |
cgw_set_bindparam (T_CGW_HANDLE * handle, int bind_num, void * net_type, void * net_value, ODBC_BIND_INFO * value_list)
|
| void |
cgw_set_charset (char charset)
|
| int |
cgw_uint32_to_uni16 (uint32_t i, uint16_t * u)
|
| int |
cgw_unicode_to_utf8 (wchar_t * in_src, int in_size, char ** out_target, int * out_length)
|
| int |
cgw_utf8_to_unicode (const char * in_utf8_str, wchar_t * out_unicode_str, size_t out_unicode_strLen)
|
| char * |
cgw_utype_to_string (int type)
|
| SQLWCHAR * |
cgw_wchar_to_sqlwchar (wchar_t * src, size_t len)
|
| SQLSMALLINT |
get_c_type (SQLSMALLINT s_type, SQLLEN is_unsigned_type)
|
| SQLULEN |
get_datatype_size (SQLSMALLINT s_type, SQLULEN chars, SQLLEN precision, SQLLEN scale)
|
| int |
hex_to_char (char c, unsigned char * result)
|
| int |
hex_to_numeric_val (SQL_NUMERIC_STRUCT * numeric, char * hexstr)
|
| int |
numeric_string_adjust (SQL_NUMERIC_STRUCT * numeric, char * string)
|
Macros
| Type |
Name |
| define |
CONNECTED_STATE (0)
|
| define |
CONV_M_TO_W (M, W, LEN) [**mbstowcs**](broker__monitor_8c.md#function-timeout)([**W**](broker__monitor_8c.md#function-timeout), M, [**LEN**](broker__monitor_8c.md#function-timeout))
|
| define |
CONV_STRING_BUF_SIZE ([**STRING\_MAX\_SIZE**](cas__cgw__odbc_8c.md#define-string_max_size))
|
| define |
CONV_WCS_TO_SQLWCS (string, len) [**cgw\_wchar\_to\_sqlwchar**](cas__cgw__odbc_8c.md#function-cgw_wchar_to_sqlwchar)((string), (len))
|
| define |
DISCONNECTED_STATE (-1)
|
| define |
LOGIN_TIME_OUT (5)
|
| define |
NUM_OF_DIGITS (NUMBER) (([**int**](broker__monitor_8c.md#function-timeout))[**log10**](broker__monitor_8c.md#function-timeout)([**NUMBER**](broker__monitor_8c.md#function-timeout)) + 1)
|
| define |
ODBC_SQLSUCCESS (rc) ((rc == [**SQL\_SUCCESS**](broker__monitor_8c.md#function-timeout)) \|\| (rc == [**SQL\_SUCCESS\_WITH\_INFO**](broker__monitor_8c.md#function-timeout)) )
|
| define |
SQL_CHK_ERR (h, ht, x) /* multi line expression */
|
| define |
STRING_MAX_SIZE (16\*1024\*1024)
|
| define |
UNICODE_CODE_PAGE "UCS-2"
|
| define |
UTF8_CODE_PAGE "UTF-8"
|
| define |
__STDC_FORMAT_MACROS
|
Public Types Documentation
typedef T_SUPPORTED_DBMS
typedef struct t_supported_dbms T_SUPPORTED_DBMS;
Public Attributes Documentation
variable local_odbc_handle
T_CGW_HANDLE* local_odbc_handle;
Public Static Attributes Documentation
variable client_charset
INTL_CODESET client_charset;
variable connected_db_name
char connected_db_name[32];
variable connected_db_passwd
char connected_db_passwd[32];
variable connected_db_user
char connected_db_user[32];
variable conv_str_buff
char conv_str_buff[((16 *1024 *1024))+1];
variable curr_dbms_type
T_DBMS_TYPE curr_dbms_type;
variable supported_dbms_list
T_SUPPORTED_DBMS supported_dbms_list[];
variable supported_dbms_max_num
int supported_dbms_max_num;
Public Functions Documentation
function cgw_cleanup
void cgw_cleanup (
void
)
function cgw_cleanup_binder
void cgw_cleanup_binder (
T_COL_BINDER * first_col_binding
)
function cgw_col_bindings
int cgw_col_bindings (
SQLHSTMT hstmt,
SQLSMALLINT num_cols,
T_COL_BINDER ** col_binding,
T_COL_BINDER ** col_binding_buff
)
function cgw_copy_tuple
int cgw_copy_tuple (
T_COL_BINDER * src_col_binding,
T_COL_BINDER * dst_col_binding
)
function cgw_cur_tuple
int cgw_cur_tuple (
T_NET_BUF * net_buf,
T_COL_BINDER * first_col_binding,
int cursor_pos
)
function cgw_cursor_close
int cgw_cursor_close (
T_SRV_HANDLE * srv_handle
)
function cgw_database_connect
int cgw_database_connect (
T_DBMS_TYPE dbms_type,
const char * connect_url,
char * db_name,
char * db_user,
char * db_passwd
)
function cgw_database_disconnect
void cgw_database_disconnect ()
function cgw_endtran
int cgw_endtran (
SQLHDBC hdbc,
int tran_type
)
function cgw_execute
int cgw_execute (
T_SRV_HANDLE * srv_handle,
SQLLEN * row_count
)
function cgw_free_stmt
void cgw_free_stmt (
T_SRV_HANDLE * srv_handle
)
function cgw_get_col_info
int cgw_get_col_info (
SQLHSTMT hstmt,
int col_num,
T_ODBC_COL_INFO * col_info
)
function cgw_get_dbms_type
T_DBMS_TYPE cgw_get_dbms_type ()
function cgw_get_driver_info
int cgw_get_driver_info (
SQLHDBC hdbc,
SQLUSMALLINT info_type,
void * driver_info,
SQLSMALLINT size
)
function cgw_get_handle
int cgw_get_handle (
T_CGW_HANDLE ** cgw_handle
)
function cgw_get_num_cols
int cgw_get_num_cols (
SQLHSTMT hstmt,
SQLSMALLINT * num_cols
)
function cgw_get_stmt_handle
int cgw_get_stmt_handle (
SQLHDBC hdbc,
SQLHSTMT * stmt
)
function cgw_init
function cgw_init_odbc_handle
int cgw_init_odbc_handle (
void
)
function cgw_is_database_connected
int cgw_is_database_connected ()
function cgw_is_supported_dbms
T_DBMS_TYPE cgw_is_supported_dbms (
char * dbms
)
function cgw_make_bind_value
int cgw_make_bind_value (
T_CGW_HANDLE * handle,
int num_bind,
int argc,
void ** argv,
ODBC_BIND_INFO ** ret_val
)
function cgw_row_data
int cgw_row_data (
SQLHSTMT hstmt
)
function cgw_set_commit_mode
int cgw_set_commit_mode (
SQLHDBC hdbc,
bool auto_commit
)
function cgw_set_dbms_type
void cgw_set_dbms_type (
T_DBMS_TYPE dbms_type
)
function cgw_set_execute_info
int cgw_set_execute_info (
T_SRV_HANDLE * srv_handle,
T_NET_BUF * net_buf,
int stmt_type
)
function cgw_set_stmt_attr
int cgw_set_stmt_attr (
SQLHSTMT hstmt,
SQLINTEGER attr,
SQLPOINTER val,
SQLINTEGER len
)
function cgw_sql_prepare
int cgw_sql_prepare (
SQLCHAR * sql_stmt
)
Public Static Functions Documentation
function cgw_cleanup_handle
static void cgw_cleanup_handle (
T_CGW_HANDLE * handle
)
function cgw_conv_mtow
static int cgw_conv_mtow (
wchar_t * destStr,
char * sourStr
)
function cgw_count_number_of_digits
static int cgw_count_number_of_digits (
int num_bits
)
function cgw_datatype_to_string
static char * cgw_datatype_to_string (
SQLLEN type
)
function cgw_error_msg
static void cgw_error_msg (
SQLHANDLE hHandle,
SQLSMALLINT hType,
RETCODE retcode
)
function cgw_get_charset
static char cgw_get_charset (
void
)
function cgw_get_dbms_name
static const char * cgw_get_dbms_name (
T_DBMS_TYPE db_type
)
function cgw_get_stmt_Info
static int cgw_get_stmt_Info (
T_SRV_HANDLE * srv_handle,
SQLHSTMT hstmt,
T_NET_BUF * net_buf,
int stmt_type
)
function cgw_is_support_datatype
static bool cgw_is_support_datatype (
SQLSMALLINT data_type,
SQLLEN type_size
)
function cgw_link_server_info
static void cgw_link_server_info (
SQLHDBC hdbc
)
function cgw_odbc_type_to_cci_u_type
static char cgw_odbc_type_to_cci_u_type (
SQLLEN odbc_type,
SQLLEN is_unsigned_type
)
function cgw_odbc_type_to_charset
static char cgw_odbc_type_to_charset (
SQLLEN odbc_type,
SQLLEN is_unsigned_type
)
function cgw_set_bindparam
static int cgw_set_bindparam (
T_CGW_HANDLE * handle,
int bind_num,
void * net_type,
void * net_value,
ODBC_BIND_INFO * value_list
)
function cgw_set_charset
static void cgw_set_charset (
char charset
)
function cgw_uint32_to_uni16
static int cgw_uint32_to_uni16 (
uint32_t i,
uint16_t * u
)
function cgw_unicode_to_utf8
static int cgw_unicode_to_utf8 (
wchar_t * in_src,
int in_size,
char ** out_target,
int * out_length
)
function cgw_utf8_to_unicode
static int cgw_utf8_to_unicode (
const char * in_utf8_str,
wchar_t * out_unicode_str,
size_t out_unicode_strLen
)
function cgw_utype_to_string
static char * cgw_utype_to_string (
int type
)
function cgw_wchar_to_sqlwchar
static SQLWCHAR * cgw_wchar_to_sqlwchar (
wchar_t * src,
size_t len
)
function get_c_type
static SQLSMALLINT get_c_type (
SQLSMALLINT s_type,
SQLLEN is_unsigned_type
)
function get_datatype_size
static SQLULEN get_datatype_size (
SQLSMALLINT s_type,
SQLULEN chars,
SQLLEN precision,
SQLLEN scale
)
function hex_to_char
static int hex_to_char (
char c,
unsigned char * result
)
function hex_to_numeric_val
static int hex_to_numeric_val (
SQL_NUMERIC_STRUCT * numeric,
char * hexstr
)
function numeric_string_adjust
static int numeric_string_adjust (
SQL_NUMERIC_STRUCT * numeric,
char * string
)
Macro Definition Documentation
define CONNECTED_STATE
#define CONNECTED_STATE `(0)`
define CONV_M_TO_W
#define CONV_M_TO_W (
M,
W,
LEN
) `mbstowcs ( W , M, LEN )`
define CONV_STRING_BUF_SIZE
#define CONV_STRING_BUF_SIZE `( STRING_MAX_SIZE )`
define CONV_WCS_TO_SQLWCS
#define CONV_WCS_TO_SQLWCS (
string,
len
) `cgw_wchar_to_sqlwchar ((string), (len))`
define DISCONNECTED_STATE
#define DISCONNECTED_STATE `(-1)`
define LOGIN_TIME_OUT
#define LOGIN_TIME_OUT `(5)`
define NUM_OF_DIGITS
#define NUM_OF_DIGITS (
NUMBER
) `(( int ) log10 ( NUMBER ) + 1)`
define ODBC_SQLSUCCESS
#define ODBC_SQLSUCCESS (
rc
) `((rc == SQL_SUCCESS ) || (rc == SQL_SUCCESS_WITH_INFO ) )`
define SQL_CHK_ERR
#define SQL_CHK_ERR (
h,
ht,
x
) `/* multi line expression */`
define STRING_MAX_SIZE
#define STRING_MAX_SIZE `(16*1024*1024)`
define UNICODE_CODE_PAGE
#define UNICODE_CODE_PAGE `"UCS-2"`
define UTF8_CODE_PAGE
#define UTF8_CODE_PAGE `"UTF-8"`
#define __STDC_FORMAT_MACROS
The documentation for this class was generated from the following file cubrid/src/broker/cas_cgw_odbc.c