17
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
#ifndef DRIZZLED_SET_VAR_H
21
#define DRIZZLED_SET_VAR_H
20
#ifndef DRIZZLED_SYS_VAR_H
21
#define DRIZZLED_SYS_VAR_H
24
24
#include <boost/filesystem.hpp>
28
28
#include "drizzled/item/string.h"
29
29
#include "drizzled/item/field.h"
30
30
#include "drizzled/constrained_value.h"
31
#include "drizzled/set_var.h"
35
/* Classes to support the SET command */
38
/****************************************************************************
39
Variables that are changable runtime are declared using the
41
****************************************************************************/
45
37
class sys_var_pluginvar; /* opaque */
47
39
typedef struct my_locale_st MY_LOCALE;
70
62
extern char system_time_zone[30];
71
63
extern char *opt_tc_log_file;
72
64
extern uint64_t session_startup_options;
73
extern time_t server_start_time;
74
extern time_t flush_status_time;
75
65
extern uint32_t global_thread_id;
76
66
extern uint64_t table_cache_size;
77
67
extern uint64_t max_connect_errors;
89
79
uint64_t fix_unsigned(Session *, uint64_t, const struct option *);
93
/****************************************************************************
94
Classes for parsing of the SET command
95
****************************************************************************/
97
class set_var_base :public memory::SqlAlloc
101
virtual ~set_var_base() {}
102
virtual int check(Session *session)=0; /* To check privileges etc. */
103
virtual int update(Session *session)=0; /* To set the value */
104
/* light check for PS */
107
/* MySQL internal variables */
108
class set_var :public set_var_base
116
const CHARSET_INFO *charset;
117
uint32_t uint32_t_value;
118
uint64_t uint64_t_value;
120
plugin::StorageEngine *storage_engine;
121
Time_zone *time_zone;
122
MY_LOCALE *locale_value;
124
LEX_STRING base; /* for structs */
126
set_var(sql_var_t type_arg, sys_var *var_arg,
127
const LEX_STRING *base_name_arg, Item *value_arg)
128
:var(var_arg), type(type_arg), base(*base_name_arg)
131
If the set value is a field, change it to a string to allow things like
132
SET table_type=MYISAM;
134
if (value_arg && value_arg->type() == Item::FIELD_ITEM)
136
Item_field *item= (Item_field*) value_arg;
137
if (!(value=new Item_string(item->field_name,
138
(uint32_t) strlen(item->field_name),
139
item->collation.collation)))
140
value=value_arg; /* Give error message later */
145
int check(Session *session);
146
int update(Session *session);
151
84
* A class which represents a variable, either global or
157
90
std::string name; /**< The name of the variable */
158
91
sys_after_update_func after_update; /**< Function pointer triggered after the variable's value is updated */
159
struct option *option_limits; /**< Updated by by set_var_init() */
92
struct option *option_limits; /**< Updated by by sys_var_init() */
160
93
bool m_allow_empty_value; /**< Does variable allow an empty value? */
162
95
sys_var(const std::string name_arg, sys_after_update_func func= NULL)
1089
/* User variables like @my_own_variable */
1091
class set_var_user: public set_var_base
1093
Item_func_set_user_var *user_var_item;
1095
set_var_user(Item_func_set_user_var *item)
1096
:user_var_item(item)
1098
int check(Session *session);
1099
int update(Session *session);
1103
1023
/* For sql_yacc */
1104
1024
struct sys_var_with_base
1111
1031
Prototypes for helper functions
1115
1034
drizzle_show_var* enumerate_sys_vars(Session *session);
1116
1035
void drizzle_add_plugin_sysvar(sys_var_pluginvar *var);
1117
1036
void drizzle_del_plugin_sysvar();
1118
1037
void add_sys_var_to_list(sys_var *var, struct option *long_options);
1119
1038
void add_sys_var_to_list(sys_var *var);
1120
1039
sys_var *find_sys_var(Session *session, const char *str, uint32_t length=0);
1121
int sql_set_variables(Session *session, List<set_var_base> *var_list);
1122
1040
bool not_all_support_one_shot(List<set_var_base> *var_list);
1123
1041
extern sys_var_session_time_zone sys_time_zone;
1124
1042
extern sys_var_session_bit sys_autocommit;