46
47
them you must first assign a value to them (in specific ::check() for
49
51
#include <drizzled/server_includes.h>
51
52
#include <mysys/my_getopt.h>
52
#include <mysys/thr_alarm.h>
53
#include <storage/myisam/myisam.h>
54
#include <drizzled/drizzled_error_messages.h>
53
#include <plugin/myisam/myisam.h>
54
#include <drizzled/error.h>
55
#include <drizzled/gettext.h>
56
#include <drizzled/tztime.h>
57
#include <drizzled/data_home.h>
58
#include <drizzled/set_var.h>
59
#include <drizzled/session.h>
60
#include <drizzled/sql_base.h>
61
#include <drizzled/lock.h>
62
#include <drizzled/item/uint.h>
63
#include <drizzled/item/null.h>
64
#include <drizzled/item/float.h>
66
#include "drizzled/registry.h"
56
72
extern const CHARSET_INFO *character_set_filesystem;
73
extern I_List<NAMED_LIST> key_caches;
74
extern size_t my_thread_stack_size;
59
76
static DYNAMIC_ARRAY fixed_show_vars;
60
static HASH system_variable_hash;
77
static drizzled::Registry<sys_var *> system_variable_hash;
78
extern char *opt_drizzle_tmpdir;
62
const char *bool_type_names[]= { "OFF", "ON", NullS };
80
const char *bool_type_names[]= { "OFF", "ON", NULL };
63
81
TYPELIB bool_typelib=
65
83
array_elements(bool_type_names)-1, "", bool_type_names, NULL
68
const char *delay_key_write_type_names[]= { "OFF", "ON", "ALL", NullS };
86
const char *delay_key_write_type_names[]= { "OFF", "ON", "ALL", NULL };
69
87
TYPELIB delay_key_write_typelib=
71
89
array_elements(delay_key_write_type_names)-1, "",
72
90
delay_key_write_type_names, NULL
75
const char *slave_exec_mode_names[]=
76
{ "STRICT", "IDEMPOTENT", NullS };
77
static const unsigned int slave_exec_mode_names_len[]=
78
{ sizeof("STRICT") - 1, sizeof("IDEMPOTENT") - 1, 0 };
79
TYPELIB slave_exec_mode_typelib=
81
array_elements(slave_exec_mode_names)-1, "",
82
slave_exec_mode_names, (unsigned int *) slave_exec_mode_names_len
85
static bool sys_update_init_connect(THD*, set_var*);
86
static void sys_default_init_connect(THD*, enum_var_type type);
87
static bool sys_update_init_slave(THD*, set_var*);
88
static void sys_default_init_slave(THD*, enum_var_type type);
89
static bool set_option_bit(THD *thd, set_var *var);
90
static bool set_option_autocommit(THD *thd, set_var *var);
91
static int check_log_update(THD *thd, set_var *var);
92
static bool set_log_update(THD *thd, set_var *var);
93
static int check_pseudo_thread_id(THD *thd, set_var *var);
94
static void fix_low_priority_updates(THD *thd, enum_var_type type);
95
static int check_tx_isolation(THD *thd, set_var *var);
96
static void fix_tx_isolation(THD *thd, enum_var_type type);
97
static int check_completion_type(THD *thd, set_var *var);
98
static void fix_completion_type(THD *thd, enum_var_type type);
99
static void fix_net_read_timeout(THD *thd, enum_var_type type);
100
static void fix_net_write_timeout(THD *thd, enum_var_type type);
101
static void fix_net_retry_count(THD *thd, enum_var_type type);
102
static void fix_max_join_size(THD *thd, enum_var_type type);
103
static void fix_myisam_max_sort_file_size(THD *thd, enum_var_type type);
104
static void fix_max_binlog_size(THD *thd, enum_var_type type);
105
static void fix_max_relay_log_size(THD *thd, enum_var_type type);
106
static void fix_max_connections(THD *thd, enum_var_type type);
107
static void fix_thd_mem_root(THD *thd, enum_var_type type);
108
static void fix_trans_mem_root(THD *thd, enum_var_type type);
109
static void fix_server_id(THD *thd, enum_var_type type);
110
static uint64_t fix_unsigned(THD *, uint64_t, const struct my_option *);
111
static bool get_unsigned(THD *thd, set_var *var);
112
bool throw_bounds_warning(THD *thd, bool fixed, bool unsignd,
113
const char *name, int64_t val);
114
static KEY_CACHE *create_key_cache(const char *name, uint length);
115
static uchar *get_error_count(THD *thd);
116
static uchar *get_warning_count(THD *thd);
117
static uchar *get_tmpdir(THD *thd);
118
static int sys_check_log_path(THD *thd, set_var *var);
119
static bool sys_update_general_log_path(THD *thd, set_var * var);
120
static void sys_default_general_log_path(THD *thd, enum_var_type type);
121
static bool sys_update_slow_log_path(THD *thd, set_var * var);
122
static void sys_default_slow_log_path(THD *thd, enum_var_type type);
93
static bool set_option_bit(Session *session, set_var *var);
94
static bool set_option_autocommit(Session *session, set_var *var);
95
static int check_pseudo_thread_id(Session *session, set_var *var);
96
static int check_tx_isolation(Session *session, set_var *var);
97
static void fix_tx_isolation(Session *session, enum_var_type type);
98
static int check_completion_type(Session *session, set_var *var);
99
static void fix_completion_type(Session *session, enum_var_type type);
100
static void fix_net_read_timeout(Session *session, enum_var_type type);
101
static void fix_net_write_timeout(Session *session, enum_var_type type);
102
static void fix_net_retry_count(Session *session, enum_var_type type);
103
static void fix_max_join_size(Session *session, enum_var_type type);
104
static void fix_session_mem_root(Session *session, enum_var_type type);
105
static void fix_trans_mem_root(Session *session, enum_var_type type);
106
static void fix_server_id(Session *session, enum_var_type type);
107
static uint64_t fix_unsigned(Session *, uint64_t, const struct my_option *);
108
static bool get_unsigned32(Session *session, set_var *var);
109
static bool get_unsigned64(Session *session, set_var *var);
110
bool throw_bounds_warning(Session *session, bool fixed, bool unsignd,
111
const std::string &name, int64_t val);
112
static KEY_CACHE *create_key_cache(const char *name, uint32_t length);
113
static unsigned char *get_error_count(Session *session);
114
static unsigned char *get_warning_count(Session *session);
115
static unsigned char *get_tmpdir(Session *session);
125
118
Variable definition list
130
123
The variables are linked into the list. A variable is added to
131
124
it in the constructor (see sys_var class for details).
134
126
static sys_var_chain vars = { NULL, NULL };
136
static sys_var_thd_ulong
128
static sys_var_session_uint64_t
137
129
sys_auto_increment_increment(&vars, "auto_increment_increment",
138
&SV::auto_increment_increment, NULL, NULL,
139
sys_var::SESSION_VARIABLE_IN_BINLOG);
140
static sys_var_thd_ulong
130
&SV::auto_increment_increment);
131
static sys_var_session_uint64_t
141
132
sys_auto_increment_offset(&vars, "auto_increment_offset",
142
&SV::auto_increment_offset, NULL, NULL,
143
sys_var::SESSION_VARIABLE_IN_BINLOG);
133
&SV::auto_increment_offset);
145
static sys_var_const_str sys_basedir(&vars, "basedir", mysql_home);
146
static sys_var_long_ptr sys_binlog_cache_size(&vars, "binlog_cache_size",
148
static sys_var_thd_binlog_format sys_binlog_format(&vars, "binlog_format",
150
static sys_var_thd_ulong sys_bulk_insert_buff_size(&vars, "bulk_insert_buffer_size",
151
&SV::bulk_insert_buff_size);
152
static sys_var_character_set_sv
153
sys_character_set_server(&vars, "character_set_server",
154
&SV::collation_server, &default_charset_info, 0,
155
sys_var::SESSION_VARIABLE_IN_BINLOG);
156
sys_var_const_str sys_charset_system(&vars, "character_set_system",
157
(char *)my_charset_utf8_general_ci.name);
158
static sys_var_character_set_database
159
sys_character_set_database(&vars, "character_set_database",
160
sys_var::SESSION_VARIABLE_IN_BINLOG);
161
static sys_var_character_set_client
162
sys_character_set_client(&vars, "character_set_client",
163
&SV::character_set_client,
164
&default_charset_info,
165
sys_var::SESSION_VARIABLE_IN_BINLOG);
166
static sys_var_character_set_sv
167
sys_character_set_connection(&vars, "character_set_connection",
168
&SV::collation_connection,
169
&default_charset_info, 0,
170
sys_var::SESSION_VARIABLE_IN_BINLOG);
171
static sys_var_character_set_sv sys_character_set_results(&vars, "character_set_results",
172
&SV::character_set_results,
173
&default_charset_info, true);
174
static sys_var_character_set_sv sys_character_set_filesystem(&vars, "character_set_filesystem",
175
&SV::character_set_filesystem,
176
&character_set_filesystem);
177
static sys_var_thd_ulong sys_completion_type(&vars, "completion_type",
178
&SV::completion_type,
179
check_completion_type,
180
fix_completion_type);
181
static sys_var_collation_sv
182
sys_collation_connection(&vars, "collation_connection",
183
&SV::collation_connection, &default_charset_info,
184
sys_var::SESSION_VARIABLE_IN_BINLOG);
185
static sys_var_collation_sv
186
sys_collation_database(&vars, "collation_database", &SV::collation_database,
187
&default_charset_info,
188
sys_var::SESSION_VARIABLE_IN_BINLOG);
189
static sys_var_collation_sv
190
sys_collation_server(&vars, "collation_server", &SV::collation_server,
191
&default_charset_info,
192
sys_var::SESSION_VARIABLE_IN_BINLOG);
193
static sys_var_long_ptr sys_connect_timeout(&vars, "connect_timeout",
195
static sys_var_const_str sys_datadir(&vars, "datadir", mysql_real_data_home);
135
static sys_var_const_str sys_basedir(&vars, "basedir", drizzle_home);
136
static sys_var_session_uint64_t sys_bulk_insert_buff_size(&vars, "bulk_insert_buffer_size",
137
&SV::bulk_insert_buff_size);
138
static sys_var_session_uint32_t sys_completion_type(&vars, "completion_type",
139
&SV::completion_type,
140
check_completion_type,
141
fix_completion_type);
142
static sys_var_collation_sv
143
sys_collation_server(&vars, "collation_server", &SV::collation_server, &default_charset_info);
144
static sys_var_uint32_t_ptr sys_connect_timeout(&vars, "connect_timeout",
146
static sys_var_const_str sys_datadir(&vars, "datadir", drizzle_real_data_home);
196
147
static sys_var_enum sys_delay_key_write(&vars, "delay_key_write",
197
148
&delay_key_write_options,
198
149
&delay_key_write_typelib,
199
150
fix_delay_key_write);
201
static sys_var_long_ptr sys_expire_logs_days(&vars, "expire_logs_days",
203
152
static sys_var_bool_ptr sys_flush(&vars, "flush", &myisam_flush);
204
sys_var_str sys_init_connect(&vars, "init_connect", 0,
205
sys_update_init_connect,
206
sys_default_init_connect,0);
207
sys_var_str sys_init_slave(&vars, "init_slave", 0,
208
sys_update_init_slave,
209
sys_default_init_slave,0);
210
static sys_var_thd_ulong sys_interactive_timeout(&vars, "interactive_timeout",
211
&SV::net_interactive_timeout);
212
static sys_var_thd_ulong sys_join_buffer_size(&vars, "join_buffer_size",
213
&SV::join_buff_size);
153
static sys_var_session_uint64_t sys_join_buffer_size(&vars, "join_buffer_size",
154
&SV::join_buff_size);
214
155
static sys_var_key_buffer_size sys_key_buffer_size(&vars, "key_buffer_size");
215
static sys_var_key_cache_long sys_key_cache_block_size(&vars, "key_cache_block_size",
218
static sys_var_key_cache_long sys_key_cache_division_limit(&vars, "key_cache_division_limit",
220
param_division_limit));
221
static sys_var_key_cache_long sys_key_cache_age_threshold(&vars, "key_cache_age_threshold",
223
param_age_threshold));
224
static sys_var_bool_ptr sys_local_infile(&vars, "local_infile",
226
static sys_var_bool_ptr
227
sys_log_queries_not_using_indexes(&vars, "log_queries_not_using_indexes",
228
&opt_log_queries_not_using_indexes);
229
static sys_var_thd_ulong sys_log_warnings(&vars, "log_warnings", &SV::log_warnings);
230
static sys_var_microseconds sys_var_long_query_time(&vars, "long_query_time",
231
&SV::long_query_time);
232
static sys_var_thd_bool sys_low_priority_updates(&vars, "low_priority_updates",
233
&SV::low_priority_updates,
234
fix_low_priority_updates);
235
#ifndef TO_BE_DELETED /* Alias for the low_priority_updates */
236
static sys_var_thd_bool sys_sql_low_priority_updates(&vars, "sql_low_priority_updates",
237
&SV::low_priority_updates,
238
fix_low_priority_updates);
240
static sys_var_thd_ulong sys_max_allowed_packet(&vars, "max_allowed_packet",
241
&SV::max_allowed_packet);
242
static sys_var_long_ptr sys_max_binlog_cache_size(&vars, "max_binlog_cache_size",
243
&max_binlog_cache_size);
244
static sys_var_long_ptr sys_max_binlog_size(&vars, "max_binlog_size",
246
fix_max_binlog_size);
247
static sys_var_long_ptr sys_max_connections(&vars, "max_connections",
249
fix_max_connections);
250
static sys_var_long_ptr sys_max_connect_errors(&vars, "max_connect_errors",
251
&max_connect_errors);
252
static sys_var_thd_ulong sys_max_error_count(&vars, "max_error_count",
253
&SV::max_error_count);
254
static sys_var_thd_uint64_t sys_max_heap_table_size(&vars, "max_heap_table_size",
255
&SV::max_heap_table_size);
256
static sys_var_thd_ulong sys_pseudo_thread_id(&vars, "pseudo_thread_id",
156
static sys_var_key_cache_uint32_t sys_key_cache_block_size(&vars, "key_cache_block_size",
159
static sys_var_key_cache_uint32_t sys_key_cache_division_limit(&vars, "key_cache_division_limit",
161
param_division_limit));
162
static sys_var_key_cache_uint32_t sys_key_cache_age_threshold(&vars, "key_cache_age_threshold",
164
param_age_threshold));
165
static sys_var_session_uint32_t sys_max_allowed_packet(&vars, "max_allowed_packet",
166
&SV::max_allowed_packet);
167
static sys_var_uint64_t_ptr sys_max_connect_errors(&vars, "max_connect_errors",
168
&max_connect_errors);
169
static sys_var_session_uint64_t sys_max_error_count(&vars, "max_error_count",
170
&SV::max_error_count);
171
static sys_var_session_uint64_t sys_max_heap_table_size(&vars, "max_heap_table_size",
172
&SV::max_heap_table_size);
173
static sys_var_session_uint64_t sys_pseudo_thread_id(&vars, "pseudo_thread_id",
257
174
&SV::pseudo_thread_id,
258
check_pseudo_thread_id, 0,
259
sys_var::SESSION_VARIABLE_IN_BINLOG);
260
static sys_var_thd_ha_rows sys_max_join_size(&vars, "max_join_size",
263
static sys_var_thd_ulong sys_max_seeks_for_key(&vars, "max_seeks_for_key",
264
&SV::max_seeks_for_key);
265
static sys_var_thd_ulong sys_max_length_for_sort_data(&vars, "max_length_for_sort_data",
266
&SV::max_length_for_sort_data);
267
static sys_var_long_ptr sys_max_relay_log_size(&vars, "max_relay_log_size",
269
fix_max_relay_log_size);
270
static sys_var_thd_ulong sys_max_sort_length(&vars, "max_sort_length",
271
&SV::max_sort_length);
272
static sys_var_max_user_conn sys_max_user_connections(&vars, "max_user_connections");
273
static sys_var_thd_ulong sys_max_tmp_tables(&vars, "max_tmp_tables",
274
&SV::max_tmp_tables);
275
static sys_var_long_ptr sys_max_write_lock_count(&vars, "max_write_lock_count",
276
&max_write_lock_count);
277
static sys_var_thd_ulong sys_min_examined_row_limit(&vars, "min_examined_row_limit",
278
&SV::min_examined_row_limit);
279
static sys_var_thd_uint64_t sys_myisam_max_sort_file_size(&vars, "myisam_max_sort_file_size", &SV::myisam_max_sort_file_size, fix_myisam_max_sort_file_size, 1);
280
static sys_var_thd_ulong sys_myisam_repair_threads(&vars, "myisam_repair_threads", &SV::myisam_repair_threads);
281
static sys_var_thd_ulong sys_myisam_sort_buffer_size(&vars, "myisam_sort_buffer_size", &SV::myisam_sort_buff_size);
175
0, check_pseudo_thread_id);
176
static sys_var_session_ha_rows sys_max_join_size(&vars, "max_join_size",
179
static sys_var_session_uint64_t sys_max_seeks_for_key(&vars, "max_seeks_for_key",
180
&SV::max_seeks_for_key);
181
static sys_var_session_uint64_t sys_max_length_for_sort_data(&vars, "max_length_for_sort_data",
182
&SV::max_length_for_sort_data);
183
static sys_var_session_size_t sys_max_sort_length(&vars, "max_sort_length",
184
&SV::max_sort_length);
185
static sys_var_uint64_t_ptr sys_max_write_lock_count(&vars, "max_write_lock_count",
186
&max_write_lock_count);
187
static sys_var_session_uint64_t sys_min_examined_row_limit(&vars, "min_examined_row_limit",
188
&SV::min_examined_row_limit);
283
static sys_var_thd_enum sys_myisam_stats_method(&vars, "myisam_stats_method",
284
&SV::myisam_stats_method,
285
&myisam_stats_method_typelib,
287
static sys_var_thd_ulong sys_net_buffer_length(&vars, "net_buffer_length",
288
&SV::net_buffer_length);
289
static sys_var_thd_ulong sys_net_read_timeout(&vars, "net_read_timeout",
290
&SV::net_read_timeout,
291
0, fix_net_read_timeout);
292
static sys_var_thd_ulong sys_net_write_timeout(&vars, "net_write_timeout",
293
&SV::net_write_timeout,
294
0, fix_net_write_timeout);
295
static sys_var_thd_ulong sys_net_retry_count(&vars, "net_retry_count",
296
&SV::net_retry_count,
297
0, fix_net_retry_count);
298
static sys_var_thd_bool sys_new_mode(&vars, "new", &SV::new_mode);
299
static sys_var_bool_ptr_readonly sys_old_mode(&vars, "old",
300
&global_system_variables.old_mode);
190
static sys_var_session_enum sys_myisam_stats_method(&vars, "myisam_stats_method",
191
&SV::myisam_stats_method,
192
&myisam_stats_method_typelib,
194
static sys_var_session_uint32_t sys_net_buffer_length(&vars, "net_buffer_length",
195
&SV::net_buffer_length);
196
static sys_var_session_uint32_t sys_net_read_timeout(&vars, "net_read_timeout",
197
&SV::net_read_timeout,
198
0, fix_net_read_timeout);
199
static sys_var_session_uint32_t sys_net_write_timeout(&vars, "net_write_timeout",
200
&SV::net_write_timeout,
201
0, fix_net_write_timeout);
202
static sys_var_session_uint32_t sys_net_retry_count(&vars, "net_retry_count",
203
&SV::net_retry_count,
204
0, fix_net_retry_count);
301
205
/* these two cannot be static */
302
sys_var_thd_bool sys_old_alter_table(&vars, "old_alter_table",
303
&SV::old_alter_table);
304
static sys_var_thd_ulong sys_optimizer_prune_level(&vars, "optimizer_prune_level",
305
&SV::optimizer_prune_level);
306
static sys_var_thd_ulong sys_optimizer_search_depth(&vars, "optimizer_search_depth",
307
&SV::optimizer_search_depth);
206
static sys_var_session_bool sys_optimizer_prune_level(&vars, "optimizer_prune_level",
207
&SV::optimizer_prune_level);
208
static sys_var_session_uint32_t sys_optimizer_search_depth(&vars, "optimizer_search_depth",
209
&SV::optimizer_search_depth);
309
const char *optimizer_use_mrr_names[] = {"auto", "force", "disable", NullS};
211
const char *optimizer_use_mrr_names[] = {"auto", "force", "disable", NULL};
310
212
TYPELIB optimizer_use_mrr_typelib= {
311
213
array_elements(optimizer_use_mrr_names) - 1, "",
312
214
optimizer_use_mrr_names, NULL
315
static sys_var_thd_enum sys_optimizer_use_mrr(&vars, "optimizer_use_mrr",
316
&SV::optimizer_use_mrr,
317
&optimizer_use_mrr_typelib,
320
static sys_var_thd_ulong sys_preload_buff_size(&vars, "preload_buffer_size",
321
&SV::preload_buff_size);
322
static sys_var_thd_ulong sys_read_buff_size(&vars, "read_buffer_size",
323
&SV::read_buff_size);
324
static sys_var_opt_readonly sys_readonly(&vars, "read_only", &opt_readonly);
325
static sys_var_thd_ulong sys_read_rnd_buff_size(&vars, "read_rnd_buffer_size",
326
&SV::read_rnd_buff_size);
327
static sys_var_thd_ulong sys_div_precincrement(&vars, "div_precision_increment",
328
&SV::div_precincrement);
329
static sys_var_long_ptr sys_rpl_recovery_rank(&vars, "rpl_recovery_rank",
332
static sys_var_thd_ulong sys_range_alloc_block_size(&vars, "range_alloc_block_size",
333
&SV::range_alloc_block_size);
334
static sys_var_thd_ulong sys_query_alloc_block_size(&vars, "query_alloc_block_size",
335
&SV::query_alloc_block_size,
336
0, fix_thd_mem_root);
337
static sys_var_thd_ulong sys_query_prealloc_size(&vars, "query_prealloc_size",
338
&SV::query_prealloc_size,
339
0, fix_thd_mem_root);
340
static sys_var_readonly sys_tmpdir(&vars, "tmpdir", OPT_GLOBAL, SHOW_CHAR, get_tmpdir);
341
static sys_var_thd_ulong sys_trans_alloc_block_size(&vars, "transaction_alloc_block_size",
342
&SV::trans_alloc_block_size,
343
0, fix_trans_mem_root);
344
static sys_var_thd_ulong sys_trans_prealloc_size(&vars, "transaction_prealloc_size",
345
&SV::trans_prealloc_size,
346
0, fix_trans_mem_root);
348
static sys_var_bool_ptr sys_secure_auth(&vars, "secure_auth", &opt_secure_auth);
217
static sys_var_session_enum sys_optimizer_use_mrr(&vars, "optimizer_use_mrr",
218
&SV::optimizer_use_mrr,
219
&optimizer_use_mrr_typelib,
222
static sys_var_session_uint64_t sys_preload_buff_size(&vars, "preload_buffer_size",
223
&SV::preload_buff_size);
224
static sys_var_session_uint32_t sys_read_buff_size(&vars, "read_buffer_size",
225
&SV::read_buff_size);
226
static sys_var_session_uint32_t sys_read_rnd_buff_size(&vars, "read_rnd_buffer_size",
227
&SV::read_rnd_buff_size);
228
static sys_var_session_uint32_t sys_div_precincrement(&vars, "div_precision_increment",
229
&SV::div_precincrement);
231
static sys_var_session_size_t sys_range_alloc_block_size(&vars, "range_alloc_block_size",
232
&SV::range_alloc_block_size);
233
static sys_var_session_uint32_t sys_query_alloc_block_size(&vars, "query_alloc_block_size",
234
&SV::query_alloc_block_size,
235
false, fix_session_mem_root);
236
static sys_var_session_uint32_t sys_query_prealloc_size(&vars, "query_prealloc_size",
237
&SV::query_prealloc_size,
238
false, fix_session_mem_root);
239
static sys_var_readonly sys_tmpdir(&vars, "tmpdir", OPT_GLOBAL, SHOW_CHAR, get_tmpdir);
240
static sys_var_session_uint32_t sys_trans_alloc_block_size(&vars, "transaction_alloc_block_size",
241
&SV::trans_alloc_block_size,
242
false, fix_trans_mem_root);
243
static sys_var_session_uint32_t sys_trans_prealloc_size(&vars, "transaction_prealloc_size",
244
&SV::trans_prealloc_size,
245
false, fix_trans_mem_root);
349
247
static sys_var_const_str_ptr sys_secure_file_priv(&vars, "secure_file_priv",
350
248
&opt_secure_file_priv);
351
static sys_var_long_ptr sys_server_id(&vars, "server_id", &server_id, fix_server_id);
352
static sys_var_bool_ptr sys_slave_compressed_protocol(&vars, "slave_compressed_protocol",
353
&opt_slave_compressed_protocol);
354
#ifdef HAVE_REPLICATION
355
static sys_var_bool_ptr sys_slave_allow_batching(&vars, "slave_allow_batching",
356
&slave_allow_batching);
357
static sys_var_set_slave_mode slave_exec_mode(&vars,
359
&slave_exec_mode_options,
360
&slave_exec_mode_typelib,
363
static sys_var_long_ptr sys_slow_launch_time(&vars, "slow_launch_time",
365
static sys_var_thd_ulong sys_sort_buffer(&vars, "sort_buffer_size",
368
sql_mode should *not* have binlog_mode=SESSION_VARIABLE_IN_BINLOG:
369
even though it is written to the binlog, the slave ignores the
370
MODE_NO_DIR_IN_CREATE variable, so slave's value differs from
371
master's (see log_event.cc: Query_log_event::do_apply_event()).
373
static sys_var_thd_optimizer_switch sys_optimizer_switch(&vars, "optimizer_switch",
374
&SV::optimizer_switch);
375
static sys_var_const_str sys_ssl_ca(&vars, "ssl_ca", NULL);
376
static sys_var_const_str sys_ssl_capath(&vars, "ssl_capath", NULL);
377
static sys_var_const_str sys_ssl_cert(&vars, "ssl_cert", NULL);
378
static sys_var_const_str sys_ssl_cipher(&vars, "ssl_cipher", NULL);
379
static sys_var_const_str sys_ssl_key(&vars, "ssl_key", NULL);
381
static sys_var_thd_storage_engine sys_storage_engine(&vars, "storage_engine",
383
static sys_var_bool_ptr sys_sync_frm(&vars, "sync_frm", &opt_sync_frm);
249
static sys_var_uint32_t_ptr sys_server_id(&vars, "server_id", &server_id,
252
static sys_var_session_size_t sys_sort_buffer(&vars, "sort_buffer_size",
254
static sys_var_session_optimizer_switch sys_optimizer_switch(&vars, "optimizer_switch",
255
&SV::optimizer_switch);
257
static sys_var_session_storage_engine sys_storage_engine(&vars, "storage_engine",
258
&SV::storage_engine);
384
259
static sys_var_const_str sys_system_time_zone(&vars, "system_time_zone",
385
260
system_time_zone);
386
static sys_var_long_ptr sys_table_def_size(&vars, "table_definition_cache",
261
static sys_var_uint64_t_ptr sys_table_def_size(&vars, "table_definition_cache",
387
262
&table_def_size);
388
static sys_var_long_ptr sys_table_cache_size(&vars, "table_open_cache",
263
static sys_var_uint64_t_ptr sys_table_cache_size(&vars, "table_open_cache",
389
264
&table_cache_size);
390
static sys_var_long_ptr sys_table_lock_wait_timeout(&vars, "table_lock_wait_timeout",
265
static sys_var_uint64_t_ptr sys_table_lock_wait_timeout(&vars, "table_lock_wait_timeout",
391
266
&table_lock_wait_timeout);
392
static sys_var_long_ptr sys_thread_cache_size(&vars, "thread_cache_size",
394
sys_var_long_ptr sys_thread_pool_size(&vars, "thread_pool_size",
396
static sys_var_thd_enum sys_tx_isolation(&vars, "tx_isolation",
398
&tx_isolation_typelib,
401
static sys_var_thd_uint64_t sys_tmp_table_size(&vars, "tmp_table_size",
267
static sys_var_session_enum sys_tx_isolation(&vars, "tx_isolation",
269
&tx_isolation_typelib,
272
static sys_var_session_uint64_t sys_tmp_table_size(&vars, "tmp_table_size",
402
273
&SV::tmp_table_size);
403
274
static sys_var_bool_ptr sys_timed_mutexes(&vars, "timed_mutexes", &timed_mutexes);
404
static sys_var_const_str sys_version(&vars, "version", server_version);
275
static sys_var_const_str sys_version(&vars, "version", VERSION);
405
276
static sys_var_const_str sys_version_comment(&vars, "version_comment",
406
DRIZZLE_COMPILATION_COMMENT);
277
COMPILATION_COMMENT);
407
278
static sys_var_const_str sys_version_compile_machine(&vars, "version_compile_machine",
409
280
static sys_var_const_str sys_version_compile_os(&vars, "version_compile_os",
411
static sys_var_thd_ulong sys_net_wait_timeout(&vars, "wait_timeout",
412
&SV::net_wait_timeout);
282
static sys_var_const_str sys_version_compile_vendor(&vars, "version_compile_vendor",
284
static sys_var_session_uint32_t sys_net_wait_timeout(&vars, "wait_timeout",
285
&SV::net_wait_timeout);
414
287
/* Condition pushdown to storage engine */
415
static sys_var_thd_bool
288
static sys_var_session_bool
416
289
sys_engine_condition_pushdown(&vars, "engine_condition_pushdown",
417
290
&SV::engine_condition_pushdown);
419
/* Time/date/datetime formats */
421
static sys_var_thd_date_time_format sys_time_format(&vars, "time_format",
423
DRIZZLE_TIMESTAMP_TIME);
424
static sys_var_thd_date_time_format sys_date_format(&vars, "date_format",
426
DRIZZLE_TIMESTAMP_DATE);
427
static sys_var_thd_date_time_format sys_datetime_format(&vars, "datetime_format",
428
&SV::datetime_format,
429
DRIZZLE_TIMESTAMP_DATETIME);
431
/* Variables that are bits in THD */
433
sys_var_thd_bit sys_autocommit(&vars, "autocommit", 0,
292
/* Variables that are bits in Session */
294
sys_var_session_bit sys_autocommit(&vars, "autocommit", 0,
434
295
set_option_autocommit,
435
296
OPTION_NOT_AUTOCOMMIT,
437
static sys_var_thd_bit sys_big_tables(&vars, "big_tables", 0,
440
#ifndef TO_BE_DELETED /* Alias for big_tables */
441
static sys_var_thd_bit sys_sql_big_tables(&vars, "sql_big_tables", 0,
445
static sys_var_thd_bit sys_big_selects(&vars, "sql_big_selects", 0,
298
static sys_var_session_bit sys_big_selects(&vars, "sql_big_selects", 0,
447
300
OPTION_BIG_SELECTS);
448
static sys_var_thd_bit sys_log_off(&vars, "sql_log_off",
452
static sys_var_thd_bit sys_log_update(&vars, "sql_log_update",
456
static sys_var_thd_bit sys_log_binlog(&vars, "sql_log_bin",
460
static sys_var_thd_bit sys_sql_warnings(&vars, "sql_warnings", 0,
301
static sys_var_session_bit sys_sql_warnings(&vars, "sql_warnings", 0,
462
303
OPTION_WARNINGS);
463
static sys_var_thd_bit sys_sql_notes(&vars, "sql_notes", 0,
304
static sys_var_session_bit sys_sql_notes(&vars, "sql_notes", 0,
465
306
OPTION_SQL_NOTES);
466
static sys_var_thd_bit sys_auto_is_null(&vars, "sql_auto_is_null", 0,
468
OPTION_AUTO_IS_NULL, 0,
469
sys_var::SESSION_VARIABLE_IN_BINLOG);
470
static sys_var_thd_bit sys_safe_updates(&vars, "sql_safe_updates", 0,
307
static sys_var_session_bit sys_safe_updates(&vars, "sql_safe_updates", 0,
472
309
OPTION_SAFE_UPDATES);
473
static sys_var_thd_bit sys_buffer_results(&vars, "sql_buffer_result", 0,
310
static sys_var_session_bit sys_buffer_results(&vars, "sql_buffer_result", 0,
475
312
OPTION_BUFFER_RESULT);
476
static sys_var_thd_bit sys_quote_show_create(&vars, "sql_quote_show_create", 0,
478
OPTION_QUOTE_SHOW_CREATE);
479
static sys_var_thd_bit sys_foreign_key_checks(&vars, "foreign_key_checks", 0,
313
static sys_var_session_bit sys_foreign_key_checks(&vars, "foreign_key_checks", 0,
481
OPTION_NO_FOREIGN_KEY_CHECKS,
482
1, sys_var::SESSION_VARIABLE_IN_BINLOG);
483
static sys_var_thd_bit sys_unique_checks(&vars, "unique_checks", 0,
315
OPTION_NO_FOREIGN_KEY_CHECKS, 1);
316
static sys_var_session_bit sys_unique_checks(&vars, "unique_checks", 0,
485
OPTION_RELAXED_UNIQUE_CHECKS,
487
sys_var::SESSION_VARIABLE_IN_BINLOG);
318
OPTION_RELAXED_UNIQUE_CHECKS, 1);
488
319
/* Local state variables */
490
static sys_var_thd_ha_rows sys_select_limit(&vars, "sql_select_limit",
321
static sys_var_session_ha_rows sys_select_limit(&vars, "sql_select_limit",
491
322
&SV::select_limit);
492
static sys_var_timestamp sys_timestamp(&vars, "timestamp",
493
sys_var::SESSION_VARIABLE_IN_BINLOG);
323
static sys_var_timestamp sys_timestamp(&vars, "timestamp");
494
324
static sys_var_last_insert_id
495
sys_last_insert_id(&vars, "last_insert_id",
496
sys_var::SESSION_VARIABLE_IN_BINLOG);
325
sys_last_insert_id(&vars, "last_insert_id");
498
327
identity is an alias for last_insert_id(), so that we are compatible
501
static sys_var_last_insert_id
502
sys_identity(&vars, "identity", sys_var::SESSION_VARIABLE_IN_BINLOG);
330
static sys_var_last_insert_id sys_identity(&vars, "identity");
504
static sys_var_thd_lc_time_names
505
sys_lc_time_names(&vars, "lc_time_names", sys_var::SESSION_VARIABLE_IN_BINLOG);
332
static sys_var_session_lc_time_names sys_lc_time_names(&vars, "lc_time_names");
508
insert_id should *not* be marked as written to the binlog (i.e., it
509
should *not* have binlog_status==SESSION_VARIABLE_IN_BINLOG),
510
because we want any statement that refers to insert_id explicitly to
511
be unsafe. (By "explicitly", we mean using @@session.insert_id,
512
whereas insert_id is used "implicitly" when NULL value is inserted
513
into an auto_increment column).
515
335
We want statements referring explicitly to @@session.insert_id to be
516
336
unsafe, because insert_id is modified internally by the slave sql
517
337
thread when NULL values are inserted in an AUTO_INCREMENT column.
1556
my_error(ER_VAR_CANT_BE_READ, MYF(0), name);
1177
my_error(ER_VAR_CANT_BE_READ, MYF(0), name.c_str());
1562
bool sys_var_thd_enum::update(THD *thd, set_var *var)
1183
bool sys_var_session_enum::update(Session *session, set_var *var)
1564
1185
if (var->type == OPT_GLOBAL)
1565
global_system_variables.*offset= var->save_result.ulong_value;
1186
global_system_variables.*offset= var->save_result.uint32_t_value;
1567
thd->variables.*offset= var->save_result.ulong_value;
1188
session->variables.*offset= var->save_result.uint32_t_value;
1572
void sys_var_thd_enum::set_default(THD *thd, enum_var_type type)
1193
void sys_var_session_enum::set_default(Session *session, enum_var_type type)
1574
1195
if (type == OPT_GLOBAL)
1575
global_system_variables.*offset= (ulong) option_limits->def_value;
1196
global_system_variables.*offset= (uint32_t) option_limits->def_value;
1577
thd->variables.*offset= global_system_variables.*offset;
1198
session->variables.*offset= global_system_variables.*offset;
1581
uchar *sys_var_thd_enum::value_ptr(THD *thd, enum_var_type type,
1582
LEX_STRING *base __attribute__((unused)))
1202
unsigned char *sys_var_session_enum::value_ptr(Session *session,
1584
ulong tmp= ((type == OPT_GLOBAL) ?
1206
uint32_t tmp= ((type == OPT_GLOBAL) ?
1585
1207
global_system_variables.*offset :
1586
thd->variables.*offset);
1587
return (uchar*) enum_names->type_names[tmp];
1590
bool sys_var_thd_bit::check(THD *thd, set_var *var)
1592
return (check_enum(thd, var, &bool_typelib) ||
1593
(check_func && (*check_func)(thd, var)));
1596
bool sys_var_thd_bit::update(THD *thd, set_var *var)
1598
int res= (*update_func)(thd, var);
1208
session->variables.*offset);
1209
return (unsigned char*) enum_names->type_names[tmp];
1212
bool sys_var_session_bit::check(Session *session, set_var *var)
1214
return (check_enum(session, var, &bool_typelib) ||
1215
(check_func && (*check_func)(session, var)));
1218
bool sys_var_session_bit::update(Session *session, set_var *var)
1220
int res= (*update_func)(session, var);
1603
uchar *sys_var_thd_bit::value_ptr(THD *thd,
1604
enum_var_type type __attribute__((unused)),
1605
LEX_STRING *base __attribute__((unused)))
1225
unsigned char *sys_var_session_bit::value_ptr(Session *session, enum_var_type,
1608
1229
If reverse is 0 (default) return 1 if bit is set.
1609
1230
If reverse is 1, return 0 if bit is set
1611
thd->sys_var_tmp.bool_value= ((thd->options & bit_flag) ?
1232
session->sys_var_tmp.bool_value= ((session->options & bit_flag) ?
1612
1233
!reverse : reverse);
1613
return (uchar*) &thd->sys_var_tmp.bool_value;
1617
/** Update a date_time format variable based on given value. */
1619
void sys_var_thd_date_time_format::update2(THD *thd, enum_var_type type,
1620
DATE_TIME_FORMAT *new_value)
1622
DATE_TIME_FORMAT *old;
1624
if (type == OPT_GLOBAL)
1626
pthread_mutex_lock(&LOCK_global_system_variables);
1627
old= (global_system_variables.*offset);
1628
(global_system_variables.*offset)= new_value;
1629
pthread_mutex_unlock(&LOCK_global_system_variables);
1633
old= (thd->variables.*offset);
1634
(thd->variables.*offset)= new_value;
1636
my_free((char*) old, MYF(MY_ALLOW_ZERO_PTR));
1641
bool sys_var_thd_date_time_format::update(THD *thd, set_var *var)
1643
DATE_TIME_FORMAT *new_value;
1644
/* We must make a copy of the last value to get it into normal memory */
1645
new_value= date_time_format_copy((THD*) 0,
1646
var->save_result.date_time_format);
1648
return 1; // Out of memory
1649
update2(thd, var->type, new_value); // Can't fail
1654
bool sys_var_thd_date_time_format::check(THD *thd, set_var *var)
1656
char buff[STRING_BUFFER_USUAL_SIZE];
1657
String str(buff,sizeof(buff), system_charset_info), *res;
1658
DATE_TIME_FORMAT *format;
1660
if (!(res=var->value->val_str(&str)))
1661
res= &my_empty_string;
1663
if (!(format= date_time_format_make(date_time_type,
1664
res->ptr(), res->length())))
1666
my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, res->c_ptr());
1671
We must copy result to thread space to not get a memory leak if
1674
var->save_result.date_time_format= date_time_format_copy(thd, format);
1675
my_free((char*) format, MYF(0));
1676
return var->save_result.date_time_format == 0;
1680
void sys_var_thd_date_time_format::set_default(THD *thd, enum_var_type type)
1682
DATE_TIME_FORMAT *res= 0;
1684
if (type == OPT_GLOBAL)
1687
if ((format= opt_date_time_formats[date_time_type]))
1688
res= date_time_format_make(date_time_type, format, strlen(format));
1692
/* Make copy with malloc */
1693
res= date_time_format_copy((THD *) 0, global_system_variables.*offset);
1696
if (res) // Should always be true
1697
update2(thd, type, res);
1701
uchar *sys_var_thd_date_time_format::value_ptr(THD *thd, enum_var_type type,
1702
LEX_STRING *base __attribute__((unused)))
1704
if (type == OPT_GLOBAL)
1708
We do a copy here just to be sure things will work even if someone
1709
is modifying the original string while the copy is accessed
1710
(Can't happen now in SQL SHOW, but this is a good safety for the future)
1712
res= thd->strmake((global_system_variables.*offset)->format.str,
1713
(global_system_variables.*offset)->format.length);
1714
return (uchar*) res;
1716
return (uchar*) (thd->variables.*offset)->format.str;
1234
return (unsigned char*) &session->sys_var_tmp.bool_value;
2102
bool sys_var_log_state::update(THD *thd, set_var *var)
2105
pthread_mutex_lock(&LOCK_global_system_variables);
2106
if (!var->save_result.ulong_value)
2108
logger.deactivate_log_handler(thd, log_type);
2112
res= logger.activate_log_handler(thd, log_type);
2113
pthread_mutex_unlock(&LOCK_global_system_variables);
2117
void sys_var_log_state::set_default(THD *thd,
2118
enum_var_type type __attribute__((unused)))
2120
pthread_mutex_lock(&LOCK_global_system_variables);
2121
logger.deactivate_log_handler(thd, log_type);
2122
pthread_mutex_unlock(&LOCK_global_system_variables);
2126
static int sys_check_log_path(THD *thd __attribute__((unused)),
2129
char path[FN_REFLEN], buff[FN_REFLEN];
2131
String str(buff, sizeof(buff), system_charset_info), *res;
2132
const char *log_file_str;
2135
if (!(res= var->value->val_str(&str)))
2138
log_file_str= res->c_ptr();
2139
memset(&f_stat, 0, sizeof(struct stat));
2141
path_length= unpack_filename(path, log_file_str);
2145
/* File name is empty. */
2150
if (!stat(path, &f_stat))
2153
A file system object exists. Check if argument is a file and we have
2157
if (!S_ISREG(f_stat.st_mode) ||
2158
!(f_stat.st_mode & S_IWRITE))
2164
/* Get dirname of the file path. */
2165
(void) dirname_part(path, log_file_str, &path_length);
2167
/* Dirname is empty if file path is relative. */
2172
Check if directory exists and we have permission to create file and
2175
if (my_access(path, (F_OK|W_OK)))
2181
my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), var->var->name,
2182
res ? log_file_str : "NULL");
2187
bool update_sys_var_str_path(THD *thd __attribute__((unused)),
2188
sys_var_str *var_str,
2189
set_var *var, const char *log_ext,
2190
bool log_state, uint log_type)
2192
DRIZZLE_QUERY_LOG *file_log;
2193
char buff[FN_REFLEN];
2194
char *res= 0, *old_value=(char *)(var ? var->value->str_value.ptr() : 0);
2196
uint str_length= (var ? var->value->str_value.length() : 0);
2199
case QUERY_LOG_SLOW:
2200
file_log= logger.get_slow_log_file_handler();
2202
case QUERY_LOG_GENERAL:
2203
file_log= logger.get_log_file_handler();
2206
assert(0); // Impossible
2211
old_value= make_default_log_name(buff, log_ext);
2212
str_length= strlen(old_value);
2214
if (!(res= my_strndup(old_value, str_length, MYF(MY_FAE+MY_WME))))
2220
pthread_mutex_lock(&LOCK_global_system_variables);
2221
logger.lock_exclusive();
2223
if (file_log && log_state)
2225
old_value= var_str->value;
2226
var_str->value= res;
2227
var_str->value_length= str_length;
2228
my_free(old_value, MYF(MY_ALLOW_ZERO_PTR));
2229
if (file_log && log_state)
2232
case QUERY_LOG_SLOW:
2233
file_log->open_slow_log(sys_var_slow_log_path.value);
2235
case QUERY_LOG_GENERAL:
2236
file_log->open_query_log(sys_var_general_log_path.value);
2244
pthread_mutex_unlock(&LOCK_global_system_variables);
2251
static bool sys_update_general_log_path(THD *thd, set_var * var)
2253
return update_sys_var_str_path(thd, &sys_var_general_log_path,
2254
var, ".log", opt_log, QUERY_LOG_GENERAL);
2258
static void sys_default_general_log_path(THD *thd,
2259
enum_var_type type __attribute__((unused)))
2261
(void) update_sys_var_str_path(thd, &sys_var_general_log_path,
2262
0, ".log", opt_log, QUERY_LOG_GENERAL);
2266
static bool sys_update_slow_log_path(THD *thd, set_var * var)
2268
return update_sys_var_str_path(thd, &sys_var_slow_log_path,
2269
var, "-slow.log", opt_slow_log,
2274
static void sys_default_slow_log_path(THD *thd,
2275
enum_var_type type __attribute__((unused)))
2277
(void) update_sys_var_str_path(thd, &sys_var_slow_log_path,
2278
0, "-slow.log", opt_slow_log,
2283
bool sys_var_log_output::update(THD *thd __attribute__((unused)),
2286
pthread_mutex_lock(&LOCK_global_system_variables);
2287
logger.lock_exclusive();
2288
logger.init_slow_log(var->save_result.ulong_value);
2289
logger.init_general_log(var->save_result.ulong_value);
2290
*value= var->save_result.ulong_value;
2292
pthread_mutex_unlock(&LOCK_global_system_variables);
2297
void sys_var_log_output::set_default(THD *thd __attribute__((unused)),
2298
enum_var_type type __attribute__((unused)))
2300
pthread_mutex_lock(&LOCK_global_system_variables);
2301
logger.lock_exclusive();
2302
logger.init_slow_log(LOG_FILE);
2303
logger.init_general_log(LOG_FILE);
2306
pthread_mutex_unlock(&LOCK_global_system_variables);
2310
uchar *sys_var_log_output::value_ptr(THD *thd,
2311
enum_var_type type __attribute__((unused)),
2312
LEX_STRING *base __attribute__((unused)))
2315
String tmp(buff, sizeof(buff), &my_charset_latin1);
2320
for (uint i= 0; val; val>>= 1, i++)
2324
tmp.append(log_output_typelib.type_names[i],
2325
log_output_typelib.type_lengths[i]);
2330
if ((length= tmp.length()))
2332
return (uchar*) thd->strmake(tmp.ptr(), length);
2336
/*****************************************************************************
2337
Functions to handle SET NAMES and SET CHARACTER SET
2338
*****************************************************************************/
2340
int set_var_collation_client::check(THD *thd __attribute__((unused)))
2342
/* Currently, UCS-2 cannot be used as a client character set */
2343
if (character_set_client->mbminlen > 1)
2345
my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), "character_set_client",
2346
character_set_client->csname);
2352
int set_var_collation_client::update(THD *thd)
2354
thd->variables.character_set_client= character_set_client;
2355
thd->variables.character_set_results= character_set_results;
2356
thd->variables.collation_connection= collation_connection;
2357
thd->update_charset();
2358
thd->protocol_text.init(thd);
2362
1478
/****************************************************************************/
2364
bool sys_var_timestamp::update(THD *thd, set_var *var)
1480
bool sys_var_timestamp::update(Session *session, set_var *var)
2366
thd->set_time((time_t) var->save_result.uint64_t_value);
1482
session->set_time((time_t) var->save_result.uint64_t_value);
2371
void sys_var_timestamp::set_default(THD *thd,
2372
enum_var_type type __attribute__((unused)))
2378
uchar *sys_var_timestamp::value_ptr(THD *thd,
2379
enum_var_type type __attribute__((unused)),
2380
LEX_STRING *base __attribute__((unused)))
2382
thd->sys_var_tmp.long_value= (long) thd->start_time;
2383
return (uchar*) &thd->sys_var_tmp.long_value;
2387
bool sys_var_last_insert_id::update(THD *thd, set_var *var)
2389
thd->first_successful_insert_id_in_prev_stmt=
1487
void sys_var_timestamp::set_default(Session *session, enum_var_type)
1489
session->user_time=0;
1493
unsigned char *sys_var_timestamp::value_ptr(Session *session, enum_var_type,
1496
session->sys_var_tmp.int32_t_value= (int32_t) session->start_time;
1497
return (unsigned char*) &session->sys_var_tmp.int32_t_value;
1501
bool sys_var_last_insert_id::update(Session *session, set_var *var)
1503
session->first_successful_insert_id_in_prev_stmt=
2390
1504
var->save_result.uint64_t_value;
2395
uchar *sys_var_last_insert_id::value_ptr(THD *thd,
2396
enum_var_type type __attribute__((unused)),
2397
LEX_STRING *base __attribute__((unused)))
1509
unsigned char *sys_var_last_insert_id::value_ptr(Session *session,
2400
1514
this tmp var makes it robust againt change of type of
2401
1515
read_first_successful_insert_id_in_prev_stmt().
2403
thd->sys_var_tmp.uint64_t_value=
2404
thd->read_first_successful_insert_id_in_prev_stmt();
2405
return (uchar*) &thd->sys_var_tmp.uint64_t_value;
2409
bool sys_var_insert_id::update(THD *thd, set_var *var)
2411
thd->force_one_auto_inc_interval(var->save_result.uint64_t_value);
2416
uchar *sys_var_insert_id::value_ptr(THD *thd,
2417
enum_var_type type __attribute__((unused)),
2418
LEX_STRING *base __attribute__((unused)))
2420
thd->sys_var_tmp.uint64_t_value=
2421
thd->auto_inc_intervals_forced.minimum();
2422
return (uchar*) &thd->sys_var_tmp.uint64_t_value;
2426
bool sys_var_rand_seed1::update(THD *thd, set_var *var)
2428
thd->rand.seed1= (ulong) var->save_result.uint64_t_value;
2432
bool sys_var_rand_seed2::update(THD *thd, set_var *var)
2434
thd->rand.seed2= (ulong) var->save_result.uint64_t_value;
2439
bool sys_var_thd_time_zone::check(THD *thd, set_var *var)
1517
session->sys_var_tmp.uint64_t_value=
1518
session->read_first_successful_insert_id_in_prev_stmt();
1519
return (unsigned char*) &session->sys_var_tmp.uint64_t_value;
1523
bool sys_var_session_time_zone::check(Session *session, set_var *var)
2441
1525
char buff[MAX_TIME_ZONE_NAME_LENGTH];
2442
String str(buff, sizeof(buff), &my_charset_latin1);
1526
String str(buff, sizeof(buff), &my_charset_utf8_general_ci);
2443
1527
String *res= var->value->val_str(&str);
2445
if (!(var->save_result.time_zone= my_tz_find(thd, res)))
1529
if (!(var->save_result.time_zone= my_tz_find(session, res)))
2447
1531
my_error(ER_UNKNOWN_TIME_ZONE, MYF(0), res ? res->c_ptr() : "NULL");