File cas_handle.h¶
File List > broker > cas_handle.h
Go to the documentation of this file
/*
* Copyright 2008 Search Solution Corporation
* Copyright 2016 CUBRID Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
/*
* cas_handle.h -
*/
#ifndef _CAS_HANDLE_H_
#define _CAS_HANDLE_H_
#ident "$Id$"
#include "cas_db_inc.h"
/* ODBC SQL types - only needed for CGW (Gateway) mode */
/* Note: These headers are conditionally included because they are only required
* when building CGW. CAS (normal broker) does not need ODBC dependencies.
* The T_CGW_HANDLE structure uses these types, but forward declaration
* allows the structure to be defined without including these headers in CAS mode.
*/
#if defined(CAS_FOR_CGW)
/*
* If SIZEOF_LONG_INT is not defined in sqltypes.h, build including unixodbc_conf.h.
* When building including unixodbc_conf.h, "warning: "PACKAGE_STRING" is displayed.
* So I added the following code before including sqltypes.h to remove of the build warning.
*/
#if !defined (SIZEOF_LONG_INT)
#define SIZEOF_LONG_INT 8
#endif
#include <sqltypes.h>
#include <sql.h>
#include <sqlext.h>
#endif /* CAS_FOR_CGW */
#define SRV_HANDLE_QUERY_SEQ_NUM(SRV_HANDLE) \
((SRV_HANDLE) ? (SRV_HANDLE)->query_seq_num : 0)
typedef struct t_prepare_call_info T_PREPARE_CALL_INFO;
struct t_prepare_call_info
{
void *dbval_ret;
void *dbval_args;
char *param_mode;
int num_args;
int is_first_out;
};
typedef struct t_col_update_info T_COL_UPDATE_INFO;
struct t_col_update_info
{
char *attr_name;
char *class_name;
char updatable;
};
typedef struct t_query_result T_QUERY_RESULT;
struct t_query_result
{
void *result;
char *null_type_column;
T_COL_UPDATE_INFO *col_update_info;
void *column_info;
int copied;
int tuple_count;
int stmt_id;
int num_column;
char stmt_type;
char col_updatable;
char include_oid;
bool is_holdable;
};
typedef struct t_cgw_handle T_CGW_HANDLE;
#if defined (CAS_FOR_CGW)
struct t_cgw_handle
{
SQLHENV henv;
SQLHDBC hdbc;
SQLHSTMT hstmt;
};
#endif /* CAS_FOR_CGW */
typedef struct t_fk_info_result T_FK_INFO_RESULT;
struct t_fk_info_result
{
struct t_fk_info_result *prev;
struct t_fk_info_result *next;
char *pktable_name;
char *pkcolumn_name;
char *fktable_name;
char *fkcolumn_name;
short key_seq;
SM_FOREIGN_KEY_ACTION update_action;
SM_FOREIGN_KEY_ACTION delete_action;
char *fk_name;
char *pk_name;
};
typedef struct t_srv_handle T_SRV_HANDLE;
struct t_srv_handle
{
int id;
void *session; /* query : DB_SESSION* schema : schema info table pointer */
T_PREPARE_CALL_INFO *prepare_call_info;
T_QUERY_RESULT *q_result;
void *cur_result; /* query : &(q_result[cur_result]) schema info : &(session[cursor_pos]) */
char *sql_stmt;
void **classes;
int *classes_chn;
int cur_result_index;
int num_q_result;
bool has_result_set;
int num_markers;
int max_col_size;
int cursor_pos;
int schema_type;
int sch_tuple_num;
int max_row;
int num_classes;
unsigned int query_seq_num;
char prepare_flag;
char is_prepared;
char is_updatable;
char query_info_flag;
char is_pooled;
char need_force_commit;
char auto_commit_mode;
char forward_only_cursor;
bool use_plan_cache;
bool use_query_cache;
bool is_fetch_completed;
bool is_holdable;
bool is_from_current_transaction;
/* CGW fields */
T_CGW_HANDLE *cgw_handle;
int total_tuple_count;
int stmt_type;
bool is_cursor_open;
};
extern int hm_new_srv_handle (T_SRV_HANDLE ** new_handle, unsigned int seq_num);
extern void hm_srv_handle_free (int h_id);
extern void hm_srv_handle_free_all (bool free_holdable);
extern void hm_srv_handle_qresult_end_all (bool end_holdable);
extern T_SRV_HANDLE *hm_find_srv_handle (int h_id);
extern void hm_qresult_clear (T_QUERY_RESULT * q_result);
extern void hm_qresult_end (T_SRV_HANDLE * srv_handle, char free_flag);
extern void hm_session_free (T_SRV_HANDLE * srv_handle);
extern void hm_col_update_info_clear (T_COL_UPDATE_INFO * col_update_info);
#if defined (ENABLE_UNUSED_FUNCTION)
extern void hm_srv_handle_set_pooled (void);
#endif
extern void hm_set_current_srv_handle (int h_id);
extern int hm_srv_handle_get_current_count (void);
extern void hm_srv_handle_unset_prepare_flag_all (void);
extern void hm_free_result (void *res);
extern void hm_prepare_call_info_free (T_PREPARE_CALL_INFO * call_info);
extern void release_all_fk_info_results (T_FK_INFO_RESULT * fk_res);
typedef void (*cgw_free_stmt_func_t) (T_SRV_HANDLE * srv_handle);
extern void hm_set_cgw_mode (bool enabled);
extern void hm_set_cgw_free_stmt_func (cgw_free_stmt_func_t func);
#endif /* _CAS_HANDLE_H_ */