~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/set_var.cc

  • Committer: Monty Taylor
  • Date: 2008-07-28 02:47:38 UTC
  • mto: (212.5.1 codestyle)
  • mto: This revision was merged to the branch mainline in revision 219.
  • Revision ID: monty@inaugust.com-20080728024738-366ikqnoqv7d8g6l
Fixed the includes in places to make the myisam header file move work.

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
    them you must first assign a value to them (in specific ::check() for
47
47
    example).
48
48
*/
49
 
#include <drizzled/server_includes.h>
 
49
 
 
50
#ifdef USE_PRAGMA_IMPLEMENTATION
 
51
#pragma implementation                          // gcc: Class implementation
 
52
#endif
 
53
 
 
54
#include "mysql_priv.h"
 
55
#include "slave.h"
50
56
#include "rpl_mi.h"
51
 
#include <mysys/my_getopt.h>
52
 
#include <mysys/thr_alarm.h>
 
57
#include <my_getopt.h>
 
58
#include <thr_alarm.h>
53
59
#include <storage/myisam/myisam.h>
54
 
#include <drizzled/drizzled_error_messages.h>
55
 
#include <libdrizzle/gettext.h>
 
60
#include <my_dir.h>
56
61
 
57
 
extern const CHARSET_INFO *character_set_filesystem;
 
62
extern CHARSET_INFO *character_set_filesystem;
58
63
 
59
64
 
60
65
static DYNAMIC_ARRAY fixed_show_vars;
61
66
static HASH system_variable_hash;
62
67
 
63
 
const char *bool_type_names[]= { "OFF", "ON", NULL };
 
68
const char *bool_type_names[]= { "OFF", "ON", NullS };
64
69
TYPELIB bool_typelib=
65
70
{
66
71
  array_elements(bool_type_names)-1, "", bool_type_names, NULL
67
72
};
68
73
 
69
 
const char *delay_key_write_type_names[]= { "OFF", "ON", "ALL", NULL };
 
74
const char *delay_key_write_type_names[]= { "OFF", "ON", "ALL", NullS };
70
75
TYPELIB delay_key_write_typelib=
71
76
{
72
77
  array_elements(delay_key_write_type_names)-1, "",
74
79
};
75
80
 
76
81
const char *slave_exec_mode_names[]=
77
 
{ "STRICT", "IDEMPOTENT", NULL };
 
82
{ "STRICT", "IDEMPOTENT", NullS };
78
83
static const unsigned int slave_exec_mode_names_len[]=
79
84
{ sizeof("STRICT") - 1, sizeof("IDEMPOTENT") - 1, 0 };
80
85
TYPELIB slave_exec_mode_typelib=
90
95
static bool set_option_bit(THD *thd, set_var *var);
91
96
static bool set_option_autocommit(THD *thd, set_var *var);
92
97
static int  check_log_update(THD *thd, set_var *var);
 
98
static bool set_log_update(THD *thd, set_var *var);
93
99
static int  check_pseudo_thread_id(THD *thd, set_var *var);
94
100
static void fix_low_priority_updates(THD *thd, enum_var_type type);
95
101
static int check_tx_isolation(THD *thd, set_var *var);
111
117
static bool get_unsigned(THD *thd, set_var *var);
112
118
bool throw_bounds_warning(THD *thd, bool fixed, bool unsignd,
113
119
                          const char *name, int64_t val);
114
 
static KEY_CACHE *create_key_cache(const char *name, uint32_t length);
115
 
static unsigned char *get_error_count(THD *thd);
116
 
static unsigned char *get_warning_count(THD *thd);
117
 
static unsigned char *get_tmpdir(THD *thd);
 
120
static KEY_CACHE *create_key_cache(const char *name, uint length);
 
121
static uchar *get_error_count(THD *thd);
 
122
static uchar *get_warning_count(THD *thd);
 
123
static uchar *get_tmpdir(THD *thd);
 
124
static int  sys_check_log_path(THD *thd,  set_var *var);
 
125
static bool sys_update_general_log_path(THD *thd, set_var * var);
 
126
static void sys_default_general_log_path(THD *thd, enum_var_type type);
 
127
static bool sys_update_slow_log_path(THD *thd, set_var * var);
 
128
static void sys_default_slow_log_path(THD *thd, enum_var_type type);
118
129
 
119
130
/*
120
131
  Variable definition list
144
155
                                            &SV::binlog_format);
145
156
static sys_var_thd_ulong        sys_bulk_insert_buff_size(&vars, "bulk_insert_buffer_size",
146
157
                                                  &SV::bulk_insert_buff_size);
 
158
static sys_var_character_set_sv
 
159
sys_character_set_server(&vars, "character_set_server",
 
160
                         &SV::collation_server, &default_charset_info, 0,
 
161
                         sys_var::SESSION_VARIABLE_IN_BINLOG);
 
162
sys_var_const_str       sys_charset_system(&vars, "character_set_system",
 
163
                                           (char *)my_charset_utf8_general_ci.name);
 
164
static sys_var_character_set_database
 
165
sys_character_set_database(&vars, "character_set_database",
 
166
                           sys_var::SESSION_VARIABLE_IN_BINLOG);
 
167
static sys_var_character_set_client
 
168
sys_character_set_client(&vars, "character_set_client",
 
169
                         &SV::character_set_client,
 
170
                         &default_charset_info,
 
171
                         sys_var::SESSION_VARIABLE_IN_BINLOG);
 
172
static sys_var_character_set_sv
 
173
sys_character_set_connection(&vars, "character_set_connection",
 
174
                             &SV::collation_connection,
 
175
                             &default_charset_info, 0,
 
176
                             sys_var::SESSION_VARIABLE_IN_BINLOG);
 
177
static sys_var_character_set_sv sys_character_set_results(&vars, "character_set_results",
 
178
                                        &SV::character_set_results,
 
179
                                        &default_charset_info, true);
 
180
static sys_var_character_set_sv sys_character_set_filesystem(&vars, "character_set_filesystem",
 
181
                                        &SV::character_set_filesystem,
 
182
                                        &character_set_filesystem);
147
183
static sys_var_thd_ulong        sys_completion_type(&vars, "completion_type",
148
184
                                         &SV::completion_type,
149
185
                                         check_completion_type,
160
196
sys_collation_server(&vars, "collation_server", &SV::collation_server,
161
197
                     &default_charset_info,
162
198
                     sys_var::SESSION_VARIABLE_IN_BINLOG);
 
199
static sys_var_long_ptr sys_concurrent_insert(&vars, "concurrent_insert",
 
200
                                              &myisam_concurrent_insert);
163
201
static sys_var_long_ptr sys_connect_timeout(&vars, "connect_timeout",
164
202
                                            &connect_timeout);
165
203
static sys_var_const_str       sys_datadir(&vars, "datadir", mysql_real_data_home);
193
231
                                                              param_age_threshold));
194
232
static sys_var_bool_ptr sys_local_infile(&vars, "local_infile",
195
233
                                         &opt_local_infile);
 
234
static sys_var_bool_ptr
 
235
  sys_log_queries_not_using_indexes(&vars, "log_queries_not_using_indexes",
 
236
                                    &opt_log_queries_not_using_indexes);
 
237
static sys_var_thd_ulong        sys_log_warnings(&vars, "log_warnings", &SV::log_warnings);
 
238
static sys_var_microseconds     sys_var_long_query_time(&vars, "long_query_time",
 
239
                                                        &SV::long_query_time);
196
240
static sys_var_thd_bool sys_low_priority_updates(&vars, "low_priority_updates",
197
241
                                                 &SV::low_priority_updates,
198
242
                                                 fix_low_priority_updates);
240
284
                                                 &max_write_lock_count);
241
285
static sys_var_thd_ulong       sys_min_examined_row_limit(&vars, "min_examined_row_limit",
242
286
                                                          &SV::min_examined_row_limit);
 
287
static sys_var_long_ptr sys_myisam_data_pointer_size(&vars, "myisam_data_pointer_size",
 
288
                                                    &myisam_data_pointer_size);
243
289
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);
244
290
static sys_var_thd_ulong       sys_myisam_repair_threads(&vars, "myisam_repair_threads", &SV::myisam_repair_threads);
245
291
static sys_var_thd_ulong        sys_myisam_sort_buffer_size(&vars, "myisam_sort_buffer_size", &SV::myisam_sort_buff_size);
270
316
static sys_var_thd_ulong        sys_optimizer_search_depth(&vars, "optimizer_search_depth",
271
317
                                                   &SV::optimizer_search_depth);
272
318
 
273
 
const char *optimizer_use_mrr_names[] = {"auto", "force", "disable", NULL};
 
319
const char *optimizer_use_mrr_names[] = {"auto", "force", "disable", NullS};
274
320
TYPELIB optimizer_use_mrr_typelib= {
275
321
  array_elements(optimizer_use_mrr_names) - 1, "",
276
322
  optimizer_use_mrr_names, NULL
290
336
                                               &SV::read_rnd_buff_size);
291
337
static sys_var_thd_ulong        sys_div_precincrement(&vars, "div_precision_increment",
292
338
                                              &SV::div_precincrement);
 
339
static sys_var_long_ptr sys_rpl_recovery_rank(&vars, "rpl_recovery_rank",
 
340
                                              &rpl_recovery_rank);
293
341
 
294
342
static sys_var_thd_ulong        sys_range_alloc_block_size(&vars, "range_alloc_block_size",
295
343
                                                   &SV::range_alloc_block_size);
307
355
                                                &SV::trans_prealloc_size,
308
356
                                                0, fix_trans_mem_root);
309
357
 
 
358
static sys_var_bool_ptr sys_secure_auth(&vars, "secure_auth", &opt_secure_auth);
310
359
static sys_var_const_str_ptr sys_secure_file_priv(&vars, "secure_file_priv",
311
360
                                             &opt_secure_file_priv);
312
361
static sys_var_long_ptr sys_server_id(&vars, "server_id", &server_id, fix_server_id);
313
362
static sys_var_bool_ptr sys_slave_compressed_protocol(&vars, "slave_compressed_protocol",
314
363
                                                      &opt_slave_compressed_protocol);
 
364
#ifdef HAVE_REPLICATION
315
365
static sys_var_bool_ptr         sys_slave_allow_batching(&vars, "slave_allow_batching",
316
366
                                                         &slave_allow_batching);
317
367
static sys_var_set_slave_mode slave_exec_mode(&vars,
319
369
                                              &slave_exec_mode_options,
320
370
                                              &slave_exec_mode_typelib,
321
371
                                              0);
 
372
#endif
322
373
static sys_var_long_ptr sys_slow_launch_time(&vars, "slow_launch_time",
323
374
                                             &slow_launch_time);
324
375
static sys_var_thd_ulong        sys_sort_buffer(&vars, "sort_buffer_size",
331
382
*/
332
383
static sys_var_thd_optimizer_switch   sys_optimizer_switch(&vars, "optimizer_switch",
333
384
                                     &SV::optimizer_switch);
 
385
static sys_var_const_str        sys_ssl_ca(&vars, "ssl_ca", NULL);
 
386
static sys_var_const_str        sys_ssl_capath(&vars, "ssl_capath", NULL);
 
387
static sys_var_const_str        sys_ssl_cert(&vars, "ssl_cert", NULL);
 
388
static sys_var_const_str        sys_ssl_cipher(&vars, "ssl_cipher", NULL);
 
389
static sys_var_const_str        sys_ssl_key(&vars, "ssl_key", NULL);
334
390
 
335
391
static sys_var_thd_storage_engine sys_storage_engine(&vars, "storage_engine",
336
392
                                       &SV::table_plugin);
 
393
static sys_var_bool_ptr sys_sync_frm(&vars, "sync_frm", &opt_sync_frm);
337
394
static sys_var_const_str        sys_system_time_zone(&vars, "system_time_zone",
338
395
                                             system_time_zone);
339
396
static sys_var_long_ptr sys_table_def_size(&vars, "table_definition_cache",
356
413
static sys_var_bool_ptr  sys_timed_mutexes(&vars, "timed_mutexes", &timed_mutexes);
357
414
static sys_var_const_str        sys_version(&vars, "version", server_version);
358
415
static sys_var_const_str        sys_version_comment(&vars, "version_comment",
359
 
                                            DRIZZLE_COMPILATION_COMMENT);
 
416
                                            MYSQL_COMPILATION_COMMENT);
360
417
static sys_var_const_str        sys_version_compile_machine(&vars, "version_compile_machine",
361
418
                                                    MACHINE_TYPE);
362
419
static sys_var_const_str        sys_version_compile_os(&vars, "version_compile_os",
373
430
 
374
431
static sys_var_thd_date_time_format sys_time_format(&vars, "time_format",
375
432
                                             &SV::time_format,
376
 
                                             DRIZZLE_TIMESTAMP_TIME);
 
433
                                             MYSQL_TIMESTAMP_TIME);
377
434
static sys_var_thd_date_time_format sys_date_format(&vars, "date_format",
378
435
                                             &SV::date_format,
379
 
                                             DRIZZLE_TIMESTAMP_DATE);
 
436
                                             MYSQL_TIMESTAMP_DATE);
380
437
static sys_var_thd_date_time_format sys_datetime_format(&vars, "datetime_format",
381
438
                                                 &SV::datetime_format,
382
 
                                                 DRIZZLE_TIMESTAMP_DATETIME);
 
439
                                                 MYSQL_TIMESTAMP_DATETIME);
383
440
 
384
441
/* Variables that are bits in THD */
385
442
 
398
455
static sys_var_thd_bit  sys_big_selects(&vars, "sql_big_selects", 0,
399
456
                                        set_option_bit,
400
457
                                        OPTION_BIG_SELECTS);
 
458
static sys_var_thd_bit  sys_log_off(&vars, "sql_log_off",
 
459
                                    check_log_update,
 
460
                                    set_option_bit,
 
461
                                    OPTION_LOG_OFF);
 
462
static sys_var_thd_bit  sys_log_update(&vars, "sql_log_update",
 
463
                                       check_log_update,
 
464
                                       set_log_update,
 
465
                                       OPTION_BIN_LOG);
401
466
static sys_var_thd_bit  sys_log_binlog(&vars, "sql_log_bin",
402
467
                                       check_log_update,
403
468
                                       set_option_bit,
408
473
static sys_var_thd_bit  sys_sql_notes(&vars, "sql_notes", 0,
409
474
                                         set_option_bit,
410
475
                                         OPTION_SQL_NOTES);
 
476
static sys_var_thd_bit  sys_auto_is_null(&vars, "sql_auto_is_null", 0,
 
477
                                         set_option_bit,
 
478
                                         OPTION_AUTO_IS_NULL, 0,
 
479
                                         sys_var::SESSION_VARIABLE_IN_BINLOG);
411
480
static sys_var_thd_bit  sys_safe_updates(&vars, "sql_safe_updates", 0,
412
481
                                         set_option_bit,
413
482
                                         OPTION_SAFE_UPDATES);
495
564
static sys_var_const_str_ptr    sys_repl_report_user(&vars, "report_user", &report_user);
496
565
static sys_var_const_str_ptr    sys_repl_report_password(&vars, "report_password", &report_password);
497
566
 
498
 
static unsigned char *slave_get_report_port(THD *thd)
 
567
static uchar *slave_get_report_port(THD *thd)
499
568
{
500
569
  thd->sys_var_tmp.long_value= report_port;
501
 
  return (unsigned char*) &thd->sys_var_tmp.long_value;
 
570
  return (uchar*) &thd->sys_var_tmp.long_value;
502
571
}
503
572
 
504
573
static sys_var_readonly    sys_repl_report_port(&vars, "report_port", OPT_GLOBAL, SHOW_INT, slave_get_report_port);
508
577
/* Read only variables */
509
578
 
510
579
static sys_var_have_variable sys_have_compress(&vars, "have_compress", &have_compress);
 
580
static sys_var_have_variable sys_have_crypt(&vars, "have_crypt", &have_crypt);
511
581
static sys_var_have_variable sys_have_symlink(&vars, "have_symlink", &have_symlink);
 
582
/* Global read-only variable describing server license */
 
583
static sys_var_const_str        sys_license(&vars, "license", STRINGIFY_ARG(LICENSE));
 
584
/* Global variables which enable|disable logging */
 
585
static sys_var_log_state sys_var_general_log(&vars, "general_log", &opt_log,
 
586
                                      QUERY_LOG_GENERAL);
 
587
/* Synonym of "general_log" for consistency with SHOW VARIABLES output */
 
588
static sys_var_log_state sys_var_log(&vars, "log", &opt_log, QUERY_LOG_GENERAL);
 
589
static sys_var_log_state sys_var_slow_query_log(&vars, "slow_query_log", &opt_slow_log,
 
590
                                         QUERY_LOG_SLOW);
 
591
/* Synonym of "slow_query_log" for consistency with SHOW VARIABLES output */
 
592
static sys_var_log_state sys_var_log_slow(&vars, "log_slow_queries",
 
593
                                          &opt_slow_log, QUERY_LOG_SLOW);
 
594
sys_var_str sys_var_general_log_path(&vars, "general_log_file", sys_check_log_path,
 
595
                                     sys_update_general_log_path,
 
596
                                     sys_default_general_log_path,
 
597
                                     opt_logname);
 
598
sys_var_str sys_var_slow_log_path(&vars, "slow_query_log_file", sys_check_log_path,
 
599
                                  sys_update_slow_log_path, 
 
600
                                  sys_default_slow_log_path,
 
601
                                  opt_slow_logname);
 
602
static sys_var_log_output sys_var_log_output_state(&vars, "log_output", &log_output_options,
 
603
                                            &log_output_typelib, 0);
 
604
 
 
605
 
512
606
/*
513
607
  Additional variables (not derived from sys_var class, not accessible as
514
608
  @@varname in SELECT or SET). Sorted in alphabetical order to facilitate
519
613
#define FIXED_VARS_SIZE (sizeof(fixed_vars) / sizeof(SHOW_VAR))
520
614
static SHOW_VAR fixed_vars[]= {
521
615
  {"back_log",                (char*) &back_log,                    SHOW_LONG},
 
616
  {"character_sets_dir",      mysql_charsets_dir,                   SHOW_CHAR},
522
617
  {"init_file",               (char*) &opt_init_file,               SHOW_CHAR_PTR},
523
618
  {"language",                language,                             SHOW_CHAR},
524
619
#ifdef HAVE_MLOCKALL
526
621
#endif
527
622
  {"log_bin",                 (char*) &opt_bin_log,                 SHOW_BOOL},
528
623
  {"log_error",               (char*) log_error_file,               SHOW_CHAR},
 
624
  {"lower_case_file_system",  (char*) &lower_case_file_system,      SHOW_MY_BOOL},
 
625
  {"lower_case_table_names",  (char*) &lower_case_table_names,      SHOW_INT},
529
626
  {"myisam_recover_options",  (char*) &myisam_recover_options_str,  SHOW_CHAR_PTR},
530
627
  {"open_files_limit",        (char*) &open_files_limit,            SHOW_LONG},
531
628
  {"pid_file",                (char*) pidfile_name,                 SHOW_CHAR},
532
629
  {"plugin_dir",              (char*) opt_plugin_dir,               SHOW_CHAR},
533
630
  {"port",                    (char*) &mysqld_port,                 SHOW_INT},
534
631
  {"protocol_version",        (char*) &protocol_version,            SHOW_INT},
 
632
  {"skip_networking",         (char*) &opt_disable_networking,      SHOW_BOOL},
 
633
  {"skip_show_database",      (char*) &opt_skip_show_db,            SHOW_BOOL},
535
634
  {"thread_stack",            (char*) &my_thread_stack_size,        SHOW_LONG},
536
635
};
537
636
 
571
670
                        set_var *var)
572
671
{
573
672
  char *res= 0, *old_value=(char *)(var ? var->value->str_value.ptr() : 0);
574
 
  uint32_t new_length= (var ? var->value->str_value.length() : 0);
 
673
  uint new_length= (var ? var->value->str_value.length() : 0);
575
674
  if (!old_value)
576
675
    old_value= (char*) "";
577
676
  if (!(res= my_strndup(old_value, new_length, MYF(0))))
585
684
  var_str->value= res;
586
685
  var_str->value_length= new_length;
587
686
  rw_unlock(var_mutex);
588
 
  free(old_value);
 
687
  my_free(old_value, MYF(MY_ALLOW_ZERO_PTR));
589
688
  return 0;
590
689
}
591
690
 
704
803
  If we are changing the thread variable, we have to copy it to NET too
705
804
*/
706
805
 
 
806
#ifdef HAVE_REPLICATION
707
807
static void fix_net_read_timeout(THD *thd, enum_var_type type)
708
808
{
709
809
  if (type != OPT_GLOBAL)
722
822
  if (type != OPT_GLOBAL)
723
823
    thd->net.retry_count=thd->variables.net_retry_count;
724
824
}
 
825
#else /* HAVE_REPLICATION */
 
826
static void fix_net_read_timeout(THD *thd __attribute__((unused)),
 
827
                                 enum_var_type type __attribute__((unused)))
 
828
{}
 
829
static void fix_net_write_timeout(THD *thd __attribute__((unused)),
 
830
                                  enum_var_type type __attribute__((unused)))
 
831
{}
 
832
static void fix_net_retry_count(THD *thd __attribute__((unused)),
 
833
                                enum_var_type type __attribute__((unused)))
 
834
{}
 
835
#endif /* HAVE_REPLICATION */
725
836
 
726
837
 
727
838
extern void fix_delay_key_write(THD *thd __attribute__((unused)),
748
859
  return 0;
749
860
}
750
861
 
751
 
unsigned char *sys_var_set::value_ptr(THD *thd,
 
862
uchar *sys_var_set::value_ptr(THD *thd,
752
863
                              enum_var_type type __attribute__((unused)),
753
864
                              LEX_STRING *base __attribute__((unused)))
754
865
{
755
866
  char buff[256];
756
 
  String tmp(buff, sizeof(buff), &my_charset_utf8_general_ci);
 
867
  String tmp(buff, sizeof(buff), &my_charset_latin1);
757
868
  ulong length;
758
869
  ulong val= *value;
759
870
 
760
871
  tmp.length(0);
761
 
  for (uint32_t i= 0; val; val>>= 1, i++)
 
872
  for (uint i= 0; val; val>>= 1, i++)
762
873
  {
763
874
    if (val & 1)
764
875
    {
770
881
 
771
882
  if ((length= tmp.length()))
772
883
    length--;
773
 
  return (unsigned char*) thd->strmake(tmp.ptr(), length);
 
884
  return (uchar*) thd->strmake(tmp.ptr(), length);
774
885
}
775
886
 
776
887
void sys_var_set_slave_mode::set_default(THD *thd __attribute__((unused)),
807
918
  if (bit_is_set(slave_exec_mode_options, SLAVE_EXEC_MODE_STRICT) == 1 &&
808
919
      bit_is_set(slave_exec_mode_options, SLAVE_EXEC_MODE_IDEMPOTENT) == 1)
809
920
  {
810
 
    sql_print_error(_("Ambiguous slave modes combination."
811
 
                    " STRICT will be used"));
 
921
    sql_print_error("Ambiguous slave modes combination."
 
922
                    " STRICT will be used");
812
923
    bit_do_clear(slave_exec_mode_options, SLAVE_EXEC_MODE_IDEMPOTENT);
813
924
  }
814
925
  if (bit_is_set(slave_exec_mode_options, SLAVE_EXEC_MODE_IDEMPOTENT) == 0)
838
949
    my_error(ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR, MYF(0));
839
950
    return 1;
840
951
  }
841
 
  
 
952
  /*
 
953
    if in a stored function/trigger, it's too late to change mode
 
954
  */
 
955
  if (thd->in_sub_stmt)
 
956
  {
 
957
    my_error(ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_FORMAT, MYF(0));
 
958
    return 1;    
 
959
  }
842
960
  return sys_var_thd_enum::is_readonly();
843
961
}
844
962
 
854
972
                                enum_var_type type __attribute__((unused)))
855
973
{
856
974
  mysql_bin_log.set_max_size(max_binlog_size);
 
975
#ifdef HAVE_REPLICATION
857
976
  if (!max_relay_log_size)
858
977
    active_mi->rli.relay_log.set_max_size(max_binlog_size);
 
978
#endif
859
979
  return;
860
980
}
861
981
 
862
982
static void fix_max_relay_log_size(THD *thd __attribute__((unused)),
863
983
                                   enum_var_type type __attribute__((unused)))
864
984
{
 
985
#ifdef HAVE_REPLICATION
865
986
  active_mi->rli.relay_log.set_max_size(max_relay_log_size ?
866
987
                                        max_relay_log_size: max_binlog_size);
 
988
#endif
867
989
  return;
868
990
}
869
991
 
912
1034
    else
913
1035
      llstr(val, buf);
914
1036
 
915
 
    push_warning_printf(thd, DRIZZLE_ERROR::WARN_LEVEL_WARN,
 
1037
    push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
916
1038
                        ER_TRUNCATED_WRONG_VALUE,
917
1039
                        ER(ER_TRUNCATED_WRONG_VALUE), name, buf);
918
1040
  }
963
1085
    *value= (ulong) fix_unsigned(thd, tmp, option_limits);
964
1086
  else
965
1087
  {
966
 
    if (tmp > UINT32_MAX)
 
1088
#if SIZEOF_LONG < SIZEOF_LONG_LONG
 
1089
    /* Avoid overflows on 32 bit systems */
 
1090
    if (tmp > ULONG_MAX)
967
1091
    {
968
 
      tmp= UINT32_MAX;
 
1092
      tmp= ULONG_MAX;
969
1093
      throw_bounds_warning(thd, true, true, name,
970
1094
                           (int64_t) var->save_result.uint64_t_value);
971
1095
    }
 
1096
#endif
972
1097
    *value= (ulong) tmp;
973
1098
  }
974
1099
 
1031
1156
}
1032
1157
 
1033
1158
 
1034
 
unsigned char *sys_var_enum::value_ptr(THD *thd __attribute__((unused)),
 
1159
uchar *sys_var_enum::value_ptr(THD *thd __attribute__((unused)),
1035
1160
                               enum_var_type type __attribute__((unused)),
1036
1161
                               LEX_STRING *base __attribute__((unused)))
1037
1162
{
1038
 
  return (unsigned char*) enum_names->type_names[*value];
 
1163
  return (uchar*) enum_names->type_names[*value];
1039
1164
}
1040
1165
 
1041
1166
 
1042
 
unsigned char *sys_var_enum_const::value_ptr(THD *thd __attribute__((unused)),
 
1167
uchar *sys_var_enum_const::value_ptr(THD *thd __attribute__((unused)),
1043
1168
                                     enum_var_type type __attribute__((unused)),
1044
1169
                                     LEX_STRING *base __attribute__((unused)))
1045
1170
{
1046
 
  return (unsigned char*) enum_names->type_names[global_system_variables.*offset];
 
1171
  return (uchar*) enum_names->type_names[global_system_variables.*offset];
1047
1172
}
1048
1173
 
1049
1174
bool sys_var_thd_ulong::check(THD *thd, set_var *var)
1065
1190
  
1066
1191
  if (option_limits)
1067
1192
    tmp= (ulong) fix_unsigned(thd, tmp, option_limits);
1068
 
  else if (tmp > UINT32_MAX)
 
1193
#if SIZEOF_LONG < SIZEOF_LONG_LONG
 
1194
  else if (tmp > ULONG_MAX)
1069
1195
  {
1070
 
    tmp= UINT32_MAX;
 
1196
    tmp= ULONG_MAX;
1071
1197
    throw_bounds_warning(thd, true, true, name, (int64_t) var->save_result.uint64_t_value);
1072
1198
  }
 
1199
#endif
1073
1200
  
1074
1201
  if (var->type == OPT_GLOBAL)
1075
1202
     global_system_variables.*offset= (ulong) tmp;
1095
1222
 }
1096
1223
 
1097
1224
 
1098
 
unsigned char *sys_var_thd_ulong::value_ptr(THD *thd, enum_var_type type,
 
1225
uchar *sys_var_thd_ulong::value_ptr(THD *thd, enum_var_type type,
1099
1226
                                    LEX_STRING *base __attribute__((unused)))
1100
1227
{
1101
1228
  if (type == OPT_GLOBAL)
1102
 
    return (unsigned char*) &(global_system_variables.*offset);
1103
 
  return (unsigned char*) &(thd->variables.*offset);
 
1229
    return (uchar*) &(global_system_variables.*offset);
 
1230
  return (uchar*) &(thd->variables.*offset);
1104
1231
}
1105
1232
 
1106
1233
 
1144
1271
}
1145
1272
 
1146
1273
 
1147
 
unsigned char *sys_var_thd_ha_rows::value_ptr(THD *thd, enum_var_type type,
 
1274
uchar *sys_var_thd_ha_rows::value_ptr(THD *thd, enum_var_type type,
1148
1275
                                      LEX_STRING *base __attribute__((unused)))
1149
1276
{
1150
1277
  if (type == OPT_GLOBAL)
1151
 
    return (unsigned char*) &(global_system_variables.*offset);
1152
 
  return (unsigned char*) &(thd->variables.*offset);
 
1278
    return (uchar*) &(global_system_variables.*offset);
 
1279
  return (uchar*) &(thd->variables.*offset);
1153
1280
}
1154
1281
 
1155
1282
bool sys_var_thd_uint64_t::check(THD *thd, set_var *var)
1195
1322
}
1196
1323
 
1197
1324
 
1198
 
unsigned char *sys_var_thd_uint64_t::value_ptr(THD *thd, enum_var_type type,
 
1325
uchar *sys_var_thd_uint64_t::value_ptr(THD *thd, enum_var_type type,
1199
1326
                                        LEX_STRING *base __attribute__((unused)))
1200
1327
{
1201
1328
  if (type == OPT_GLOBAL)
1202
 
    return (unsigned char*) &(global_system_variables.*offset);
1203
 
  return (unsigned char*) &(thd->variables.*offset);
 
1329
    return (uchar*) &(global_system_variables.*offset);
 
1330
  return (uchar*) &(thd->variables.*offset);
1204
1331
}
1205
1332
 
1206
1333
 
1223
1350
}
1224
1351
 
1225
1352
 
1226
 
unsigned char *sys_var_thd_bool::value_ptr(THD *thd, enum_var_type type,
 
1353
uchar *sys_var_thd_bool::value_ptr(THD *thd, enum_var_type type,
1227
1354
                                   LEX_STRING *base __attribute__((unused)))
1228
1355
{
1229
1356
  if (type == OPT_GLOBAL)
1230
 
    return (unsigned char*) &(global_system_variables.*offset);
1231
 
  return (unsigned char*) &(thd->variables.*offset);
 
1357
    return (uchar*) &(global_system_variables.*offset);
 
1358
  return (uchar*) &(thd->variables.*offset);
1232
1359
}
1233
1360
 
1234
1361
 
1274
1401
{
1275
1402
  bool not_used;
1276
1403
  char buff[STRING_BUFFER_USUAL_SIZE], *error= 0;
1277
 
  uint32_t error_len= 0;
 
1404
  uint error_len= 0;
1278
1405
  String str(buff, sizeof(buff), system_charset_info), *res;
1279
1406
 
1280
1407
  if (var->value->result_type() == STRING_RESULT)
1281
1408
  {
1282
1409
    if (!(res= var->value->val_str(&str)))
1283
1410
    {
1284
 
      my_stpcpy(buff, "NULL");
 
1411
      strmov(buff, "NULL");
1285
1412
      goto err;
1286
1413
    }
1287
1414
 
1300
1427
                                            &not_used));
1301
1428
    if (error_len)
1302
1429
    {
1303
 
      strmake(buff, error, cmin(sizeof(buff) - 1, (ulong)error_len));
 
1430
      strmake(buff, error, min(sizeof(buff) - 1, error_len));
1304
1431
      goto err;
1305
1432
    }
1306
1433
  }
1320
1447
      For when the enum is made to contain 64 elements, as 1ULL<<64 is
1321
1448
      undefined, we guard with a "count<64" test.
1322
1449
    */
1323
 
    if (unlikely((tmp >= ((1UL) << enum_names->count)) &&
 
1450
    if (unlikely((tmp >= ((1ULL) << enum_names->count)) &&
1324
1451
                 (enum_names->count < 64)))
1325
1452
    {
1326
1453
      llstr(tmp, buff);
1360
1487
  switch (show_type()) {
1361
1488
  case SHOW_INT:
1362
1489
  {
1363
 
    uint32_t value;
 
1490
    uint value;
1364
1491
    pthread_mutex_lock(&LOCK_global_system_variables);
1365
1492
    value= *(uint*) value_ptr(thd, var_type, base);
1366
1493
    pthread_mutex_unlock(&LOCK_global_system_variables);
1414
1541
    char *str= *(char**) value_ptr(thd, var_type, base);
1415
1542
    if (str)
1416
1543
    {
1417
 
      uint32_t length= strlen(str);
 
1544
      uint length= strlen(str);
1418
1545
      tmp= new Item_string(thd->strmake(str, length), length,
1419
1546
                           system_charset_info, DERIVATION_SYSCONST);
1420
1547
    }
1468
1595
}
1469
1596
 
1470
1597
 
1471
 
unsigned char *sys_var_thd_enum::value_ptr(THD *thd, enum_var_type type,
 
1598
uchar *sys_var_thd_enum::value_ptr(THD *thd, enum_var_type type,
1472
1599
                                   LEX_STRING *base __attribute__((unused)))
1473
1600
{
1474
1601
  ulong tmp= ((type == OPT_GLOBAL) ?
1475
1602
              global_system_variables.*offset :
1476
1603
              thd->variables.*offset);
1477
 
  return (unsigned char*) enum_names->type_names[tmp];
 
1604
  return (uchar*) enum_names->type_names[tmp];
1478
1605
}
1479
1606
 
1480
1607
bool sys_var_thd_bit::check(THD *thd, set_var *var)
1490
1617
}
1491
1618
 
1492
1619
 
1493
 
unsigned char *sys_var_thd_bit::value_ptr(THD *thd,
 
1620
uchar *sys_var_thd_bit::value_ptr(THD *thd,
1494
1621
                                  enum_var_type type __attribute__((unused)),
1495
1622
                                  LEX_STRING *base __attribute__((unused)))
1496
1623
{
1500
1627
  */
1501
1628
  thd->sys_var_tmp.bool_value= ((thd->options & bit_flag) ?
1502
1629
                                   !reverse : reverse);
1503
 
  return (unsigned char*) &thd->sys_var_tmp.bool_value;
 
1630
  return (uchar*) &thd->sys_var_tmp.bool_value;
1504
1631
}
1505
1632
 
1506
1633
 
1523
1650
    old= (thd->variables.*offset);
1524
1651
    (thd->variables.*offset)= new_value;
1525
1652
  }
1526
 
  free((char*) old);
 
1653
  my_free((char*) old, MYF(MY_ALLOW_ZERO_PTR));
1527
1654
  return;
1528
1655
}
1529
1656
 
1562
1689
    update is aborted
1563
1690
  */
1564
1691
  var->save_result.date_time_format= date_time_format_copy(thd, format);
1565
 
  free((char*) format);
 
1692
  my_free((char*) format, MYF(0));
1566
1693
  return var->save_result.date_time_format == 0;
1567
1694
}
1568
1695
 
1588
1715
}
1589
1716
 
1590
1717
 
1591
 
unsigned char *sys_var_thd_date_time_format::value_ptr(THD *thd, enum_var_type type,
 
1718
uchar *sys_var_thd_date_time_format::value_ptr(THD *thd, enum_var_type type,
1592
1719
                                               LEX_STRING *base __attribute__((unused)))
1593
1720
{
1594
1721
  if (type == OPT_GLOBAL)
1601
1728
    */
1602
1729
    res= thd->strmake((global_system_variables.*offset)->format.str,
1603
1730
                      (global_system_variables.*offset)->format.length);
1604
 
    return (unsigned char*) res;
 
1731
    return (uchar*) res;
1605
1732
  }
1606
 
  return (unsigned char*) (thd->variables.*offset)->format.str;
 
1733
  return (uchar*) (thd->variables.*offset)->format.str;
1607
1734
}
1608
1735
 
1609
1736
 
1613
1740
  const char *new_name;
1614
1741
} my_old_conv;
1615
1742
 
 
1743
static my_old_conv old_conv[]= 
 
1744
{
 
1745
  {     "cp1251_koi8"           ,       "cp1251"        },
 
1746
  {     "cp1250_latin2"         ,       "cp1250"        },
 
1747
  {     "kam_latin2"            ,       "keybcs2"       },
 
1748
  {     "mac_latin2"            ,       "MacRoman"      },
 
1749
  {     "macce_latin2"          ,       "MacCE"         },
 
1750
  {     "pc2_latin2"            ,       "pclatin2"      },
 
1751
  {     "vga_latin2"            ,       "pclatin1"      },
 
1752
  {     "koi8_cp1251"           ,       "koi8r"         },
 
1753
  {     "win1251ukr_koi8_ukr"   ,       "win1251ukr"    },
 
1754
  {     "koi8_ukr_win1251ukr"   ,       "koi8u"         },
 
1755
  {     NULL                    ,       NULL            }
 
1756
};
 
1757
 
 
1758
CHARSET_INFO *get_old_charset_by_name(const char *name)
 
1759
{
 
1760
  my_old_conv *conv;
 
1761
 
 
1762
  for (conv= old_conv; conv->old_name; conv++)
 
1763
  {
 
1764
    if (!my_strcasecmp(&my_charset_latin1, name, conv->old_name))
 
1765
      return get_charset_by_csname(conv->new_name, MY_CS_PRIMARY, MYF(0));
 
1766
  }
 
1767
  return NULL;
 
1768
}
 
1769
 
 
1770
 
1616
1771
bool sys_var_collation::check(THD *thd __attribute__((unused)),
1617
1772
                              set_var *var)
1618
1773
{
1619
 
  const CHARSET_INFO *tmp;
 
1774
  CHARSET_INFO *tmp;
1620
1775
 
1621
1776
  if (var->value->result_type() == STRING_RESULT)
1622
1777
  {
1651
1806
bool sys_var_character_set::check(THD *thd __attribute__((unused)),
1652
1807
                                  set_var *var)
1653
1808
{
1654
 
  const CHARSET_INFO *tmp;
 
1809
  CHARSET_INFO *tmp;
1655
1810
 
1656
1811
  if (var->value->result_type() == STRING_RESULT)
1657
1812
  {
1666
1821
      }
1667
1822
      tmp= NULL;
1668
1823
    }
1669
 
    else if (!(tmp= get_charset_by_csname(res->c_ptr(),MY_CS_PRIMARY,MYF(0))))
 
1824
    else if (!(tmp=get_charset_by_csname(res->c_ptr(),MY_CS_PRIMARY,MYF(0))) &&
 
1825
             !(tmp=get_old_charset_by_name(res->c_ptr())))
1670
1826
    {
1671
1827
      my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), res->c_ptr());
1672
1828
      return 1;
1695
1851
}
1696
1852
 
1697
1853
 
1698
 
unsigned char *sys_var_character_set::value_ptr(THD *thd, enum_var_type type,
 
1854
uchar *sys_var_character_set::value_ptr(THD *thd, enum_var_type type,
1699
1855
                                        LEX_STRING *base __attribute__((unused)))
1700
1856
{
1701
 
  const CHARSET_INFO * const cs= ci_ptr(thd,type)[0];
1702
 
  return cs ? (unsigned char*) cs->csname : (unsigned char*) NULL;
 
1857
  CHARSET_INFO *cs= ci_ptr(thd,type)[0];
 
1858
  return cs ? (uchar*) cs->csname : (uchar*) NULL;
 
1859
}
 
1860
 
 
1861
 
 
1862
void sys_var_character_set_sv::set_default(THD *thd, enum_var_type type)
 
1863
{
 
1864
  if (type == OPT_GLOBAL)
 
1865
    global_system_variables.*offset= *global_default;
 
1866
  else
 
1867
  {
 
1868
    thd->variables.*offset= global_system_variables.*offset;
 
1869
    thd->update_charset();
 
1870
  }
 
1871
}
 
1872
CHARSET_INFO **sys_var_character_set_sv::ci_ptr(THD *thd, enum_var_type type)
 
1873
{
 
1874
  if (type == OPT_GLOBAL)
 
1875
    return &(global_system_variables.*offset);
 
1876
  else
 
1877
    return &(thd->variables.*offset);
 
1878
}
 
1879
 
 
1880
 
 
1881
bool sys_var_character_set_client::check(THD *thd, set_var *var)
 
1882
{
 
1883
  if (sys_var_character_set_sv::check(thd, var))
 
1884
    return 1;
 
1885
  /* Currently, UCS-2 cannot be used as a client character set */
 
1886
  if (var->save_result.charset->mbminlen > 1)
 
1887
  {
 
1888
    my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, 
 
1889
             var->save_result.charset->csname);
 
1890
    return 1;
 
1891
  }
 
1892
  return 0;
 
1893
}
 
1894
 
 
1895
 
 
1896
CHARSET_INFO ** sys_var_character_set_database::ci_ptr(THD *thd,
 
1897
                                                       enum_var_type type)
 
1898
{
 
1899
  if (type == OPT_GLOBAL)
 
1900
    return &global_system_variables.collation_database;
 
1901
  else
 
1902
    return &thd->variables.collation_database;
 
1903
}
 
1904
 
 
1905
 
 
1906
void sys_var_character_set_database::set_default(THD *thd, enum_var_type type)
 
1907
{
 
1908
 if (type == OPT_GLOBAL)
 
1909
    global_system_variables.collation_database= default_charset_info;
 
1910
  else
 
1911
  {
 
1912
    thd->variables.collation_database= thd->db_charset;
 
1913
    thd->update_charset();
 
1914
  }
1703
1915
}
1704
1916
 
1705
1917
 
1728
1940
}
1729
1941
 
1730
1942
 
1731
 
unsigned char *sys_var_collation_sv::value_ptr(THD *thd, enum_var_type type,
 
1943
uchar *sys_var_collation_sv::value_ptr(THD *thd, enum_var_type type,
1732
1944
                                       LEX_STRING *base __attribute__((unused)))
1733
1945
{
1734
 
  const CHARSET_INFO *cs= ((type == OPT_GLOBAL) ?
 
1946
  CHARSET_INFO *cs= ((type == OPT_GLOBAL) ?
1735
1947
                     global_system_variables.*offset : thd->variables.*offset);
1736
 
  return cs ? (unsigned char*) cs->name : (unsigned char*) "NULL";
 
1948
  return cs ? (uchar*) cs->name : (uchar*) "NULL";
1737
1949
}
1738
1950
 
1739
1951
 
1751
1963
}
1752
1964
 
1753
1965
 
1754
 
unsigned char *sys_var_key_cache_param::value_ptr(THD *thd __attribute__((unused)),
 
1966
uchar *sys_var_key_cache_param::value_ptr(THD *thd __attribute__((unused)),
1755
1967
                                          enum_var_type type __attribute__((unused)),
1756
1968
                                          LEX_STRING *base __attribute__((unused)))
1757
1969
{
1758
1970
  KEY_CACHE *key_cache= get_key_cache(base);
1759
1971
  if (!key_cache)
1760
1972
    key_cache= &zero_key_cache;
1761
 
  return (unsigned char*) key_cache + offset ;
 
1973
  return (uchar*) key_cache + offset ;
1762
1974
}
1763
1975
 
1764
1976
 
1800
2012
  {
1801
2013
    if (key_cache == dflt_key_cache)
1802
2014
    {
1803
 
      push_warning_printf(thd, DRIZZLE_ERROR::WARN_LEVEL_WARN,
 
2015
      push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
1804
2016
                          ER_WARN_CANT_DROP_DEFAULT_KEYCACHE,
1805
2017
                          ER(ER_WARN_CANT_DROP_DEFAULT_KEYCACHE));
1806
2018
      goto end;                                 // Ignore default key cache
1904
2116
}
1905
2117
 
1906
2118
 
1907
 
bool sys_var_log_state::update(THD *thd __attribute__((unused)), set_var *var)
 
2119
bool sys_var_log_state::update(THD *thd, set_var *var)
1908
2120
{
1909
2121
  bool res;
1910
2122
  pthread_mutex_lock(&LOCK_global_system_variables);
1911
2123
  if (!var->save_result.ulong_value)
 
2124
  {
 
2125
    logger.deactivate_log_handler(thd, log_type);
1912
2126
    res= false;
 
2127
  }
1913
2128
  else
1914
 
    res= true;
 
2129
    res= logger.activate_log_handler(thd, log_type);
1915
2130
  pthread_mutex_unlock(&LOCK_global_system_variables);
1916
2131
  return res;
1917
2132
}
1918
2133
 
1919
 
void sys_var_log_state::set_default(THD *thd __attribute__((unused)),
 
2134
void sys_var_log_state::set_default(THD *thd,
1920
2135
                                    enum_var_type type __attribute__((unused)))
1921
2136
{
 
2137
  pthread_mutex_lock(&LOCK_global_system_variables);
 
2138
  logger.deactivate_log_handler(thd, log_type);
 
2139
  pthread_mutex_unlock(&LOCK_global_system_variables);
 
2140
}
 
2141
 
 
2142
 
 
2143
static int  sys_check_log_path(THD *thd __attribute__((unused)),
 
2144
                               set_var *var)
 
2145
{
 
2146
  char path[FN_REFLEN], buff[FN_REFLEN];
 
2147
  struct stat f_stat;
 
2148
  String str(buff, sizeof(buff), system_charset_info), *res;
 
2149
  const char *log_file_str;
 
2150
  size_t path_length;
 
2151
 
 
2152
  if (!(res= var->value->val_str(&str)))
 
2153
    goto err;
 
2154
 
 
2155
  log_file_str= res->c_ptr();
 
2156
  bzero(&f_stat, sizeof(struct stat));
 
2157
 
 
2158
  path_length= unpack_filename(path, log_file_str);
 
2159
 
 
2160
  if (!path_length)
 
2161
  {
 
2162
    /* File name is empty. */
 
2163
 
 
2164
    goto err;
 
2165
  }
 
2166
 
 
2167
  if (!stat(path, &f_stat))
 
2168
  {
 
2169
    /*
 
2170
      A file system object exists. Check if argument is a file and we have
 
2171
      'write' permission.
 
2172
    */
 
2173
 
 
2174
    if (!MY_S_ISREG(f_stat.st_mode) ||
 
2175
        !(f_stat.st_mode & MY_S_IWRITE))
 
2176
      goto err;
 
2177
 
 
2178
    return 0;
 
2179
  }
 
2180
 
 
2181
  /* Get dirname of the file path. */
 
2182
  (void) dirname_part(path, log_file_str, &path_length);
 
2183
 
 
2184
  /* Dirname is empty if file path is relative. */
 
2185
  if (!path_length)
 
2186
    return 0;
 
2187
 
 
2188
  /*
 
2189
    Check if directory exists and we have permission to create file and
 
2190
    write to file.
 
2191
  */
 
2192
  if (my_access(path, (F_OK|W_OK)))
 
2193
    goto err;
 
2194
 
 
2195
  return 0;
 
2196
 
 
2197
err:
 
2198
  my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), var->var->name, 
 
2199
           res ? log_file_str : "NULL");
 
2200
  return 1;
1922
2201
}
1923
2202
 
1924
2203
 
1925
2204
bool update_sys_var_str_path(THD *thd __attribute__((unused)),
1926
2205
                             sys_var_str *var_str,
1927
2206
                             set_var *var, const char *log_ext,
1928
 
                             bool log_state, uint32_t log_type)
 
2207
                             bool log_state, uint log_type)
1929
2208
{
 
2209
  MYSQL_QUERY_LOG *file_log;
1930
2210
  char buff[FN_REFLEN];
1931
2211
  char *res= 0, *old_value=(char *)(var ? var->value->str_value.ptr() : 0);
1932
2212
  bool result= 0;
1933
 
  uint32_t str_length= (var ? var->value->str_value.length() : 0);
 
2213
  uint str_length= (var ? var->value->str_value.length() : 0);
1934
2214
 
1935
2215
  switch (log_type) {
 
2216
  case QUERY_LOG_SLOW:
 
2217
    file_log= logger.get_slow_log_file_handler();
 
2218
    break;
 
2219
  case QUERY_LOG_GENERAL:
 
2220
    file_log= logger.get_log_file_handler();
 
2221
    break;
1936
2222
  default:
1937
2223
    assert(0);                                  // Impossible
1938
2224
  }
1951
2237
  pthread_mutex_lock(&LOCK_global_system_variables);
1952
2238
  logger.lock_exclusive();
1953
2239
 
 
2240
  if (file_log && log_state)
 
2241
    file_log->close(0);
1954
2242
  old_value= var_str->value;
1955
2243
  var_str->value= res;
1956
2244
  var_str->value_length= str_length;
1957
 
  free(old_value);
1958
 
  if (log_state)
 
2245
  my_free(old_value, MYF(MY_ALLOW_ZERO_PTR));
 
2246
  if (file_log && log_state)
1959
2247
  {
1960
2248
    switch (log_type) {
 
2249
    case QUERY_LOG_SLOW:
 
2250
      file_log->open_slow_log(sys_var_slow_log_path.value);
 
2251
      break;
 
2252
    case QUERY_LOG_GENERAL:
 
2253
      file_log->open_query_log(sys_var_general_log_path.value);
 
2254
      break;
1961
2255
    default:
1962
2256
      assert(0);
1963
2257
    }
1971
2265
}
1972
2266
 
1973
2267
 
 
2268
static bool sys_update_general_log_path(THD *thd, set_var * var)
 
2269
{
 
2270
  return update_sys_var_str_path(thd, &sys_var_general_log_path,
 
2271
                                 var, ".log", opt_log, QUERY_LOG_GENERAL);
 
2272
}
 
2273
 
 
2274
 
 
2275
static void sys_default_general_log_path(THD *thd,
 
2276
                                         enum_var_type type __attribute__((unused)))
 
2277
{
 
2278
  (void) update_sys_var_str_path(thd, &sys_var_general_log_path,
 
2279
                                 0, ".log", opt_log, QUERY_LOG_GENERAL);
 
2280
}
 
2281
 
 
2282
 
 
2283
static bool sys_update_slow_log_path(THD *thd, set_var * var)
 
2284
{
 
2285
  return update_sys_var_str_path(thd, &sys_var_slow_log_path,
 
2286
                                 var, "-slow.log", opt_slow_log,
 
2287
                                 QUERY_LOG_SLOW);
 
2288
}
 
2289
 
 
2290
 
 
2291
static void sys_default_slow_log_path(THD *thd,
 
2292
                                      enum_var_type type __attribute__((unused)))
 
2293
{
 
2294
  (void) update_sys_var_str_path(thd, &sys_var_slow_log_path,
 
2295
                                 0, "-slow.log", opt_slow_log,
 
2296
                                 QUERY_LOG_SLOW);
 
2297
}
 
2298
 
 
2299
 
1974
2300
bool sys_var_log_output::update(THD *thd __attribute__((unused)),
1975
2301
                                set_var *var)
1976
2302
{
1977
2303
  pthread_mutex_lock(&LOCK_global_system_variables);
1978
2304
  logger.lock_exclusive();
 
2305
  logger.init_slow_log(var->save_result.ulong_value);
 
2306
  logger.init_general_log(var->save_result.ulong_value);
1979
2307
  *value= var->save_result.ulong_value;
1980
2308
  logger.unlock();
1981
2309
  pthread_mutex_unlock(&LOCK_global_system_variables);
1988
2316
{
1989
2317
  pthread_mutex_lock(&LOCK_global_system_variables);
1990
2318
  logger.lock_exclusive();
 
2319
  logger.init_slow_log(LOG_FILE);
 
2320
  logger.init_general_log(LOG_FILE);
1991
2321
  *value= LOG_FILE;
1992
2322
  logger.unlock();
1993
2323
  pthread_mutex_unlock(&LOCK_global_system_variables);
1994
2324
}
1995
2325
 
1996
2326
 
1997
 
unsigned char *sys_var_log_output::value_ptr(THD *thd,
 
2327
uchar *sys_var_log_output::value_ptr(THD *thd,
1998
2328
                                     enum_var_type type __attribute__((unused)),
1999
2329
                                     LEX_STRING *base __attribute__((unused)))
2000
2330
{
2001
2331
  char buff[256];
2002
 
  String tmp(buff, sizeof(buff), &my_charset_utf8_general_ci);
 
2332
  String tmp(buff, sizeof(buff), &my_charset_latin1);
2003
2333
  ulong length;
2004
2334
  ulong val= *value;
2005
2335
 
2006
2336
  tmp.length(0);
2007
 
  for (uint32_t i= 0; val; val>>= 1, i++)
 
2337
  for (uint i= 0; val; val>>= 1, i++)
2008
2338
  {
2009
2339
    if (val & 1)
2010
2340
    {
2016
2346
 
2017
2347
  if ((length= tmp.length()))
2018
2348
    length--;
2019
 
  return (unsigned char*) thd->strmake(tmp.ptr(), length);
 
2349
  return (uchar*) thd->strmake(tmp.ptr(), length);
2020
2350
}
2021
2351
 
2022
2352
 
2062
2392
}
2063
2393
 
2064
2394
 
2065
 
unsigned char *sys_var_timestamp::value_ptr(THD *thd,
 
2395
uchar *sys_var_timestamp::value_ptr(THD *thd,
2066
2396
                                    enum_var_type type __attribute__((unused)),
2067
2397
                                    LEX_STRING *base __attribute__((unused)))
2068
2398
{
2069
2399
  thd->sys_var_tmp.long_value= (long) thd->start_time;
2070
 
  return (unsigned char*) &thd->sys_var_tmp.long_value;
 
2400
  return (uchar*) &thd->sys_var_tmp.long_value;
2071
2401
}
2072
2402
 
2073
2403
 
2079
2409
}
2080
2410
 
2081
2411
 
2082
 
unsigned char *sys_var_last_insert_id::value_ptr(THD *thd,
 
2412
uchar *sys_var_last_insert_id::value_ptr(THD *thd,
2083
2413
                                         enum_var_type type __attribute__((unused)),
2084
2414
                                         LEX_STRING *base __attribute__((unused)))
2085
2415
{
2089
2419
  */
2090
2420
  thd->sys_var_tmp.uint64_t_value= 
2091
2421
    thd->read_first_successful_insert_id_in_prev_stmt();
2092
 
  return (unsigned char*) &thd->sys_var_tmp.uint64_t_value;
 
2422
  return (uchar*) &thd->sys_var_tmp.uint64_t_value;
2093
2423
}
2094
2424
 
2095
2425
 
2100
2430
}
2101
2431
 
2102
2432
 
2103
 
unsigned char *sys_var_insert_id::value_ptr(THD *thd,
 
2433
uchar *sys_var_insert_id::value_ptr(THD *thd,
2104
2434
                                    enum_var_type type __attribute__((unused)),
2105
2435
                                    LEX_STRING *base __attribute__((unused)))
2106
2436
{
2107
2437
  thd->sys_var_tmp.uint64_t_value=
2108
2438
    thd->auto_inc_intervals_forced.minimum();
2109
 
  return (unsigned char*) &thd->sys_var_tmp.uint64_t_value;
 
2439
  return (uchar*) &thd->sys_var_tmp.uint64_t_value;
2110
2440
}
2111
2441
 
2112
2442
 
2126
2456
bool sys_var_thd_time_zone::check(THD *thd, set_var *var)
2127
2457
{
2128
2458
  char buff[MAX_TIME_ZONE_NAME_LENGTH];
2129
 
  String str(buff, sizeof(buff), &my_charset_utf8_general_ci);
 
2459
  String str(buff, sizeof(buff), &my_charset_latin1);
2130
2460
  String *res= var->value->val_str(&str);
2131
2461
 
2132
2462
  if (!(var->save_result.time_zone= my_tz_find(thd, res)))
2153
2483
}
2154
2484
 
2155
2485
 
2156
 
unsigned char *sys_var_thd_time_zone::value_ptr(THD *thd, enum_var_type type,
 
2486
uchar *sys_var_thd_time_zone::value_ptr(THD *thd, enum_var_type type,
2157
2487
                                        LEX_STRING *base __attribute__((unused)))
2158
2488
{
2159
2489
  /* 
2161
2491
    time zone name is guaranteed to be zero ended.
2162
2492
  */
2163
2493
  if (type == OPT_GLOBAL)
2164
 
    return (unsigned char *)(global_system_variables.time_zone->get_name()->ptr());
 
2494
    return (uchar *)(global_system_variables.time_zone->get_name()->ptr());
2165
2495
  else
2166
2496
  {
2167
2497
    /*
2173
2503
      (binlog code stores session value only).
2174
2504
    */
2175
2505
    thd->time_zone_used= 1;
2176
 
    return (unsigned char *)(thd->variables.time_zone->get_name()->ptr());
 
2506
    return (uchar *)(thd->variables.time_zone->get_name()->ptr());
2177
2507
  }
2178
2508
}
2179
2509
 
2185
2515
 {
2186
2516
   if (default_tz_name)
2187
2517
   {
2188
 
     String str(default_tz_name, &my_charset_utf8_general_ci);
 
2518
     String str(default_tz_name, &my_charset_latin1);
2189
2519
     /*
2190
2520
       We are guaranteed to find this time zone since its existence
2191
2521
       is checked during start-up.
2237
2567
}
2238
2568
 
2239
2569
 
2240
 
unsigned char *sys_var_max_user_conn::value_ptr(THD *thd, enum_var_type type,
 
2570
uchar *sys_var_max_user_conn::value_ptr(THD *thd, enum_var_type type,
2241
2571
                                        LEX_STRING *base __attribute__((unused)))
2242
2572
{
2243
2573
  if (type != OPT_GLOBAL &&
2244
2574
      thd->user_connect && thd->user_connect->user_resources.user_conn)
2245
 
    return (unsigned char*) &(thd->user_connect->user_resources.user_conn);
2246
 
  return (unsigned char*) &(max_user_connections);
 
2575
    return (uchar*) &(thd->user_connect->user_resources.user_conn);
 
2576
  return (uchar*) &(max_user_connections);
2247
2577
}
2248
2578
 
2249
2579
 
2265
2595
  else // STRING_RESULT
2266
2596
  {
2267
2597
    char buff[6]; 
2268
 
    String str(buff, sizeof(buff), &my_charset_utf8_general_ci), *res;
 
2598
    String str(buff, sizeof(buff), &my_charset_latin1), *res;
2269
2599
    if (!(res=var->value->val_str(&str)))
2270
2600
    {
2271
2601
      my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, "NULL");
2295
2625
}
2296
2626
 
2297
2627
 
2298
 
unsigned char *sys_var_thd_lc_time_names::value_ptr(THD *thd,
 
2628
uchar *sys_var_thd_lc_time_names::value_ptr(THD *thd,
2299
2629
                                            enum_var_type type,
2300
2630
                                            LEX_STRING *base __attribute__((unused)))
2301
2631
{
2302
2632
  return type == OPT_GLOBAL ?
2303
 
                 (unsigned char *) global_system_variables.lc_time_names->name :
2304
 
                 (unsigned char *) thd->variables.lc_time_names->name;
 
2633
                 (uchar *) global_system_variables.lc_time_names->name :
 
2634
                 (uchar *) thd->variables.lc_time_names->name;
2305
2635
}
2306
2636
 
2307
2637
 
2357
2687
}
2358
2688
 
2359
2689
 
2360
 
unsigned char *sys_var_microseconds::value_ptr(THD *thd, enum_var_type type,
 
2690
uchar *sys_var_microseconds::value_ptr(THD *thd, enum_var_type type,
2361
2691
                                          LEX_STRING *base __attribute__((unused)))
2362
2692
{
2363
2693
  thd->tmp_double_value= (double) ((type == OPT_GLOBAL) ?
2364
2694
                                   global_system_variables.*offset :
2365
2695
                                   thd->variables.*offset) / 1000000.0;
2366
 
  return (unsigned char*) &thd->tmp_double_value;
 
2696
  return (uchar*) &thd->tmp_double_value;
2367
2697
}
2368
2698
 
2369
2699
 
2419
2749
  return 0;
2420
2750
}
2421
2751
 
 
2752
static bool set_log_update(THD *thd __attribute__((unused)),
 
2753
                           set_var *var __attribute__((unused)))
 
2754
{
 
2755
  /*
 
2756
    The update log is not supported anymore since 5.0.
 
2757
    See sql/mysqld.cc/, comments in function init_server_components() for an
 
2758
    explaination of the different warnings we send below
 
2759
  */
 
2760
 
 
2761
  if (opt_sql_bin_update)
 
2762
  {
 
2763
    push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
 
2764
                 ER_UPDATE_LOG_DEPRECATED_TRANSLATED,
 
2765
                 ER(ER_UPDATE_LOG_DEPRECATED_TRANSLATED));
 
2766
  }
 
2767
  else
 
2768
    push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
 
2769
                 ER_UPDATE_LOG_DEPRECATED_IGNORED,
 
2770
                 ER(ER_UPDATE_LOG_DEPRECATED_IGNORED));
 
2771
  set_option_bit(thd, var);
 
2772
  return 0;
 
2773
}
 
2774
 
2422
2775
 
2423
2776
static int check_pseudo_thread_id(THD *thd __attribute__((unused)),
2424
2777
                                  set_var *var)
2427
2780
  return 0;
2428
2781
}
2429
2782
 
2430
 
static unsigned char *get_warning_count(THD *thd)
 
2783
static uchar *get_warning_count(THD *thd)
2431
2784
{
2432
2785
  thd->sys_var_tmp.long_value=
2433
 
    (thd->warn_count[(uint) DRIZZLE_ERROR::WARN_LEVEL_NOTE] +
2434
 
     thd->warn_count[(uint) DRIZZLE_ERROR::WARN_LEVEL_ERROR] +
2435
 
     thd->warn_count[(uint) DRIZZLE_ERROR::WARN_LEVEL_WARN]);
2436
 
  return (unsigned char*) &thd->sys_var_tmp.long_value;
 
2786
    (thd->warn_count[(uint) MYSQL_ERROR::WARN_LEVEL_NOTE] +
 
2787
     thd->warn_count[(uint) MYSQL_ERROR::WARN_LEVEL_ERROR] +
 
2788
     thd->warn_count[(uint) MYSQL_ERROR::WARN_LEVEL_WARN]);
 
2789
  return (uchar*) &thd->sys_var_tmp.long_value;
2437
2790
}
2438
2791
 
2439
 
static unsigned char *get_error_count(THD *thd)
 
2792
static uchar *get_error_count(THD *thd)
2440
2793
{
2441
2794
  thd->sys_var_tmp.long_value= 
2442
 
    thd->warn_count[(uint) DRIZZLE_ERROR::WARN_LEVEL_ERROR];
2443
 
  return (unsigned char*) &thd->sys_var_tmp.long_value;
 
2795
    thd->warn_count[(uint) MYSQL_ERROR::WARN_LEVEL_ERROR];
 
2796
  return (uchar*) &thd->sys_var_tmp.long_value;
2444
2797
}
2445
2798
 
2446
2799
 
2458
2811
  @retval
2459
2812
    ptr         pointer to NUL-terminated string
2460
2813
*/
2461
 
static unsigned char *get_tmpdir(THD *thd __attribute__((unused)))
 
2814
static uchar *get_tmpdir(THD *thd __attribute__((unused)))
2462
2815
{
2463
2816
  if (opt_mysql_tmpdir)
2464
 
    return (unsigned char *)opt_mysql_tmpdir;
2465
 
  return (unsigned char*)mysql_tmpdir;
 
2817
    return (uchar *)opt_mysql_tmpdir;
 
2818
  return (uchar*)mysql_tmpdir;
2466
2819
}
2467
2820
 
2468
2821
/****************************************************************************
2487
2840
 
2488
2841
static struct my_option *find_option(struct my_option *opt, const char *name) 
2489
2842
{
2490
 
  uint32_t length=strlen(name);
 
2843
  uint length=strlen(name);
2491
2844
  for (; opt->name; opt++)
2492
2845
  {
2493
2846
    if (!getopt_compare_strings(opt->name, name, length) &&
2508
2861
  Return variable name and length for hashing of variables.
2509
2862
*/
2510
2863
 
2511
 
static unsigned char *get_sys_var_length(const sys_var *var, size_t *length,
 
2864
static uchar *get_sys_var_length(const sys_var *var, size_t *length,
2512
2865
                                 bool first __attribute__((unused)))
2513
2866
{
2514
2867
  *length= var->name_length;
2515
 
  return (unsigned char*) var->name;
 
2868
  return (uchar*) var->name;
2516
2869
}
2517
2870
 
2518
2871
 
2540
2893
  {
2541
2894
    var->name_length= strlen(var->name);
2542
2895
    /* this fails if there is a conflicting variable name. see HASH_UNIQUE */
2543
 
    if (my_hash_insert(&system_variable_hash, (unsigned char*) var))
 
2896
    if (my_hash_insert(&system_variable_hash, (uchar*) var))
2544
2897
      goto error;
2545
2898
    if (long_options)
2546
2899
      var->option_limits= find_option(long_options, var->name);
2549
2902
 
2550
2903
error:
2551
2904
  for (; first != var; first= first->next)
2552
 
    hash_delete(&system_variable_hash, (unsigned char*) first);
 
2905
    hash_delete(&system_variable_hash, (uchar*) first);
2553
2906
  return 1;
2554
2907
}
2555
2908
 
2573
2926
  /* A write lock should be held on LOCK_system_variables_hash */
2574
2927
   
2575
2928
  for (sys_var *var= first; var; var= var->next)
2576
 
    result|= hash_delete(&system_variable_hash, (unsigned char*) var);
 
2929
    result|= hash_delete(&system_variable_hash, (uchar*) var);
2577
2930
 
2578
2931
  return result;
2579
2932
}
2625
2978
               (qsort_cmp) show_cmp);
2626
2979
    
2627
2980
    /* make last element empty */
2628
 
    memset(show, 0, sizeof(SHOW_VAR));
 
2981
    bzero(show, sizeof(SHOW_VAR));
2629
2982
  }
2630
2983
  return result;
2631
2984
}
2644
2997
 
2645
2998
int set_var_init()
2646
2999
{
2647
 
  uint32_t count= 0;
 
3000
  uint count= 0;
2648
3001
  
2649
3002
  for (sys_var *var=vars.first; var; var= var->next, count++) {};
2650
3003
 
2690
3043
    0           SUCCESS
2691
3044
    otherwise   FAILURE
2692
3045
*/
2693
 
int mysql_append_static_vars(const SHOW_VAR *show_vars, uint32_t count)
 
3046
int mysql_append_static_vars(const SHOW_VAR *show_vars, uint count)
2694
3047
{
2695
3048
  for (; count > 0; count--, show_vars++)
2696
 
    if (insert_dynamic(&fixed_show_vars, (unsigned char*) show_vars))
 
3049
    if (insert_dynamic(&fixed_show_vars, (uchar*) show_vars))
2697
3050
      return 1;
2698
3051
  return 0;
2699
3052
}
2713
3066
    0           Unknown variable (error message is given)
2714
3067
*/
2715
3068
 
2716
 
sys_var *intern_find_sys_var(const char *str, uint32_t length, bool no_error)
 
3069
sys_var *intern_find_sys_var(const char *str, uint length, bool no_error)
2717
3070
{
2718
3071
  sys_var *var;
2719
3072
 
2722
3075
    A lock on LOCK_system_variable_hash should be held
2723
3076
  */
2724
3077
  var= (sys_var*) hash_search(&system_variable_hash,
2725
 
                              (unsigned char*) str, length ? length : strlen(str));
 
3078
                              (uchar*) str, length ? length : strlen(str));
2726
3079
  if (!(var || no_error))
2727
3080
    my_error(ER_UNKNOWN_SYSTEM_VARIABLE, MYF(0), (char*) str);
2728
3081
 
2902
3255
{
2903
3256
  char buff[STRING_BUFFER_USUAL_SIZE];
2904
3257
  const char *value;
2905
 
  String str(buff, sizeof(buff), &my_charset_utf8_general_ci), *res;
 
3258
  String str(buff, sizeof(buff), &my_charset_latin1), *res;
2906
3259
 
2907
3260
  var->save_result.plugin= NULL;
2908
3261
  if (var->value->result_type() == STRING_RESULT)
2913
3266
        !(engine_name.str= (char *)res->ptr()) ||
2914
3267
        !(engine_name.length= res->length()) ||
2915
3268
        !(var->save_result.plugin= ha_resolve_by_name(thd, &engine_name)) ||
2916
 
        !(hton= plugin_data(var->save_result.plugin, handlerton *)))
 
3269
        !(hton= plugin_data(var->save_result.plugin, handlerton *)) ||
 
3270
        ha_checktype(thd, ha_legacy_type(hton), 1, 0) != hton)
2917
3271
    {
2918
3272
      value= res ? res->c_ptr() : "NULL";
2919
3273
      goto err;
2928
3282
}
2929
3283
 
2930
3284
 
2931
 
unsigned char *sys_var_thd_storage_engine::value_ptr(THD *thd, enum_var_type type,
 
3285
uchar *sys_var_thd_storage_engine::value_ptr(THD *thd, enum_var_type type,
2932
3286
                                             LEX_STRING *base __attribute__((unused)))
2933
3287
{
2934
 
  unsigned char* result;
 
3288
  uchar* result;
2935
3289
  handlerton *hton;
2936
3290
  LEX_STRING *engine_name;
2937
3291
  plugin_ref plugin= thd->variables.*offset;
2939
3293
    plugin= my_plugin_lock(thd, &(global_system_variables.*offset));
2940
3294
  hton= plugin_data(plugin, handlerton*);
2941
3295
  engine_name= &hton2plugin[hton->slot]->name;
2942
 
  result= (unsigned char *) thd->strmake(engine_name->str, engine_name->length);
 
3296
  result= (uchar *) thd->strmake(engine_name->str, engine_name->length);
2943
3297
  if (type == OPT_GLOBAL)
2944
3298
    plugin_unlock(thd, plugin);
2945
3299
  return result;
2985
3339
symbolic_mode_representation(THD *thd, uint64_t val, LEX_STRING *rep)
2986
3340
{
2987
3341
  char buff[STRING_BUFFER_USUAL_SIZE*8];
2988
 
  String tmp(buff, sizeof(buff), &my_charset_utf8_general_ci);
 
3342
  String tmp(buff, sizeof(buff), &my_charset_latin1);
2989
3343
 
2990
3344
  tmp.length(0);
2991
3345
 
2992
 
  for (uint32_t i= 0; val; val>>= 1, i++)
 
3346
  for (uint i= 0; val; val>>= 1, i++)
2993
3347
  {
2994
3348
    if (val & 1)
2995
3349
    {
3010
3364
}
3011
3365
 
3012
3366
 
3013
 
unsigned char *sys_var_thd_optimizer_switch::value_ptr(THD *thd, enum_var_type type,
 
3367
uchar *sys_var_thd_optimizer_switch::value_ptr(THD *thd, enum_var_type type,
3014
3368
                                               LEX_STRING *base __attribute__((unused)))
3015
3369
{
3016
3370
  LEX_STRING opts;
3017
3371
  uint64_t val= ((type == OPT_GLOBAL) ? global_system_variables.*offset :
3018
3372
                  thd->variables.*offset);
3019
3373
  (void) symbolic_mode_representation(thd, val, &opts);
3020
 
  return (unsigned char *) opts.str;
 
3374
  return (uchar *) opts.str;
3021
3375
}
3022
3376
 
3023
3377
 
3034
3388
  Named list handling
3035
3389
****************************************************************************/
3036
3390
 
3037
 
unsigned char* find_named(I_List<NAMED_LIST> *list, const char *name, uint32_t length,
 
3391
uchar* find_named(I_List<NAMED_LIST> *list, const char *name, uint length,
3038
3392
                NAMED_LIST **found)
3039
3393
{
3040
3394
  I_List_iterator<NAMED_LIST> it(*list);
3053
3407
 
3054
3408
 
3055
3409
void delete_elements(I_List<NAMED_LIST> *list,
3056
 
                     void (*free_element)(const char *name, unsigned char*))
 
3410
                     void (*free_element)(const char *name, uchar*))
3057
3411
{
3058
3412
  NAMED_LIST *element;
3059
3413
  while ((element= list->get()))
3067
3421
 
3068
3422
/* Key cache functions */
3069
3423
 
3070
 
static KEY_CACHE *create_key_cache(const char *name, uint32_t length)
 
3424
static KEY_CACHE *create_key_cache(const char *name, uint length)
3071
3425
{
3072
3426
  KEY_CACHE *key_cache;
3073
3427
  
3074
3428
  if ((key_cache= (KEY_CACHE*) my_malloc(sizeof(KEY_CACHE),
3075
3429
                                             MYF(MY_ZEROFILL | MY_WME))))
3076
3430
  {
3077
 
    if (!new NAMED_LIST(&key_caches, name, length, (unsigned char*) key_cache))
 
3431
    if (!new NAMED_LIST(&key_caches, name, length, (uchar*) key_cache))
3078
3432
    {
3079
 
      free((char*) key_cache);
 
3433
      my_free((char*) key_cache, MYF(0));
3080
3434
      key_cache= 0;
3081
3435
    }
3082
3436
    else
3096
3450
}
3097
3451
 
3098
3452
 
3099
 
KEY_CACHE *get_or_create_key_cache(const char *name, uint32_t length)
 
3453
KEY_CACHE *get_or_create_key_cache(const char *name, uint length)
3100
3454
{
3101
3455
  LEX_STRING key_cache_name;
3102
3456
  KEY_CACHE *key_cache;
3115
3469
                    KEY_CACHE *key_cache)
3116
3470
{
3117
3471
  ha_end_key_cache(key_cache);
3118
 
  free((char*) key_cache);
 
3472
  my_free((char*) key_cache, MYF(0));
3119
3473
}
3120
3474
 
3121
3475