~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/set_var.cc

Merged build changes from Antony.

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
#include "mysql_priv.h"
55
55
#include "slave.h"
56
56
#include "rpl_mi.h"
57
 
#include <my_getopt.h>
58
 
#include <thr_alarm.h>
59
 
#include <myisam.h>
60
 
#include <my_dir.h>
 
57
#include <mysys/my_getopt.h>
 
58
#include <mysys/thr_alarm.h>
 
59
#include <storage/myisam/myisam.h>
61
60
 
62
61
extern CHARSET_INFO *character_set_filesystem;
63
62
 
621
620
#endif
622
621
  {"log_bin",                 (char*) &opt_bin_log,                 SHOW_BOOL},
623
622
  {"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},
626
623
  {"myisam_recover_options",  (char*) &myisam_recover_options_str,  SHOW_CHAR_PTR},
627
624
  {"open_files_limit",        (char*) &open_files_limit,            SHOW_LONG},
628
625
  {"pid_file",                (char*) pidfile_name,                 SHOW_CHAR},
629
626
  {"plugin_dir",              (char*) opt_plugin_dir,               SHOW_CHAR},
630
627
  {"port",                    (char*) &mysqld_port,                 SHOW_INT},
631
628
  {"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},
634
629
  {"thread_stack",            (char*) &my_thread_stack_size,        SHOW_LONG},
635
630
};
636
631
 
637
632
 
638
 
bool sys_var::check(THD *thd __attribute__((__unused__)), set_var *var)
 
633
bool sys_var::check(THD *thd __attribute__((unused)), set_var *var)
639
634
{
640
635
  var->save_result.uint64_t_value= var->value->val_int();
641
636
  return 0;
689
684
}
690
685
 
691
686
 
692
 
static bool sys_update_init_connect(THD *thd __attribute__((__unused__)), set_var *var)
 
687
static bool sys_update_init_connect(THD *thd __attribute__((unused)), set_var *var)
693
688
{
694
689
  return update_sys_var_str(&sys_init_connect, &LOCK_sys_init_connect, var);
695
690
}
696
691
 
697
692
 
698
 
static void sys_default_init_connect(THD* thd __attribute__((__unused__)),
699
 
                                     enum_var_type type __attribute__((__unused__)))
 
693
static void sys_default_init_connect(THD* thd __attribute__((unused)),
 
694
                                     enum_var_type type __attribute__((unused)))
700
695
{
701
696
  update_sys_var_str(&sys_init_connect, &LOCK_sys_init_connect, 0);
702
697
}
703
698
 
704
699
 
705
 
static bool sys_update_init_slave(THD *thd __attribute__((__unused__)),
 
700
static bool sys_update_init_slave(THD *thd __attribute__((unused)),
706
701
                                  set_var *var)
707
702
{
708
703
  return update_sys_var_str(&sys_init_slave, &LOCK_sys_init_slave, var);
709
704
}
710
705
 
711
706
 
712
 
static void sys_default_init_slave(THD* thd __attribute__((__unused__)),
713
 
                                   enum_var_type type __attribute__((__unused__)))
 
707
static void sys_default_init_slave(THD* thd __attribute__((unused)),
 
708
                                   enum_var_type type __attribute__((unused)))
714
709
{
715
710
  update_sys_var_str(&sys_init_slave, &LOCK_sys_init_slave, 0);
716
711
}
734
729
 
735
730
 
736
731
static void
737
 
fix_myisam_max_sort_file_size(THD *thd __attribute__((__unused__)),
738
 
                              enum_var_type type __attribute__((__unused__)))
 
732
fix_myisam_max_sort_file_size(THD *thd __attribute__((unused)),
 
733
                              enum_var_type type __attribute__((unused)))
739
734
{
740
735
  myisam_max_temp_length=
741
736
    (my_off_t) global_system_variables.myisam_max_sort_file_size;
785
780
static void fix_completion_type(THD *thd __attribute__((unused)),
786
781
                                enum_var_type type __attribute__((unused))) {}
787
782
 
788
 
static int check_completion_type(THD *thd __attribute__((__unused__)),
 
783
static int check_completion_type(THD *thd __attribute__((unused)),
789
784
                                 set_var *var)
790
785
{
791
786
  int64_t val= var->value->val_int();
835
830
#endif /* HAVE_REPLICATION */
836
831
 
837
832
 
838
 
extern void fix_delay_key_write(THD *thd __attribute__((__unused__)),
839
 
                                enum_var_type type __attribute__((__unused__)))
 
833
extern void fix_delay_key_write(THD *thd __attribute__((unused)),
 
834
                                enum_var_type type __attribute__((unused)))
840
835
{
841
836
  switch ((enum_delay_key_write) delay_key_write_options) {
842
837
  case DELAY_KEY_WRITE_NONE:
852
847
  }
853
848
}
854
849
 
855
 
bool sys_var_set::update(THD *thd __attribute__((__unused__)),
 
850
bool sys_var_set::update(THD *thd __attribute__((unused)),
856
851
                         set_var *var)
857
852
{
858
853
  *value= var->save_result.ulong_value;
860
855
}
861
856
 
862
857
uchar *sys_var_set::value_ptr(THD *thd,
863
 
                              enum_var_type type __attribute__((__unused__)),
864
 
                              LEX_STRING *base __attribute__((__unused__)))
 
858
                              enum_var_type type __attribute__((unused)),
 
859
                              LEX_STRING *base __attribute__((unused)))
865
860
{
866
861
  char buff[256];
867
862
  String tmp(buff, sizeof(buff), &my_charset_latin1);
884
879
  return (uchar*) thd->strmake(tmp.ptr(), length);
885
880
}
886
881
 
887
 
void sys_var_set_slave_mode::set_default(THD *thd __attribute__((__unused__)),
888
 
                                         enum_var_type type __attribute__((__unused__)))
 
882
void sys_var_set_slave_mode::set_default(THD *thd __attribute__((unused)),
 
883
                                         enum_var_type type __attribute__((unused)))
889
884
{
890
885
  slave_exec_mode_options= 0;
891
886
  bit_do_set(slave_exec_mode_options, SLAVE_EXEC_MODE_STRICT);
913
908
  return rc;
914
909
}
915
910
 
916
 
void fix_slave_exec_mode(enum_var_type type __attribute__((__unused__)))
 
911
void fix_slave_exec_mode(enum_var_type type __attribute__((unused)))
917
912
{
918
913
  if (bit_is_set(slave_exec_mode_options, SLAVE_EXEC_MODE_STRICT) == 1 &&
919
914
      bit_is_set(slave_exec_mode_options, SLAVE_EXEC_MODE_IDEMPOTENT) == 1)
962
957
 
963
958
 
964
959
void fix_binlog_format_after_update(THD *thd,
965
 
                                    enum_var_type type __attribute__((__unused__)))
 
960
                                    enum_var_type type __attribute__((unused)))
966
961
{
967
962
  thd->reset_current_stmt_binlog_row_based();
968
963
}
969
964
 
970
965
 
971
 
static void fix_max_binlog_size(THD *thd __attribute__((__unused__)),
972
 
                                enum_var_type type __attribute__((__unused__)))
 
966
static void fix_max_binlog_size(THD *thd __attribute__((unused)),
 
967
                                enum_var_type type __attribute__((unused)))
973
968
{
974
969
  mysql_bin_log.set_max_size(max_binlog_size);
975
970
#ifdef HAVE_REPLICATION
979
974
  return;
980
975
}
981
976
 
982
 
static void fix_max_relay_log_size(THD *thd __attribute__((__unused__)),
983
 
                                   enum_var_type type __attribute__((__unused__)))
 
977
static void fix_max_relay_log_size(THD *thd __attribute__((unused)),
 
978
                                   enum_var_type type __attribute__((unused)))
984
979
{
985
980
#ifdef HAVE_REPLICATION
986
981
  active_mi->rli.relay_log.set_max_size(max_relay_log_size ?
989
984
  return;
990
985
}
991
986
 
992
 
static void fix_max_connections(THD *thd __attribute__((__unused__)),
993
 
                                enum_var_type type __attribute__((__unused__)))
 
987
static void fix_max_connections(THD *thd __attribute__((unused)),
 
988
                                enum_var_type type __attribute__((unused)))
994
989
{
995
990
  resize_thr_alarm(max_connections +  10);
996
991
}
1014
1009
}
1015
1010
 
1016
1011
 
1017
 
static void fix_server_id(THD *thd __attribute__((__unused__)),
1018
 
                          enum_var_type type __attribute__((__unused__)))
 
1012
static void fix_server_id(THD *thd __attribute__((unused)),
 
1013
                          enum_var_type type __attribute__((unused)))
1019
1014
{
1020
1015
  server_id_supplied = 1;
1021
1016
  thd->server_id= server_id;
1051
1046
  return out;
1052
1047
}
1053
1048
 
1054
 
static bool get_unsigned(THD *thd __attribute__((__unused__)), set_var *var)
 
1049
static bool get_unsigned(THD *thd __attribute__((unused)), set_var *var)
1055
1050
{
1056
1051
  if (var->value->unsigned_flag)
1057
1052
    var->save_result.uint64_t_value= (uint64_t) var->value->val_int();
1102
1097
}
1103
1098
 
1104
1099
 
1105
 
void sys_var_long_ptr_global::set_default(THD *thd __attribute__((__unused__)), enum_var_type type __attribute__((__unused__)))
 
1100
void sys_var_long_ptr_global::set_default(THD *thd __attribute__((unused)), enum_var_type type __attribute__((unused)))
1106
1101
{
1107
1102
  bool not_used;
1108
1103
  pthread_mutex_lock(guard);
1125
1120
}
1126
1121
 
1127
1122
 
1128
 
void sys_var_uint64_t_ptr::set_default(THD *thd __attribute__((__unused__)),
1129
 
                                        enum_var_type type __attribute__((__unused__)))
 
1123
void sys_var_uint64_t_ptr::set_default(THD *thd __attribute__((unused)),
 
1124
                                        enum_var_type type __attribute__((unused)))
1130
1125
{
1131
1126
  bool not_used;
1132
1127
  pthread_mutex_lock(&LOCK_global_system_variables);
1136
1131
}
1137
1132
 
1138
1133
 
1139
 
bool sys_var_bool_ptr::update(THD *thd __attribute__((__unused__)), set_var *var)
 
1134
bool sys_var_bool_ptr::update(THD *thd __attribute__((unused)), set_var *var)
1140
1135
{
1141
1136
  *value= (bool) var->save_result.ulong_value;
1142
1137
  return 0;
1143
1138
}
1144
1139
 
1145
1140
 
1146
 
void sys_var_bool_ptr::set_default(THD *thd __attribute__((__unused__)), enum_var_type type __attribute__((__unused__)))
 
1141
void sys_var_bool_ptr::set_default(THD *thd __attribute__((unused)), enum_var_type type __attribute__((unused)))
1147
1142
{
1148
1143
  *value= (bool) option_limits->def_value;
1149
1144
}
1150
1145
 
1151
1146
 
1152
 
bool sys_var_enum::update(THD *thd __attribute__((__unused__)), set_var *var)
 
1147
bool sys_var_enum::update(THD *thd __attribute__((unused)), set_var *var)
1153
1148
{
1154
1149
  *value= (uint) var->save_result.ulong_value;
1155
1150
  return 0;
1156
1151
}
1157
1152
 
1158
1153
 
1159
 
uchar *sys_var_enum::value_ptr(THD *thd __attribute__((__unused__)),
1160
 
                               enum_var_type type __attribute__((__unused__)),
1161
 
                               LEX_STRING *base __attribute__((__unused__)))
 
1154
uchar *sys_var_enum::value_ptr(THD *thd __attribute__((unused)),
 
1155
                               enum_var_type type __attribute__((unused)),
 
1156
                               LEX_STRING *base __attribute__((unused)))
1162
1157
{
1163
1158
  return (uchar*) enum_names->type_names[*value];
1164
1159
}
1165
1160
 
1166
1161
 
1167
 
uchar *sys_var_enum_const::value_ptr(THD *thd __attribute__((__unused__)),
1168
 
                                     enum_var_type type __attribute__((__unused__)),
1169
 
                                     LEX_STRING *base __attribute__((__unused__)))
 
1162
uchar *sys_var_enum_const::value_ptr(THD *thd __attribute__((unused)),
 
1163
                                     enum_var_type type __attribute__((unused)),
 
1164
                                     LEX_STRING *base __attribute__((unused)))
1170
1165
{
1171
1166
  return (uchar*) enum_names->type_names[global_system_variables.*offset];
1172
1167
}
1223
1218
 
1224
1219
 
1225
1220
uchar *sys_var_thd_ulong::value_ptr(THD *thd, enum_var_type type,
1226
 
                                    LEX_STRING *base __attribute__((__unused__)))
 
1221
                                    LEX_STRING *base __attribute__((unused)))
1227
1222
{
1228
1223
  if (type == OPT_GLOBAL)
1229
1224
    return (uchar*) &(global_system_variables.*offset);
1272
1267
 
1273
1268
 
1274
1269
uchar *sys_var_thd_ha_rows::value_ptr(THD *thd, enum_var_type type,
1275
 
                                      LEX_STRING *base __attribute__((__unused__)))
 
1270
                                      LEX_STRING *base __attribute__((unused)))
1276
1271
{
1277
1272
  if (type == OPT_GLOBAL)
1278
1273
    return (uchar*) &(global_system_variables.*offset);
1323
1318
 
1324
1319
 
1325
1320
uchar *sys_var_thd_uint64_t::value_ptr(THD *thd, enum_var_type type,
1326
 
                                        LEX_STRING *base __attribute__((__unused__)))
 
1321
                                        LEX_STRING *base __attribute__((unused)))
1327
1322
{
1328
1323
  if (type == OPT_GLOBAL)
1329
1324
    return (uchar*) &(global_system_variables.*offset);
1351
1346
 
1352
1347
 
1353
1348
uchar *sys_var_thd_bool::value_ptr(THD *thd, enum_var_type type,
1354
 
                                   LEX_STRING *base __attribute__((__unused__)))
 
1349
                                   LEX_STRING *base __attribute__((unused)))
1355
1350
{
1356
1351
  if (type == OPT_GLOBAL)
1357
1352
    return (uchar*) &(global_system_variables.*offset);
1359
1354
}
1360
1355
 
1361
1356
 
1362
 
bool sys_var::check_enum(THD *thd __attribute__((__unused__)),
 
1357
bool sys_var::check_enum(THD *thd __attribute__((unused)),
1363
1358
                         set_var *var, const TYPELIB *enum_names)
1364
1359
{
1365
1360
  char buff[STRING_BUFFER_USUAL_SIZE];
1396
1391
}
1397
1392
 
1398
1393
 
1399
 
bool sys_var::check_set(THD *thd __attribute__((__unused__)),
 
1394
bool sys_var::check_set(THD *thd __attribute__((unused)),
1400
1395
                        set_var *var, TYPELIB *enum_names)
1401
1396
{
1402
1397
  bool not_used;
1528
1523
  }
1529
1524
  case SHOW_MY_BOOL:
1530
1525
  {
1531
 
    int32 value;
 
1526
    int32_t value;
1532
1527
    pthread_mutex_lock(&LOCK_global_system_variables);
1533
1528
    value= *(bool*) value_ptr(thd, var_type, base);
1534
1529
    pthread_mutex_unlock(&LOCK_global_system_variables);
1596
1591
 
1597
1592
 
1598
1593
uchar *sys_var_thd_enum::value_ptr(THD *thd, enum_var_type type,
1599
 
                                   LEX_STRING *base __attribute__((__unused__)))
 
1594
                                   LEX_STRING *base __attribute__((unused)))
1600
1595
{
1601
1596
  ulong tmp= ((type == OPT_GLOBAL) ?
1602
1597
              global_system_variables.*offset :
1618
1613
 
1619
1614
 
1620
1615
uchar *sys_var_thd_bit::value_ptr(THD *thd,
1621
 
                                  enum_var_type type __attribute__((__unused__)),
1622
 
                                  LEX_STRING *base __attribute__((__unused__)))
 
1616
                                  enum_var_type type __attribute__((unused)),
 
1617
                                  LEX_STRING *base __attribute__((unused)))
1623
1618
{
1624
1619
  /*
1625
1620
    If reverse is 0 (default) return 1 if bit is set.
1716
1711
 
1717
1712
 
1718
1713
uchar *sys_var_thd_date_time_format::value_ptr(THD *thd, enum_var_type type,
1719
 
                                               LEX_STRING *base __attribute__((__unused__)))
 
1714
                                               LEX_STRING *base __attribute__((unused)))
1720
1715
{
1721
1716
  if (type == OPT_GLOBAL)
1722
1717
  {
1768
1763
}
1769
1764
 
1770
1765
 
1771
 
bool sys_var_collation::check(THD *thd __attribute__((__unused__)),
 
1766
bool sys_var_collation::check(THD *thd __attribute__((unused)),
1772
1767
                              set_var *var)
1773
1768
{
1774
1769
  CHARSET_INFO *tmp;
1803
1798
}
1804
1799
 
1805
1800
 
1806
 
bool sys_var_character_set::check(THD *thd __attribute__((__unused__)),
 
1801
bool sys_var_character_set::check(THD *thd __attribute__((unused)),
1807
1802
                                  set_var *var)
1808
1803
{
1809
1804
  CHARSET_INFO *tmp;
1852
1847
 
1853
1848
 
1854
1849
uchar *sys_var_character_set::value_ptr(THD *thd, enum_var_type type,
1855
 
                                        LEX_STRING *base __attribute__((__unused__)))
 
1850
                                        LEX_STRING *base __attribute__((unused)))
1856
1851
{
1857
1852
  CHARSET_INFO *cs= ci_ptr(thd,type)[0];
1858
1853
  return cs ? (uchar*) cs->csname : (uchar*) NULL;
1941
1936
 
1942
1937
 
1943
1938
uchar *sys_var_collation_sv::value_ptr(THD *thd, enum_var_type type,
1944
 
                                       LEX_STRING *base __attribute__((__unused__)))
 
1939
                                       LEX_STRING *base __attribute__((unused)))
1945
1940
{
1946
1941
  CHARSET_INFO *cs= ((type == OPT_GLOBAL) ?
1947
1942
                     global_system_variables.*offset : thd->variables.*offset);
1963
1958
}
1964
1959
 
1965
1960
 
1966
 
uchar *sys_var_key_cache_param::value_ptr(THD *thd __attribute__((__unused__)),
1967
 
                                          enum_var_type type __attribute__((__unused__)),
1968
 
                                          LEX_STRING *base __attribute__((__unused__)))
 
1961
uchar *sys_var_key_cache_param::value_ptr(THD *thd __attribute__((unused)),
 
1962
                                          enum_var_type type __attribute__((unused)),
 
1963
                                          LEX_STRING *base __attribute__((unused)))
1969
1964
{
1970
1965
  KEY_CACHE *key_cache= get_key_cache(base);
1971
1966
  if (!key_cache)
2132
2127
}
2133
2128
 
2134
2129
void sys_var_log_state::set_default(THD *thd,
2135
 
                                    enum_var_type type __attribute__((__unused__)))
 
2130
                                    enum_var_type type __attribute__((unused)))
2136
2131
{
2137
2132
  pthread_mutex_lock(&LOCK_global_system_variables);
2138
2133
  logger.deactivate_log_handler(thd, log_type);
2140
2135
}
2141
2136
 
2142
2137
 
2143
 
static int  sys_check_log_path(THD *thd __attribute__((__unused__)),
 
2138
static int  sys_check_log_path(THD *thd __attribute__((unused)),
2144
2139
                               set_var *var)
2145
2140
{
2146
2141
  char path[FN_REFLEN], buff[FN_REFLEN];
2153
2148
    goto err;
2154
2149
 
2155
2150
  log_file_str= res->c_ptr();
2156
 
  bzero(&f_stat, sizeof(struct stat));
 
2151
  memset(&f_stat, 0, sizeof(struct stat));
2157
2152
 
2158
2153
  path_length= unpack_filename(path, log_file_str);
2159
2154
 
2171
2166
      'write' permission.
2172
2167
    */
2173
2168
 
2174
 
    if (!MY_S_ISREG(f_stat.st_mode) ||
2175
 
        !(f_stat.st_mode & MY_S_IWRITE))
 
2169
    if (!S_ISREG(f_stat.st_mode) ||
 
2170
        !(f_stat.st_mode & S_IWRITE))
2176
2171
      goto err;
2177
2172
 
2178
2173
    return 0;
2201
2196
}
2202
2197
 
2203
2198
 
2204
 
bool update_sys_var_str_path(THD *thd __attribute__((__unused__)),
 
2199
bool update_sys_var_str_path(THD *thd __attribute__((unused)),
2205
2200
                             sys_var_str *var_str,
2206
2201
                             set_var *var, const char *log_ext,
2207
2202
                             bool log_state, uint log_type)
2273
2268
 
2274
2269
 
2275
2270
static void sys_default_general_log_path(THD *thd,
2276
 
                                         enum_var_type type __attribute__((__unused__)))
 
2271
                                         enum_var_type type __attribute__((unused)))
2277
2272
{
2278
2273
  (void) update_sys_var_str_path(thd, &sys_var_general_log_path,
2279
2274
                                 0, ".log", opt_log, QUERY_LOG_GENERAL);
2289
2284
 
2290
2285
 
2291
2286
static void sys_default_slow_log_path(THD *thd,
2292
 
                                      enum_var_type type __attribute__((__unused__)))
 
2287
                                      enum_var_type type __attribute__((unused)))
2293
2288
{
2294
2289
  (void) update_sys_var_str_path(thd, &sys_var_slow_log_path,
2295
2290
                                 0, "-slow.log", opt_slow_log,
2297
2292
}
2298
2293
 
2299
2294
 
2300
 
bool sys_var_log_output::update(THD *thd __attribute__((__unused__)),
 
2295
bool sys_var_log_output::update(THD *thd __attribute__((unused)),
2301
2296
                                set_var *var)
2302
2297
{
2303
2298
  pthread_mutex_lock(&LOCK_global_system_variables);
2311
2306
}
2312
2307
 
2313
2308
 
2314
 
void sys_var_log_output::set_default(THD *thd __attribute__((__unused__)),
2315
 
                                     enum_var_type type __attribute__((__unused__)))
 
2309
void sys_var_log_output::set_default(THD *thd __attribute__((unused)),
 
2310
                                     enum_var_type type __attribute__((unused)))
2316
2311
{
2317
2312
  pthread_mutex_lock(&LOCK_global_system_variables);
2318
2313
  logger.lock_exclusive();
2325
2320
 
2326
2321
 
2327
2322
uchar *sys_var_log_output::value_ptr(THD *thd,
2328
 
                                     enum_var_type type __attribute__((__unused__)),
2329
 
                                     LEX_STRING *base __attribute__((__unused__)))
 
2323
                                     enum_var_type type __attribute__((unused)),
 
2324
                                     LEX_STRING *base __attribute__((unused)))
2330
2325
{
2331
2326
  char buff[256];
2332
2327
  String tmp(buff, sizeof(buff), &my_charset_latin1);
2354
2349
  Functions to handle SET NAMES and SET CHARACTER SET
2355
2350
*****************************************************************************/
2356
2351
 
2357
 
int set_var_collation_client::check(THD *thd __attribute__((__unused__)))
 
2352
int set_var_collation_client::check(THD *thd __attribute__((unused)))
2358
2353
{
2359
2354
  /* Currently, UCS-2 cannot be used as a client character set */
2360
2355
  if (character_set_client->mbminlen > 1)
2386
2381
 
2387
2382
 
2388
2383
void sys_var_timestamp::set_default(THD *thd,
2389
 
                                    enum_var_type type __attribute__((__unused__)))
 
2384
                                    enum_var_type type __attribute__((unused)))
2390
2385
{
2391
2386
  thd->user_time=0;
2392
2387
}
2393
2388
 
2394
2389
 
2395
2390
uchar *sys_var_timestamp::value_ptr(THD *thd,
2396
 
                                    enum_var_type type __attribute__((__unused__)),
2397
 
                                    LEX_STRING *base __attribute__((__unused__)))
 
2391
                                    enum_var_type type __attribute__((unused)),
 
2392
                                    LEX_STRING *base __attribute__((unused)))
2398
2393
{
2399
2394
  thd->sys_var_tmp.long_value= (long) thd->start_time;
2400
2395
  return (uchar*) &thd->sys_var_tmp.long_value;
2410
2405
 
2411
2406
 
2412
2407
uchar *sys_var_last_insert_id::value_ptr(THD *thd,
2413
 
                                         enum_var_type type __attribute__((__unused__)),
2414
 
                                         LEX_STRING *base __attribute__((__unused__)))
 
2408
                                         enum_var_type type __attribute__((unused)),
 
2409
                                         LEX_STRING *base __attribute__((unused)))
2415
2410
{
2416
2411
  /*
2417
2412
    this tmp var makes it robust againt change of type of
2431
2426
 
2432
2427
 
2433
2428
uchar *sys_var_insert_id::value_ptr(THD *thd,
2434
 
                                    enum_var_type type __attribute__((__unused__)),
2435
 
                                    LEX_STRING *base __attribute__((__unused__)))
 
2429
                                    enum_var_type type __attribute__((unused)),
 
2430
                                    LEX_STRING *base __attribute__((unused)))
2436
2431
{
2437
2432
  thd->sys_var_tmp.uint64_t_value=
2438
2433
    thd->auto_inc_intervals_forced.minimum();
2484
2479
 
2485
2480
 
2486
2481
uchar *sys_var_thd_time_zone::value_ptr(THD *thd, enum_var_type type,
2487
 
                                        LEX_STRING *base __attribute__((__unused__)))
 
2482
                                        LEX_STRING *base __attribute__((unused)))
2488
2483
{
2489
2484
  /* 
2490
2485
    We can use ptr() instead of c_ptr() here because String contaning
2546
2541
  }
2547
2542
}
2548
2543
 
2549
 
bool sys_var_max_user_conn::update(THD *thd __attribute__((__unused__)),
 
2544
bool sys_var_max_user_conn::update(THD *thd __attribute__((unused)),
2550
2545
                                   set_var *var)
2551
2546
{
2552
2547
  assert(var->type == OPT_GLOBAL);
2557
2552
}
2558
2553
 
2559
2554
 
2560
 
void sys_var_max_user_conn::set_default(THD *thd __attribute__((__unused__)),
2561
 
                                        enum_var_type type __attribute__((__unused__)))
 
2555
void sys_var_max_user_conn::set_default(THD *thd __attribute__((unused)),
 
2556
                                        enum_var_type type __attribute__((unused)))
2562
2557
{
2563
2558
  assert(type == OPT_GLOBAL);
2564
2559
  pthread_mutex_lock(&LOCK_global_system_variables);
2568
2563
 
2569
2564
 
2570
2565
uchar *sys_var_max_user_conn::value_ptr(THD *thd, enum_var_type type,
2571
 
                                        LEX_STRING *base __attribute__((__unused__)))
 
2566
                                        LEX_STRING *base __attribute__((unused)))
2572
2567
{
2573
2568
  if (type != OPT_GLOBAL &&
2574
2569
      thd->user_connect && thd->user_connect->user_resources.user_conn)
2577
2572
}
2578
2573
 
2579
2574
 
2580
 
bool sys_var_thd_lc_time_names::check(THD *thd __attribute__((__unused__)),
 
2575
bool sys_var_thd_lc_time_names::check(THD *thd __attribute__((unused)),
2581
2576
                                      set_var *var)
2582
2577
{
2583
2578
  MY_LOCALE *locale_match;
2627
2622
 
2628
2623
uchar *sys_var_thd_lc_time_names::value_ptr(THD *thd,
2629
2624
                                            enum_var_type type,
2630
 
                                            LEX_STRING *base __attribute__((__unused__)))
 
2625
                                            LEX_STRING *base __attribute__((unused)))
2631
2626
{
2632
2627
  return type == OPT_GLOBAL ?
2633
2628
                 (uchar *) global_system_variables.lc_time_names->name :
2688
2683
 
2689
2684
 
2690
2685
uchar *sys_var_microseconds::value_ptr(THD *thd, enum_var_type type,
2691
 
                                          LEX_STRING *base __attribute__((__unused__)))
 
2686
                                          LEX_STRING *base __attribute__((unused)))
2692
2687
{
2693
2688
  thd->tmp_double_value= (double) ((type == OPT_GLOBAL) ?
2694
2689
                                   global_system_variables.*offset :
2743
2738
  return 0;
2744
2739
}
2745
2740
 
2746
 
static int check_log_update(THD *thd __attribute__((__unused__)),
2747
 
                            set_var *var __attribute__((__unused__)))
 
2741
static int check_log_update(THD *thd __attribute__((unused)),
 
2742
                            set_var *var __attribute__((unused)))
2748
2743
{
2749
2744
  return 0;
2750
2745
}
2751
2746
 
2752
 
static bool set_log_update(THD *thd __attribute__((__unused__)),
2753
 
                           set_var *var __attribute__((__unused__)))
 
2747
static bool set_log_update(THD *thd __attribute__((unused)),
 
2748
                           set_var *var __attribute__((unused)))
2754
2749
{
2755
2750
  /*
2756
2751
    The update log is not supported anymore since 5.0.
2773
2768
}
2774
2769
 
2775
2770
 
2776
 
static int check_pseudo_thread_id(THD *thd __attribute__((__unused__)),
 
2771
static int check_pseudo_thread_id(THD *thd __attribute__((unused)),
2777
2772
                                  set_var *var)
2778
2773
{
2779
2774
  var->save_result.uint64_t_value= var->value->val_int();
2811
2806
  @retval
2812
2807
    ptr         pointer to NUL-terminated string
2813
2808
*/
2814
 
static uchar *get_tmpdir(THD *thd __attribute__((__unused__)))
 
2809
static uchar *get_tmpdir(THD *thd __attribute__((unused)))
2815
2810
{
2816
2811
  if (opt_mysql_tmpdir)
2817
2812
    return (uchar *)opt_mysql_tmpdir;
2862
2857
*/
2863
2858
 
2864
2859
static uchar *get_sys_var_length(const sys_var *var, size_t *length,
2865
 
                                 bool first __attribute__((__unused__)))
 
2860
                                 bool first __attribute__((unused)))
2866
2861
{
2867
2862
  *length= var->name_length;
2868
2863
  return (uchar*) var->name;
2978
2973
               (qsort_cmp) show_cmp);
2979
2974
    
2980
2975
    /* make last element empty */
2981
 
    bzero(show, sizeof(SHOW_VAR));
 
2976
    memset(show, 0, sizeof(SHOW_VAR));
2982
2977
  }
2983
2978
  return result;
2984
2979
}
3234
3229
}
3235
3230
 
3236
3231
 
3237
 
int set_var_user::update(THD *thd __attribute__((__unused__)))
 
3232
int set_var_user::update(THD *thd __attribute__((unused)))
3238
3233
{
3239
3234
  if (user_var_item->update())
3240
3235
  {
3283
3278
 
3284
3279
 
3285
3280
uchar *sys_var_thd_storage_engine::value_ptr(THD *thd, enum_var_type type,
3286
 
                                             LEX_STRING *base __attribute__((__unused__)))
 
3281
                                             LEX_STRING *base __attribute__((unused)))
3287
3282
{
3288
3283
  uchar* result;
3289
3284
  handlerton *hton;
3365
3360
 
3366
3361
 
3367
3362
uchar *sys_var_thd_optimizer_switch::value_ptr(THD *thd, enum_var_type type,
3368
 
                                               LEX_STRING *base __attribute__((__unused__)))
 
3363
                                               LEX_STRING *base __attribute__((unused)))
3369
3364
{
3370
3365
  LEX_STRING opts;
3371
3366
  uint64_t val= ((type == OPT_GLOBAL) ? global_system_variables.*offset :
3465
3460
}
3466
3461
 
3467
3462
 
3468
 
void free_key_cache(const char *name __attribute__((__unused__)),
 
3463
void free_key_cache(const char *name __attribute__((unused)),
3469
3464
                    KEY_CACHE *key_cache)
3470
3465
{
3471
3466
  ha_end_key_cache(key_cache);