CUBRID Engine  latest
session.h
Go to the documentation of this file.
1 /*
2  * Copyright 2008 Search Solution Corporation
3  * Copyright 2016 CUBRID Corporation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 /*
20  * session.h - Session state api
21  */
22 #ifndef _SESSION_H_
23 #define _SESSION_H_
24 
25 #if !defined (SERVER_MODE) && !defined (SA_MODE)
26 #error Belongs to server module
27 #endif /* !defined (SERVER_MODE) && !defined (SA_MODE) */
28 
29 #include "dbtype_def.h"
30 #include "load_session.hpp"
31 #include "query_list.h"
32 #include "query_manager.h"
33 #include "system_parameter.h"
34 #include "thread_compat.hpp"
35 #include "tz_support.h"
36 
37 // forward definitions
38 struct xasl_cache_ent;
39 
40 extern void session_states_init (THREAD_ENTRY * thread_p);
41 extern void session_states_finalize (THREAD_ENTRY * thread_p);
42 extern int session_state_create (THREAD_ENTRY * thread_p, SESSION_ID * id);
43 extern int session_state_destroy (THREAD_ENTRY * thread_p, const SESSION_ID id);
44 extern int session_check_session (THREAD_ENTRY * thread_p, const SESSION_ID id);
45 extern int session_get_session_id (THREAD_ENTRY * thread_p, SESSION_ID * id);
46 extern int session_get_last_insert_id (THREAD_ENTRY * thread_p, DB_VALUE * value, bool update_last_insert_id);
47 extern int session_set_cur_insert_id (THREAD_ENTRY * thread_p, const DB_VALUE * value, bool force);
48 extern int session_reset_cur_insert_id (THREAD_ENTRY * thread_p);
49 extern int session_begin_insert_values (THREAD_ENTRY * thread_p);
50 extern int session_set_trigger_state (THREAD_ENTRY * thread_p, bool is_trigger);
51 extern int session_get_row_count (THREAD_ENTRY * thread_p, int *row_count);
52 extern int session_set_row_count (THREAD_ENTRY * thread_p, const int row_count);
53 extern int session_get_session_parameters (THREAD_ENTRY * thread_p, SESSION_PARAM ** session_parameters);
54 extern int session_set_session_parameters (THREAD_ENTRY * thread_p, SESSION_PARAM * session_parameters);
55 extern int session_create_prepared_statement (THREAD_ENTRY * thread_p, char *name, char *alias_print, SHA1Hash * sha1,
56  char *info, int info_len);
57 extern int session_get_prepared_statement (THREAD_ENTRY * thread_p, const char *name, char **info, int *info_len,
58  xasl_cache_ent ** xasl_entry);
59 extern int session_delete_prepared_statement (THREAD_ENTRY * thread_p, const char *name);
60 extern int login_user (THREAD_ENTRY * thread_p, const char *username);
61 extern int session_set_session_variables (THREAD_ENTRY * thread_p, DB_VALUE * values, const int count);
62 extern int session_get_variable (THREAD_ENTRY * thread_p, const DB_VALUE * name, DB_VALUE * result);
63 extern int session_get_variable_no_copy (THREAD_ENTRY * thread_p, const DB_VALUE * name, DB_VALUE ** result);
64 extern int session_define_variable (THREAD_ENTRY * thread_p, DB_VALUE * name, DB_VALUE * value, DB_VALUE * result);
65 extern int session_drop_session_variables (THREAD_ENTRY * thread_p, DB_VALUE * values, const int count);
66 extern void session_states_dump (THREAD_ENTRY * thread_p);
67 extern void session_store_query_entry_info (THREAD_ENTRY * thread_p, QMGR_QUERY_ENTRY * qentry_p);
68 extern int session_load_query_entry_info (THREAD_ENTRY * thread_p, QMGR_QUERY_ENTRY * qentry_p);
69 extern int session_remove_query_entry_info (THREAD_ENTRY * thread_p, const QUERY_ID query_id);
70 extern int session_clear_query_entry_info (THREAD_ENTRY * thread_p, const QUERY_ID query_id);
71 extern bool session_is_queryid_idle (THREAD_ENTRY * thread_p, const QUERY_ID query_id, QUERY_ID * max_query_id_uses);
72 
73 extern int session_get_exec_stats_and_clear (THREAD_ENTRY * thread_p, const DB_VALUE * name, DB_VALUE * result);
75 #if defined (SERVER_MODE)
76 extern int session_state_increase_ref_count (THREAD_ENTRY * thread_p, struct session_state *state_p);
77 extern int session_state_decrease_ref_count (THREAD_ENTRY * thread_p, struct session_state *state_p);
78 #endif
79 extern int session_get_trace_stats (THREAD_ENTRY * thread_p, DB_VALUE * result);
80 extern int session_set_trace_stats (THREAD_ENTRY * thread_p, char *scan_stats, int format);
81 extern int session_clear_trace_stats (THREAD_ENTRY * thread_p);
84 extern int session_get_private_lru_idx (const void *session_p);
85 extern int session_set_tran_auto_commit (THREAD_ENTRY * thread_p, bool auto_commit);
86 
87 extern int session_set_load_session (THREAD_ENTRY * thread_p, load_session * load_session_p);
88 extern int session_get_load_session (THREAD_ENTRY * thread_p, REFPTR (load_session, load_session_ref_ptr));
89 extern void session_stop_attached_threads (void *session);
90 #endif /* _SESSION_H_ */
void session_states_finalize(THREAD_ENTRY *thread_p)
Definition: session.c:607
Definition: sha1.h:50
int session_get_exec_stats_and_clear(THREAD_ENTRY *thread_p, const DB_VALUE *name, DB_VALUE *result)
Definition: session.c:2187
SESSION_PARAM * session_get_session_parameter(THREAD_ENTRY *thread_p, PARAM_ID id)
Definition: session.c:2714
int session_get_trace_stats(THREAD_ENTRY *thread_p, DB_VALUE *result)
Definition: session.c:2798
int session_get_session_parameters(THREAD_ENTRY *thread_p, SESSION_PARAM **session_parameters)
Definition: session.c:1613
TZ_REGION * session_get_session_tz_region(THREAD_ENTRY *thread_p)
Definition: session.c:2950
int session_set_trace_stats(THREAD_ENTRY *thread_p, char *scan_stats, int format)
Definition: session.c:2888
int session_get_private_lru_idx(const void *session_p)
Definition: session.c:3084
int session_clear_trace_stats(THREAD_ENTRY *thread_p)
Definition: session.c:2916
int session_get_load_session(THREAD_ENTRY *thread_p, REFPTR(load_session, load_session_ref_ptr))
Definition: session.c:3129
int session_set_session_variables(THREAD_ENTRY *thread_p, DB_VALUE *values, const int count)
Definition: session.c:1939
int session_begin_insert_values(THREAD_ENTRY *thread_p)
Definition: session.c:1506
enum param_id PARAM_ID
int session_check_session(THREAD_ENTRY *thread_p, const SESSION_ID id)
Definition: session.c:810
void session_stop_attached_threads(void *session)
Definition: session.c:3150
int session_set_load_session(THREAD_ENTRY *thread_p, load_session *load_session_p)
Definition: session.c:3113
int session_set_session_parameters(THREAD_ENTRY *thread_p, SESSION_PARAM *session_parameters)
Definition: session.c:1641
int session_reset_cur_insert_id(THREAD_ENTRY *thread_p)
Definition: session.c:1473
void THREAD_ENTRY
int session_get_last_insert_id(THREAD_ENTRY *thread_p, DB_VALUE *value, bool update_last_insert_id)
Definition: session.c:1381
void session_states_init(THREAD_ENTRY *thread_p)
Definition: session.c:582
#define REFPTR(T, name)
Definition: porting.h:1089
int session_get_prepared_statement(THREAD_ENTRY *thread_p, const char *name, char **info, int *info_len, xasl_cache_ent **xasl_entry)
Definition: session.c:1786
int session_state_destroy(THREAD_ENTRY *thread_p, const SESSION_ID id)
Definition: session.c:741
bool session_is_queryid_idle(THREAD_ENTRY *thread_p, const QUERY_ID query_id, QUERY_ID *max_query_id_uses)
Definition: session.c:2647
int session_remove_query_entry_info(THREAD_ENTRY *thread_p, const QUERY_ID query_id)
Definition: session.c:2556
int session_define_variable(THREAD_ENTRY *thread_p, DB_VALUE *name, DB_VALUE *value, DB_VALUE *result)
Definition: session.c:1970
int session_set_row_count(THREAD_ENTRY *thread_p, const int row_count)
Definition: session.c:1586
int session_get_number_of_holdable_cursors(void)
Definition: session.c:3070
int session_get_variable(THREAD_ENTRY *thread_p, const DB_VALUE *name, DB_VALUE *result)
Definition: session.c:2003
int count(int &result, const cub_regex_object &reg, const std::string &src, const int position, const INTL_CODESET codeset)
int session_set_tran_auto_commit(THREAD_ENTRY *thread_p, bool auto_commit)
Definition: session.c:3097
int session_get_session_id(THREAD_ENTRY *thread_p, SESSION_ID *id)
Definition: session.c:1347
int session_get_variable_no_copy(THREAD_ENTRY *thread_p, const DB_VALUE *name, DB_VALUE **result)
Definition: session.c:2069
int session_set_trigger_state(THREAD_ENTRY *thread_p, bool is_trigger)
Definition: session.c:1534
int login_user(THREAD_ENTRY *thread_p, const char *username)
Definition: session.c:1917
int session_create_prepared_statement(THREAD_ENTRY *thread_p, char *name, char *alias_print, SHA1Hash *sha1, char *info, int info_len)
Definition: session.c:1674
int session_clear_query_entry_info(THREAD_ENTRY *thread_p, const QUERY_ID query_id)
Definition: session.c:2601
int session_load_query_entry_info(THREAD_ENTRY *thread_p, QMGR_QUERY_ENTRY *qentry_p)
Definition: session.c:2525
unsigned int SESSION_ID
Definition: dbtype_def.h:480
void session_store_query_entry_info(THREAD_ENTRY *thread_p, QMGR_QUERY_ENTRY *qentry_p)
Definition: session.c:2440
int session_delete_prepared_statement(THREAD_ENTRY *thread_p, const char *name)
Definition: session.c:1865
int session_get_row_count(THREAD_ENTRY *thread_p, int *row_count)
Definition: session.c:1562
int session_set_cur_insert_id(THREAD_ENTRY *thread_p, const DB_VALUE *value, bool force)
Definition: session.c:1414
int session_state_create(THREAD_ENTRY *thread_p, SESSION_ID *id)
Definition: session.c:637
void session_states_dump(THREAD_ENTRY *thread_p)
Definition: session.c:2208
int session_drop_session_variables(THREAD_ENTRY *thread_p, DB_VALUE *values, const int count)
Definition: session.c:2157