61
61
#include "drizzled/transaction_services.h"
62
62
#include "drizzled/constrained_value.h"
63
63
#include "drizzled/visibility.h"
64
#include "drizzled/typelib.h"
64
65
#include "drizzled/plugin/storage_engine.h"
219
220
static sys_var_session_storage_engine sys_storage_engine("storage_engine",
220
221
&drizzle_system_variables::storage_engine);
221
static sys_var_const_str sys_system_time_zone("system_time_zone",
223
222
static sys_var_size_t_ptr sys_table_def_size("table_definition_cache",
224
223
&table_def_size);
225
224
static sys_var_uint64_t_ptr sys_table_cache_size("table_open_cache",
308
307
sys_var_session_uint64_t sys_group_concat_max_len("group_concat_max_len",
309
308
&drizzle_system_variables::group_concat_max_len);
311
sys_var_session_time_zone sys_time_zone("time_zone");
313
310
/* Global read-only variable containing hostname */
314
311
static sys_var_const_str sys_hostname("hostname", glob_hostname);
1161
1158
return (unsigned char*) &session->sys_var_tmp.uint64_t_value;
1165
bool sys_var_session_time_zone::update(Session *session, set_var *var)
1167
char buff[MAX_TIME_ZONE_NAME_LENGTH];
1168
String str(buff, sizeof(buff), &my_charset_utf8_general_ci);
1169
String *res= var->value->val_str(&str);
1171
Time_zone *tmp= my_tz_find(session, res);
1174
boost::throw_exception(invalid_option_value(var->var->getName()) << invalid_value(std::string(res ? res->c_ptr() : "NULL")));
1177
/* We are using Time_zone object found during check() phase. */
1178
if (var->type == OPT_GLOBAL)
1180
boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
1181
global_system_variables.time_zone= tmp;
1185
session->variables.time_zone= tmp;
1192
unsigned char *sys_var_session_time_zone::value_ptr(Session *session,
1197
We can use ptr() instead of c_ptr() here because String contaning
1198
time zone name is guaranteed to be zero ended.
1200
if (type == OPT_GLOBAL)
1201
return (unsigned char *)(global_system_variables.time_zone->get_name()->ptr());
1205
This is an ugly fix for replication: we don't replicate properly queries
1206
invoking system variables' values to update tables; but
1207
CONVERT_TZ(,,@@session.time_zone) is so popular that we make it
1208
replicable (i.e. we tell the binlog code to store the session
1209
timezone). If it's the global value which was used we can't replicate
1210
(binlog code stores session value only).
1212
return (unsigned char *)(session->variables.time_zone->get_name()->ptr());
1217
void sys_var_session_time_zone::set_default(Session *session, sql_var_t type)
1219
boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
1220
if (type == OPT_GLOBAL)
1222
if (default_tz_name)
1224
String str(default_tz_name, &my_charset_utf8_general_ci);
1226
We are guaranteed to find this time zone since its existence
1227
is checked during start-up.
1229
global_system_variables.time_zone= my_tz_find(session, &str);
1232
global_system_variables.time_zone= my_tz_SYSTEM;
1235
session->variables.time_zone= global_system_variables.time_zone;
1240
1161
bool sys_var_session_lc_time_names::update(Session *session, set_var *var)
1242
1163
MY_LOCALE *locale_match;
1609
1530
add_sys_var_to_list(&sys_sql_notes, my_long_options);
1610
1531
add_sys_var_to_list(&sys_sql_warnings, my_long_options);
1611
1532
add_sys_var_to_list(&sys_storage_engine, my_long_options);
1612
add_sys_var_to_list(&sys_system_time_zone, my_long_options);
1613
1533
add_sys_var_to_list(&sys_table_cache_size, my_long_options);
1614
1534
add_sys_var_to_list(&sys_table_def_size, my_long_options);
1615
1535
add_sys_var_to_list(&sys_table_lock_wait_timeout, my_long_options);
1616
1536
add_sys_var_to_list(&sys_thread_stack_size, my_long_options);
1617
add_sys_var_to_list(&sys_time_zone, my_long_options);
1618
1537
add_sys_var_to_list(&sys_timed_mutexes, my_long_options);
1619
1538
add_sys_var_to_list(&sys_timestamp, my_long_options);
1620
1539
add_sys_var_to_list(&sys_tmp_table_size, my_long_options);