97
97
static int check_log_update(THD *thd, set_var *var);
98
98
static bool set_log_update(THD *thd, set_var *var);
99
99
static int check_pseudo_thread_id(THD *thd, set_var *var);
100
void fix_binlog_format_after_update(THD *thd, enum_var_type type);
101
100
static void fix_low_priority_updates(THD *thd, enum_var_type type);
102
101
static int check_tx_isolation(THD *thd, set_var *var);
103
102
static void fix_tx_isolation(THD *thd, enum_var_type type);
709
static bool sys_update_init_connect(THD *thd, set_var *var)
708
static bool sys_update_init_connect(THD *thd __attribute__((__unused__)), set_var *var)
711
710
return update_sys_var_str(&sys_init_connect, &LOCK_sys_init_connect, var);
715
static void sys_default_init_connect(THD* thd, enum_var_type type)
714
static void sys_default_init_connect(THD* thd __attribute__((__unused__)),
715
enum_var_type type __attribute__((__unused__)))
717
717
update_sys_var_str(&sys_init_connect, &LOCK_sys_init_connect, 0);
721
static bool sys_update_init_slave(THD *thd, set_var *var)
721
static bool sys_update_init_slave(THD *thd __attribute__((__unused__)),
723
724
return update_sys_var_str(&sys_init_slave, &LOCK_sys_init_slave, var);
727
static void sys_default_init_slave(THD* thd, enum_var_type type)
728
static void sys_default_init_slave(THD* thd __attribute__((__unused__)),
729
enum_var_type type __attribute__((__unused__)))
729
731
update_sys_var_str(&sys_init_slave, &LOCK_sys_init_slave, 0);
798
801
static void fix_completion_type(THD *thd __attribute__((unused)),
799
802
enum_var_type type __attribute__((unused))) {}
801
static int check_completion_type(THD *thd, set_var *var)
804
static int check_completion_type(THD *thd __attribute__((__unused__)),
803
807
longlong val= var->value->val_int();
804
808
if (val < 0 || val > 2)
847
851
#endif /* HAVE_REPLICATION */
850
extern void fix_delay_key_write(THD *thd, enum_var_type type)
854
extern void fix_delay_key_write(THD *thd __attribute__((__unused__)),
855
enum_var_type type __attribute__((__unused__)))
852
857
switch ((enum_delay_key_write) delay_key_write_options) {
853
858
case DELAY_KEY_WRITE_NONE:
866
bool sys_var_set::update(THD *thd, set_var *var)
871
bool sys_var_set::update(THD *thd __attribute__((__unused__)),
868
874
*value= var->save_result.ulong_value;
872
uchar *sys_var_set::value_ptr(THD *thd, enum_var_type type,
878
uchar *sys_var_set::value_ptr(THD *thd,
879
enum_var_type type __attribute__((__unused__)),
880
LEX_STRING *base __attribute__((__unused__)))
876
883
String tmp(buff, sizeof(buff), &my_charset_latin1);
893
900
return (uchar*) thd->strmake(tmp.ptr(), length);
896
void sys_var_set_slave_mode::set_default(THD *thd, enum_var_type type)
903
void sys_var_set_slave_mode::set_default(THD *thd __attribute__((__unused__)),
904
enum_var_type type __attribute__((__unused__)))
898
906
slave_exec_mode_options= 0;
899
907
bit_do_set(slave_exec_mode_options, SLAVE_EXEC_MODE_STRICT);
975
void fix_binlog_format_after_update(THD *thd, enum_var_type type)
983
void fix_binlog_format_after_update(THD *thd,
984
enum_var_type type __attribute__((__unused__)))
977
986
thd->reset_current_stmt_binlog_row_based();
981
static void fix_max_binlog_size(THD *thd, enum_var_type type)
990
static void fix_max_binlog_size(THD *thd __attribute__((__unused__)),
991
enum_var_type type __attribute__((__unused__)))
983
993
DBUG_ENTER("fix_max_binlog_size");
984
994
DBUG_PRINT("info",("max_binlog_size=%lu max_relay_log_size=%lu",
991
1001
DBUG_VOID_RETURN;
994
static void fix_max_relay_log_size(THD *thd, enum_var_type type)
1004
static void fix_max_relay_log_size(THD *thd __attribute__((__unused__)),
1005
enum_var_type type __attribute__((__unused__)))
996
1007
DBUG_ENTER("fix_max_relay_log_size");
997
1008
DBUG_PRINT("info",("max_binlog_size=%lu max_relay_log_size=%lu",
1140
void sys_var_ulonglong_ptr::set_default(THD *thd, enum_var_type type)
1153
void sys_var_ulonglong_ptr::set_default(THD *thd __attribute__((__unused__)),
1154
enum_var_type type __attribute__((__unused__)))
1142
1156
my_bool not_used;
1143
1157
pthread_mutex_lock(&LOCK_global_system_variables);
1150
bool sys_var_bool_ptr::update(THD *thd, set_var *var)
1164
bool sys_var_bool_ptr::update(THD *thd __attribute__((__unused__)), set_var *var)
1152
1166
*value= (my_bool) var->save_result.ulong_value;
1157
void sys_var_bool_ptr::set_default(THD *thd, enum_var_type type)
1171
void sys_var_bool_ptr::set_default(THD *thd __attribute__((__unused__)), enum_var_type type __attribute__((__unused__)))
1159
1173
*value= (my_bool) option_limits->def_value;
1163
bool sys_var_enum::update(THD *thd, set_var *var)
1177
bool sys_var_enum::update(THD *thd __attribute__((__unused__)), set_var *var)
1165
1179
*value= (uint) var->save_result.ulong_value;
1170
uchar *sys_var_enum::value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
1184
uchar *sys_var_enum::value_ptr(THD *thd __attribute__((__unused__)),
1185
enum_var_type type __attribute__((__unused__)),
1186
LEX_STRING *base __attribute__((__unused__)))
1172
1188
return (uchar*) enum_names->type_names[*value];
1176
uchar *sys_var_enum_const::value_ptr(THD *thd, enum_var_type type,
1192
uchar *sys_var_enum_const::value_ptr(THD *thd __attribute__((__unused__)),
1193
enum_var_type type __attribute__((__unused__)),
1194
LEX_STRING *base __attribute__((__unused__)))
1179
1196
return (uchar*) enum_names->type_names[global_system_variables.*offset];
1188
1205
bool sys_var_thd_ulong::update(THD *thd, set_var *var)
1190
1207
ulonglong tmp= var->save_result.ulonglong_value;
1192
1209
/* Don't use bigger value than given with --maximum-variable-name=.. */
1193
1210
if ((ulong) tmp > max_system_variables.*offset)
1195
1212
throw_bounds_warning(thd, TRUE, TRUE, name, (longlong) tmp);
1196
1213
tmp= max_system_variables.*offset;
1199
1216
if (option_limits)
1200
1217
tmp= (ulong) fix_unsigned(thd, tmp, option_limits);
1201
1218
#if SIZEOF_LONG < SIZEOF_LONG_LONG
1205
1222
throw_bounds_warning(thd, TRUE, TRUE, name, (longlong) var->save_result.ulonglong_value);
1209
1226
if (var->type == OPT_GLOBAL)
1210
global_system_variables.*offset= (ulong) tmp;
1212
thd->variables.*offset= (ulong) tmp;
1218
void sys_var_thd_ulong::set_default(THD *thd, enum_var_type type)
1220
if (type == OPT_GLOBAL)
1223
/* We will not come here if option_limits is not set */
1224
global_system_variables.*offset=
1225
(ulong) getopt_ull_limit_value((ulong) option_limits->def_value,
1226
option_limits, ¬_used);
1229
thd->variables.*offset= global_system_variables.*offset;
1227
global_system_variables.*offset= (ulong) tmp;
1229
thd->variables.*offset= (ulong) tmp;
1235
void sys_var_thd_ulong::set_default(THD *thd, enum_var_type type)
1237
if (type == OPT_GLOBAL)
1240
/* We will not come here if option_limits is not set */
1241
global_system_variables.*offset=
1242
(ulong) getopt_ull_limit_value((ulong) option_limits->def_value,
1243
option_limits, ¬_used);
1246
thd->variables.*offset= global_system_variables.*offset;
1233
1250
uchar *sys_var_thd_ulong::value_ptr(THD *thd, enum_var_type type,
1251
LEX_STRING *base __attribute__((__unused__)))
1236
1253
if (type == OPT_GLOBAL)
1237
1254
return (uchar*) &(global_system_variables.*offset);
1370
bool sys_var::check_enum(THD *thd, set_var *var, const TYPELIB *enum_names)
1387
bool sys_var::check_enum(THD *thd __attribute__((__unused__)),
1388
set_var *var, const TYPELIB *enum_names)
1372
1390
char buff[STRING_BUFFER_USUAL_SIZE];
1373
1391
const char *value;
1406
bool sys_var::check_set(THD *thd, set_var *var, TYPELIB *enum_names)
1424
bool sys_var::check_set(THD *thd __attribute__((__unused__)),
1425
set_var *var, TYPELIB *enum_names)
1409
1428
char buff[STRING_BUFFER_USUAL_SIZE], *error= 0;
1626
uchar *sys_var_thd_bit::value_ptr(THD *thd, enum_var_type type,
1645
uchar *sys_var_thd_bit::value_ptr(THD *thd,
1646
enum_var_type type __attribute__((__unused__)),
1647
LEX_STRING *base __attribute__((__unused__)))
1630
1650
If reverse is 0 (default) return 1 if bit is set.
1860
1882
uchar *sys_var_character_set::value_ptr(THD *thd, enum_var_type type,
1883
LEX_STRING *base __attribute__((__unused__)))
1863
1885
CHARSET_INFO *cs= ci_ptr(thd,type)[0];
1864
1886
return cs ? (uchar*) cs->csname : (uchar*) NULL;
1972
uchar *sys_var_key_cache_param::value_ptr(THD *thd, enum_var_type type,
1994
uchar *sys_var_key_cache_param::value_ptr(THD *thd __attribute__((__unused__)),
1995
enum_var_type type __attribute__((__unused__)),
1996
LEX_STRING *base __attribute__((__unused__)))
1975
1998
KEY_CACHE *key_cache= get_key_cache(base);
1976
1999
if (!key_cache)
2139
void sys_var_log_state::set_default(THD *thd, enum_var_type type)
2162
void sys_var_log_state::set_default(THD *thd,
2163
enum_var_type type __attribute__((__unused__)))
2141
2165
pthread_mutex_lock(&LOCK_global_system_variables);
2142
2166
logger.deactivate_log_handler(thd, log_type);
2207
bool update_sys_var_str_path(THD *thd, sys_var_str *var_str,
2208
set_var *var, const char *log_ext,
2209
bool log_state, uint log_type)
2232
bool update_sys_var_str_path(THD *thd __attribute__((__unused__)),
2233
sys_var_str *var_str,
2234
set_var *var, const char *log_ext,
2235
bool log_state, uint log_type)
2211
2237
MYSQL_QUERY_LOG *file_log;
2212
2238
char buff[FN_REFLEN];
2270
2296
static bool sys_update_general_log_path(THD *thd, set_var * var)
2272
return update_sys_var_str_path(thd, &sys_var_general_log_path,
2273
var, ".log", opt_log, QUERY_LOG_GENERAL);
2298
return update_sys_var_str_path(thd, &sys_var_general_log_path,
2299
var, ".log", opt_log, QUERY_LOG_GENERAL);
2277
static void sys_default_general_log_path(THD *thd, enum_var_type type)
2303
static void sys_default_general_log_path(THD *thd,
2304
enum_var_type type __attribute__((__unused__)))
2279
2306
(void) update_sys_var_str_path(thd, &sys_var_general_log_path,
2280
0, ".log", opt_log, QUERY_LOG_GENERAL);
2307
0, ".log", opt_log, QUERY_LOG_GENERAL);
2284
2311
static bool sys_update_slow_log_path(THD *thd, set_var * var)
2286
2313
return update_sys_var_str_path(thd, &sys_var_slow_log_path,
2287
var, "-slow.log", opt_slow_log,
2314
var, "-slow.log", opt_slow_log,
2288
2315
QUERY_LOG_SLOW);
2292
static void sys_default_slow_log_path(THD *thd, enum_var_type type)
2319
static void sys_default_slow_log_path(THD *thd,
2320
enum_var_type type __attribute__((__unused__)))
2294
2322
(void) update_sys_var_str_path(thd, &sys_var_slow_log_path,
2295
0, "-slow.log", opt_slow_log,
2323
0, "-slow.log", opt_slow_log,
2296
2324
QUERY_LOG_SLOW);
2300
bool sys_var_log_output::update(THD *thd, set_var *var)
2328
bool sys_var_log_output::update(THD *thd __attribute__((__unused__)),
2302
2331
pthread_mutex_lock(&LOCK_global_system_variables);
2303
2332
logger.lock_exclusive();
2325
uchar *sys_var_log_output::value_ptr(THD *thd, enum_var_type type,
2355
uchar *sys_var_log_output::value_ptr(THD *thd,
2356
enum_var_type type __attribute__((__unused__)),
2357
LEX_STRING *base __attribute__((__unused__)))
2328
2359
char buff[256];
2329
2360
String tmp(buff, sizeof(buff), &my_charset_latin1);
2351
2382
Functions to handle SET NAMES and SET CHARACTER SET
2352
2383
*****************************************************************************/
2354
int set_var_collation_client::check(THD *thd)
2385
int set_var_collation_client::check(THD *thd __attribute__((__unused__)))
2356
2387
/* Currently, UCS-2 cannot be used as a client character set */
2357
2388
if (character_set_client->mbminlen > 1)
2385
void sys_var_timestamp::set_default(THD *thd, enum_var_type type)
2416
void sys_var_timestamp::set_default(THD *thd,
2417
enum_var_type type __attribute__((__unused__)))
2387
2419
thd->user_time=0;
2391
uchar *sys_var_timestamp::value_ptr(THD *thd, enum_var_type type,
2423
uchar *sys_var_timestamp::value_ptr(THD *thd,
2424
enum_var_type type __attribute__((__unused__)),
2425
LEX_STRING *base __attribute__((__unused__)))
2394
2427
thd->sys_var_tmp.long_value= (long) thd->start_time;
2395
2428
return (uchar*) &thd->sys_var_tmp.long_value;
2399
2432
bool sys_var_last_insert_id::update(THD *thd, set_var *var)
2401
thd->first_successful_insert_id_in_prev_stmt=
2434
thd->first_successful_insert_id_in_prev_stmt=
2402
2435
var->save_result.ulonglong_value;
2407
uchar *sys_var_last_insert_id::value_ptr(THD *thd, enum_var_type type,
2440
uchar *sys_var_last_insert_id::value_ptr(THD *thd,
2441
enum_var_type type __attribute__((__unused__)),
2442
LEX_STRING *base __attribute__((__unused__)))
2411
this tmp var makes it robust againt change of type of
2445
this tmp var makes it robust againt change of type of
2412
2446
read_first_successful_insert_id_in_prev_stmt().
2414
2448
thd->sys_var_tmp.ulonglong_value=
2427
uchar *sys_var_insert_id::value_ptr(THD *thd, enum_var_type type,
2461
uchar *sys_var_insert_id::value_ptr(THD *thd,
2462
enum_var_type type __attribute__((__unused__)),
2463
LEX_STRING *base __attribute__((__unused__)))
2430
thd->sys_var_tmp.ulonglong_value=
2465
thd->sys_var_tmp.ulonglong_value=
2431
2466
thd->auto_inc_intervals_forced.minimum();
2432
2467
return (uchar*) &thd->sys_var_tmp.ulonglong_value;
2552
void sys_var_max_user_conn::set_default(THD *thd, enum_var_type type)
2588
void sys_var_max_user_conn::set_default(THD *thd __attribute__((__unused__)),
2589
enum_var_type type __attribute__((__unused__)))
2554
2591
DBUG_ASSERT(type == OPT_GLOBAL);
2555
2592
pthread_mutex_lock(&LOCK_global_system_variables);
2618
uchar *sys_var_thd_lc_time_names::value_ptr(THD *thd, enum_var_type type,
2656
uchar *sys_var_thd_lc_time_names::value_ptr(THD *thd,
2658
LEX_STRING *base __attribute__((__unused__)))
2621
2660
return type == OPT_GLOBAL ?
2622
2661
(uchar *) global_system_variables.lc_time_names->name :
2735
static int check_log_update(THD *thd, set_var *var)
2774
static int check_log_update(THD *thd __attribute__((__unused__)),
2775
set_var *var __attribute__((__unused__)))
2740
static bool set_log_update(THD *thd, set_var *var)
2780
static bool set_log_update(THD *thd __attribute__((__unused__)),
2781
set_var *var __attribute__((__unused__)))
2743
2784
The update log is not supported anymore since 5.0.
3467
void free_key_cache(const char *name, KEY_CACHE *key_cache)
3509
void free_key_cache(const char *name __attribute__((__unused__)),
3510
KEY_CACHE *key_cache)
3469
3512
ha_end_key_cache(key_cache);
3470
3513
my_free((char*) key_cache, MYF(0));