~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to sql/set_var.cc

  • Committer: Monty Taylor
  • Date: 2008-07-09 15:52:52 UTC
  • mto: (77.6.1 glibclient-merge)
  • mto: This revision was merged to the branch mainline in revision 112.
  • Revision ID: monty@inaugust.com-20080709155252-lnzmxxje1g40z3a7
Warning fixes. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
97
97
static int  check_log_update(THD *thd, set_var *var);
98
98
static bool set_log_update(THD *thd, set_var *var);
99
99
static int  check_pseudo_thread_id(THD *thd, set_var *var);
100
 
void fix_binlog_format_after_update(THD *thd, enum_var_type type);
101
100
static void fix_low_priority_updates(THD *thd, enum_var_type type);
102
101
static int check_tx_isolation(THD *thd, set_var *var);
103
102
static void fix_tx_isolation(THD *thd, enum_var_type type);
652
651
};
653
652
 
654
653
 
655
 
bool sys_var::check(THD *thd, set_var *var)
 
654
bool sys_var::check(THD *thd __attribute__((__unused__)), set_var *var)
656
655
{
657
656
  var->save_result.ulonglong_value= var->value->val_int();
658
657
  return 0;
706
705
}
707
706
 
708
707
 
709
 
static bool sys_update_init_connect(THD *thd, set_var *var)
 
708
static bool sys_update_init_connect(THD *thd __attribute__((__unused__)), set_var *var)
710
709
{
711
710
  return update_sys_var_str(&sys_init_connect, &LOCK_sys_init_connect, var);
712
711
}
713
712
 
714
713
 
715
 
static void sys_default_init_connect(THD* thd, enum_var_type type)
 
714
static void sys_default_init_connect(THD* thd __attribute__((__unused__)),
 
715
                                     enum_var_type type __attribute__((__unused__)))
716
716
{
717
717
  update_sys_var_str(&sys_init_connect, &LOCK_sys_init_connect, 0);
718
718
}
719
719
 
720
720
 
721
 
static bool sys_update_init_slave(THD *thd, set_var *var)
 
721
static bool sys_update_init_slave(THD *thd __attribute__((__unused__)),
 
722
                                  set_var *var)
722
723
{
723
724
  return update_sys_var_str(&sys_init_slave, &LOCK_sys_init_slave, var);
724
725
}
725
726
 
726
727
 
727
 
static void sys_default_init_slave(THD* thd, enum_var_type type)
 
728
static void sys_default_init_slave(THD* thd __attribute__((__unused__)),
 
729
                                   enum_var_type type __attribute__((__unused__)))
728
730
{
729
731
  update_sys_var_str(&sys_init_slave, &LOCK_sys_init_slave, 0);
730
732
}
748
750
 
749
751
 
750
752
static void
751
 
fix_myisam_max_sort_file_size(THD *thd, enum_var_type type)
 
753
fix_myisam_max_sort_file_size(THD *thd __attribute__((__unused__)),
 
754
                              enum_var_type type __attribute__((__unused__)))
752
755
{
753
756
  myisam_max_temp_length=
754
757
    (my_off_t) global_system_variables.myisam_max_sort_file_size;
798
801
static void fix_completion_type(THD *thd __attribute__((unused)),
799
802
                                enum_var_type type __attribute__((unused))) {}
800
803
 
801
 
static int check_completion_type(THD *thd, set_var *var)
 
804
static int check_completion_type(THD *thd __attribute__((__unused__)),
 
805
                                 set_var *var)
802
806
{
803
807
  longlong val= var->value->val_int();
804
808
  if (val < 0 || val > 2)
847
851
#endif /* HAVE_REPLICATION */
848
852
 
849
853
 
850
 
extern void fix_delay_key_write(THD *thd, enum_var_type type)
 
854
extern void fix_delay_key_write(THD *thd __attribute__((__unused__)),
 
855
                                enum_var_type type __attribute__((__unused__)))
851
856
{
852
857
  switch ((enum_delay_key_write) delay_key_write_options) {
853
858
  case DELAY_KEY_WRITE_NONE:
863
868
  }
864
869
}
865
870
 
866
 
bool sys_var_set::update(THD *thd, set_var *var)
 
871
bool sys_var_set::update(THD *thd __attribute__((__unused__)),
 
872
                         set_var *var)
867
873
{
868
874
  *value= var->save_result.ulong_value;
869
875
  return 0;
870
876
}
871
877
 
872
 
uchar *sys_var_set::value_ptr(THD *thd, enum_var_type type,
873
 
                              LEX_STRING *base)
 
878
uchar *sys_var_set::value_ptr(THD *thd,
 
879
                              enum_var_type type __attribute__((__unused__)),
 
880
                              LEX_STRING *base __attribute__((__unused__)))
874
881
{
875
882
  char buff[256];
876
883
  String tmp(buff, sizeof(buff), &my_charset_latin1);
893
900
  return (uchar*) thd->strmake(tmp.ptr(), length);
894
901
}
895
902
 
896
 
void sys_var_set_slave_mode::set_default(THD *thd, enum_var_type type)
 
903
void sys_var_set_slave_mode::set_default(THD *thd __attribute__((__unused__)),
 
904
                                         enum_var_type type __attribute__((__unused__)))
897
905
{
898
906
  slave_exec_mode_options= 0;
899
907
  bit_do_set(slave_exec_mode_options, SLAVE_EXEC_MODE_STRICT);
921
929
  return rc;
922
930
}
923
931
 
924
 
void fix_slave_exec_mode(enum_var_type type)
 
932
void fix_slave_exec_mode(enum_var_type type __attribute__((__unused__)))
925
933
{
926
934
  DBUG_ENTER("fix_slave_exec_mode");
927
935
  compile_time_assert(sizeof(slave_exec_mode_options) * CHAR_BIT
972
980
}
973
981
 
974
982
 
975
 
void fix_binlog_format_after_update(THD *thd, enum_var_type type)
 
983
void fix_binlog_format_after_update(THD *thd,
 
984
                                    enum_var_type type __attribute__((__unused__)))
976
985
{
977
986
  thd->reset_current_stmt_binlog_row_based();
978
987
}
979
988
 
980
989
 
981
 
static void fix_max_binlog_size(THD *thd, enum_var_type type)
 
990
static void fix_max_binlog_size(THD *thd __attribute__((__unused__)),
 
991
                                enum_var_type type __attribute__((__unused__)))
982
992
{
983
993
  DBUG_ENTER("fix_max_binlog_size");
984
994
  DBUG_PRINT("info",("max_binlog_size=%lu max_relay_log_size=%lu",
991
1001
  DBUG_VOID_RETURN;
992
1002
}
993
1003
 
994
 
static void fix_max_relay_log_size(THD *thd, enum_var_type type)
 
1004
static void fix_max_relay_log_size(THD *thd __attribute__((__unused__)),
 
1005
                                   enum_var_type type __attribute__((__unused__)))
995
1006
{
996
1007
  DBUG_ENTER("fix_max_relay_log_size");
997
1008
  DBUG_PRINT("info",("max_binlog_size=%lu max_relay_log_size=%lu",
1003
1014
  DBUG_VOID_RETURN;
1004
1015
}
1005
1016
 
1006
 
static void fix_max_connections(THD *thd, enum_var_type type)
 
1017
static void fix_max_connections(THD *thd __attribute__((__unused__)),
 
1018
                                enum_var_type type __attribute__((__unused__)))
1007
1019
{
1008
1020
  resize_thr_alarm(max_connections +  10);
1009
1021
}
1027
1039
}
1028
1040
 
1029
1041
 
1030
 
static void fix_server_id(THD *thd, enum_var_type type)
 
1042
static void fix_server_id(THD *thd __attribute__((__unused__)),
 
1043
                          enum_var_type type __attribute__((__unused__)))
1031
1044
{
1032
1045
  server_id_supplied = 1;
1033
1046
  thd->server_id= server_id;
1063
1076
  return out;
1064
1077
}
1065
1078
 
1066
 
static bool get_unsigned(THD *thd, set_var *var)
 
1079
static bool get_unsigned(THD *thd __attribute__((__unused__)), set_var *var)
1067
1080
{
1068
1081
  if (var->value->unsigned_flag)
1069
1082
    var->save_result.ulonglong_value= (ulonglong) var->value->val_int();
1114
1127
}
1115
1128
 
1116
1129
 
1117
 
void sys_var_long_ptr_global::set_default(THD *thd, enum_var_type type)
 
1130
void sys_var_long_ptr_global::set_default(THD *thd __attribute__((__unused__)), enum_var_type type __attribute__((__unused__)))
1118
1131
{
1119
1132
  my_bool not_used;
1120
1133
  pthread_mutex_lock(guard);
1137
1150
}
1138
1151
 
1139
1152
 
1140
 
void sys_var_ulonglong_ptr::set_default(THD *thd, enum_var_type type)
 
1153
void sys_var_ulonglong_ptr::set_default(THD *thd __attribute__((__unused__)),
 
1154
                                        enum_var_type type __attribute__((__unused__)))
1141
1155
{
1142
1156
  my_bool not_used;
1143
1157
  pthread_mutex_lock(&LOCK_global_system_variables);
1147
1161
}
1148
1162
 
1149
1163
 
1150
 
bool sys_var_bool_ptr::update(THD *thd, set_var *var)
 
1164
bool sys_var_bool_ptr::update(THD *thd __attribute__((__unused__)), set_var *var)
1151
1165
{
1152
1166
  *value= (my_bool) var->save_result.ulong_value;
1153
1167
  return 0;
1154
1168
}
1155
1169
 
1156
1170
 
1157
 
void sys_var_bool_ptr::set_default(THD *thd, enum_var_type type)
 
1171
void sys_var_bool_ptr::set_default(THD *thd __attribute__((__unused__)), enum_var_type type __attribute__((__unused__)))
1158
1172
{
1159
1173
  *value= (my_bool) option_limits->def_value;
1160
1174
}
1161
1175
 
1162
1176
 
1163
 
bool sys_var_enum::update(THD *thd, set_var *var)
 
1177
bool sys_var_enum::update(THD *thd __attribute__((__unused__)), set_var *var)
1164
1178
{
1165
1179
  *value= (uint) var->save_result.ulong_value;
1166
1180
  return 0;
1167
1181
}
1168
1182
 
1169
1183
 
1170
 
uchar *sys_var_enum::value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
 
1184
uchar *sys_var_enum::value_ptr(THD *thd __attribute__((__unused__)),
 
1185
                               enum_var_type type __attribute__((__unused__)),
 
1186
                               LEX_STRING *base __attribute__((__unused__)))
1171
1187
{
1172
1188
  return (uchar*) enum_names->type_names[*value];
1173
1189
}
1174
1190
 
1175
1191
 
1176
 
uchar *sys_var_enum_const::value_ptr(THD *thd, enum_var_type type,
1177
 
                                     LEX_STRING *base)
 
1192
uchar *sys_var_enum_const::value_ptr(THD *thd __attribute__((__unused__)),
 
1193
                                     enum_var_type type __attribute__((__unused__)),
 
1194
                                     LEX_STRING *base __attribute__((__unused__)))
1178
1195
{
1179
1196
  return (uchar*) enum_names->type_names[global_system_variables.*offset];
1180
1197
}
1188
1205
bool sys_var_thd_ulong::update(THD *thd, set_var *var)
1189
1206
{
1190
1207
  ulonglong tmp= var->save_result.ulonglong_value;
1191
 
 
 
1208
  
1192
1209
  /* Don't use bigger value than given with --maximum-variable-name=.. */
1193
1210
  if ((ulong) tmp > max_system_variables.*offset)
1194
1211
  {
1195
1212
    throw_bounds_warning(thd, TRUE, TRUE, name, (longlong) tmp);
1196
1213
    tmp= max_system_variables.*offset;
1197
1214
  }
1198
 
 
 
1215
  
1199
1216
  if (option_limits)
1200
1217
    tmp= (ulong) fix_unsigned(thd, tmp, option_limits);
1201
1218
#if SIZEOF_LONG < SIZEOF_LONG_LONG
1205
1222
    throw_bounds_warning(thd, TRUE, TRUE, name, (longlong) var->save_result.ulonglong_value);
1206
1223
  }
1207
1224
#endif
1208
 
 
 
1225
  
1209
1226
  if (var->type == OPT_GLOBAL)
1210
 
    global_system_variables.*offset= (ulong) tmp;
1211
 
  else
1212
 
    thd->variables.*offset= (ulong) tmp;
1213
 
 
1214
 
  return 0;
1215
 
}
1216
 
 
1217
 
 
1218
 
void sys_var_thd_ulong::set_default(THD *thd, enum_var_type type)
1219
 
{
1220
 
  if (type == OPT_GLOBAL)
1221
 
  {
1222
 
    my_bool not_used;
1223
 
    /* We will not come here if option_limits is not set */
1224
 
    global_system_variables.*offset=
1225
 
      (ulong) getopt_ull_limit_value((ulong) option_limits->def_value,
1226
 
                                     option_limits, &not_used);
1227
 
  }
1228
 
  else
1229
 
    thd->variables.*offset= global_system_variables.*offset;
1230
 
}
 
1227
     global_system_variables.*offset= (ulong) tmp;
 
1228
   else
 
1229
     thd->variables.*offset= (ulong) tmp;
 
1230
 
 
1231
   return 0;
 
1232
 }
 
1233
 
 
1234
 
 
1235
 void sys_var_thd_ulong::set_default(THD *thd, enum_var_type type)
 
1236
 {
 
1237
   if (type == OPT_GLOBAL)
 
1238
   {
 
1239
     my_bool not_used;
 
1240
     /* We will not come here if option_limits is not set */
 
1241
     global_system_variables.*offset=
 
1242
       (ulong) getopt_ull_limit_value((ulong) option_limits->def_value,
 
1243
                                      option_limits, &not_used);
 
1244
   }
 
1245
   else
 
1246
     thd->variables.*offset= global_system_variables.*offset;
 
1247
 }
1231
1248
 
1232
1249
 
1233
1250
uchar *sys_var_thd_ulong::value_ptr(THD *thd, enum_var_type type,
1234
 
                                   LEX_STRING *base)
 
1251
                                    LEX_STRING *base __attribute__((__unused__)))
1235
1252
{
1236
1253
  if (type == OPT_GLOBAL)
1237
1254
    return (uchar*) &(global_system_variables.*offset);
1280
1297
 
1281
1298
 
1282
1299
uchar *sys_var_thd_ha_rows::value_ptr(THD *thd, enum_var_type type,
1283
 
                                     LEX_STRING *base)
 
1300
                                      LEX_STRING *base __attribute__((__unused__)))
1284
1301
{
1285
1302
  if (type == OPT_GLOBAL)
1286
1303
    return (uchar*) &(global_system_variables.*offset);
1331
1348
 
1332
1349
 
1333
1350
uchar *sys_var_thd_ulonglong::value_ptr(THD *thd, enum_var_type type,
1334
 
                                       LEX_STRING *base)
 
1351
                                        LEX_STRING *base __attribute__((__unused__)))
1335
1352
{
1336
1353
  if (type == OPT_GLOBAL)
1337
1354
    return (uchar*) &(global_system_variables.*offset);
1359
1376
 
1360
1377
 
1361
1378
uchar *sys_var_thd_bool::value_ptr(THD *thd, enum_var_type type,
1362
 
                                  LEX_STRING *base)
 
1379
                                   LEX_STRING *base __attribute__((__unused__)))
1363
1380
{
1364
1381
  if (type == OPT_GLOBAL)
1365
1382
    return (uchar*) &(global_system_variables.*offset);
1367
1384
}
1368
1385
 
1369
1386
 
1370
 
bool sys_var::check_enum(THD *thd, set_var *var, const TYPELIB *enum_names)
 
1387
bool sys_var::check_enum(THD *thd __attribute__((__unused__)),
 
1388
                         set_var *var, const TYPELIB *enum_names)
1371
1389
{
1372
1390
  char buff[STRING_BUFFER_USUAL_SIZE];
1373
1391
  const char *value;
1403
1421
}
1404
1422
 
1405
1423
 
1406
 
bool sys_var::check_set(THD *thd, set_var *var, TYPELIB *enum_names)
 
1424
bool sys_var::check_set(THD *thd __attribute__((__unused__)),
 
1425
                        set_var *var, TYPELIB *enum_names)
1407
1426
{
1408
1427
  bool not_used;
1409
1428
  char buff[STRING_BUFFER_USUAL_SIZE], *error= 0;
1602
1621
 
1603
1622
 
1604
1623
uchar *sys_var_thd_enum::value_ptr(THD *thd, enum_var_type type,
1605
 
                                  LEX_STRING *base)
 
1624
                                   LEX_STRING *base __attribute__((__unused__)))
1606
1625
{
1607
1626
  ulong tmp= ((type == OPT_GLOBAL) ?
1608
1627
              global_system_variables.*offset :
1623
1642
}
1624
1643
 
1625
1644
 
1626
 
uchar *sys_var_thd_bit::value_ptr(THD *thd, enum_var_type type,
1627
 
                                 LEX_STRING *base)
 
1645
uchar *sys_var_thd_bit::value_ptr(THD *thd,
 
1646
                                  enum_var_type type __attribute__((__unused__)),
 
1647
                                  LEX_STRING *base __attribute__((__unused__)))
1628
1648
{
1629
1649
  /*
1630
1650
    If reverse is 0 (default) return 1 if bit is set.
1724
1744
 
1725
1745
 
1726
1746
uchar *sys_var_thd_date_time_format::value_ptr(THD *thd, enum_var_type type,
1727
 
                                              LEX_STRING *base)
 
1747
                                               LEX_STRING *base __attribute__((__unused__)))
1728
1748
{
1729
1749
  if (type == OPT_GLOBAL)
1730
1750
  {
1776
1796
}
1777
1797
 
1778
1798
 
1779
 
bool sys_var_collation::check(THD *thd, set_var *var)
 
1799
bool sys_var_collation::check(THD *thd __attribute__((__unused__)),
 
1800
                              set_var *var)
1780
1801
{
1781
1802
  CHARSET_INFO *tmp;
1782
1803
 
1810
1831
}
1811
1832
 
1812
1833
 
1813
 
bool sys_var_character_set::check(THD *thd, set_var *var)
 
1834
bool sys_var_character_set::check(THD *thd __attribute__((__unused__)),
 
1835
                                  set_var *var)
1814
1836
{
1815
1837
  CHARSET_INFO *tmp;
1816
1838
 
1858
1880
 
1859
1881
 
1860
1882
uchar *sys_var_character_set::value_ptr(THD *thd, enum_var_type type,
1861
 
                                       LEX_STRING *base)
 
1883
                                        LEX_STRING *base __attribute__((__unused__)))
1862
1884
{
1863
1885
  CHARSET_INFO *cs= ci_ptr(thd,type)[0];
1864
1886
  return cs ? (uchar*) cs->csname : (uchar*) NULL;
1947
1969
 
1948
1970
 
1949
1971
uchar *sys_var_collation_sv::value_ptr(THD *thd, enum_var_type type,
1950
 
                                       LEX_STRING *base)
 
1972
                                       LEX_STRING *base __attribute__((__unused__)))
1951
1973
{
1952
1974
  CHARSET_INFO *cs= ((type == OPT_GLOBAL) ?
1953
1975
                     global_system_variables.*offset : thd->variables.*offset);
1969
1991
}
1970
1992
 
1971
1993
 
1972
 
uchar *sys_var_key_cache_param::value_ptr(THD *thd, enum_var_type type,
1973
 
                                         LEX_STRING *base)
 
1994
uchar *sys_var_key_cache_param::value_ptr(THD *thd __attribute__((__unused__)),
 
1995
                                          enum_var_type type __attribute__((__unused__)),
 
1996
                                          LEX_STRING *base __attribute__((__unused__)))
1974
1997
{
1975
1998
  KEY_CACHE *key_cache= get_key_cache(base);
1976
1999
  if (!key_cache)
2136
2159
  return res;
2137
2160
}
2138
2161
 
2139
 
void sys_var_log_state::set_default(THD *thd, enum_var_type type)
 
2162
void sys_var_log_state::set_default(THD *thd,
 
2163
                                    enum_var_type type __attribute__((__unused__)))
2140
2164
{
2141
2165
  pthread_mutex_lock(&LOCK_global_system_variables);
2142
2166
  logger.deactivate_log_handler(thd, log_type);
2144
2168
}
2145
2169
 
2146
2170
 
2147
 
static int  sys_check_log_path(THD *thd,  set_var *var)
 
2171
static int  sys_check_log_path(THD *thd __attribute__((__unused__)),
 
2172
                               set_var *var)
2148
2173
{
2149
2174
  char path[FN_REFLEN], buff[FN_REFLEN];
2150
2175
  struct stat f_stat;
2204
2229
}
2205
2230
 
2206
2231
 
2207
 
bool update_sys_var_str_path(THD *thd, sys_var_str *var_str,
2208
 
                             set_var *var, const char *log_ext,
2209
 
                             bool log_state, uint log_type)
 
2232
bool update_sys_var_str_path(THD *thd __attribute__((__unused__)),
 
2233
                             sys_var_str *var_str,
 
2234
                             set_var *var, const char *log_ext,
 
2235
                             bool log_state, uint log_type)
2210
2236
{
2211
2237
  MYSQL_QUERY_LOG *file_log;
2212
2238
  char buff[FN_REFLEN];
2269
2295
 
2270
2296
static bool sys_update_general_log_path(THD *thd, set_var * var)
2271
2297
{
2272
 
  return update_sys_var_str_path(thd, &sys_var_general_log_path, 
2273
 
                                 var, ".log", opt_log, QUERY_LOG_GENERAL);
 
2298
  return update_sys_var_str_path(thd, &sys_var_general_log_path,
 
2299
                                 var, ".log", opt_log, QUERY_LOG_GENERAL);
2274
2300
}
2275
2301
 
2276
2302
 
2277
 
static void sys_default_general_log_path(THD *thd, enum_var_type type)
 
2303
static void sys_default_general_log_path(THD *thd,
 
2304
                                         enum_var_type type __attribute__((__unused__)))
2278
2305
{
2279
2306
  (void) update_sys_var_str_path(thd, &sys_var_general_log_path,
2280
 
                                 0, ".log", opt_log, QUERY_LOG_GENERAL);
 
2307
                                 0, ".log", opt_log, QUERY_LOG_GENERAL);
2281
2308
}
2282
2309
 
2283
2310
 
2284
2311
static bool sys_update_slow_log_path(THD *thd, set_var * var)
2285
2312
{
2286
2313
  return update_sys_var_str_path(thd, &sys_var_slow_log_path,
2287
 
                                 var, "-slow.log", opt_slow_log,
 
2314
                                 var, "-slow.log", opt_slow_log,
2288
2315
                                 QUERY_LOG_SLOW);
2289
2316
}
2290
2317
 
2291
2318
 
2292
 
static void sys_default_slow_log_path(THD *thd, enum_var_type type)
 
2319
static void sys_default_slow_log_path(THD *thd,
 
2320
                                      enum_var_type type __attribute__((__unused__)))
2293
2321
{
2294
2322
  (void) update_sys_var_str_path(thd, &sys_var_slow_log_path,
2295
 
                                 0, "-slow.log", opt_slow_log,
 
2323
                                 0, "-slow.log", opt_slow_log,
2296
2324
                                 QUERY_LOG_SLOW);
2297
2325
}
2298
2326
 
2299
2327
 
2300
 
bool sys_var_log_output::update(THD *thd, set_var *var)
 
2328
bool sys_var_log_output::update(THD *thd __attribute__((__unused__)),
 
2329
                                set_var *var)
2301
2330
{
2302
2331
  pthread_mutex_lock(&LOCK_global_system_variables);
2303
2332
  logger.lock_exclusive();
2310
2339
}
2311
2340
 
2312
2341
 
2313
 
void sys_var_log_output::set_default(THD *thd, enum_var_type type)
 
2342
void sys_var_log_output::set_default(THD *thd __attribute__((__unused__)),
 
2343
                                     enum_var_type type __attribute__((__unused__)))
2314
2344
{
2315
2345
  pthread_mutex_lock(&LOCK_global_system_variables);
2316
2346
  logger.lock_exclusive();
2322
2352
}
2323
2353
 
2324
2354
 
2325
 
uchar *sys_var_log_output::value_ptr(THD *thd, enum_var_type type,
2326
 
                                    LEX_STRING *base)
 
2355
uchar *sys_var_log_output::value_ptr(THD *thd,
 
2356
                                     enum_var_type type __attribute__((__unused__)),
 
2357
                                     LEX_STRING *base __attribute__((__unused__)))
2327
2358
{
2328
2359
  char buff[256];
2329
2360
  String tmp(buff, sizeof(buff), &my_charset_latin1);
2351
2382
  Functions to handle SET NAMES and SET CHARACTER SET
2352
2383
*****************************************************************************/
2353
2384
 
2354
 
int set_var_collation_client::check(THD *thd)
 
2385
int set_var_collation_client::check(THD *thd __attribute__((__unused__)))
2355
2386
{
2356
2387
  /* Currently, UCS-2 cannot be used as a client character set */
2357
2388
  if (character_set_client->mbminlen > 1)
2382
2413
}
2383
2414
 
2384
2415
 
2385
 
void sys_var_timestamp::set_default(THD *thd, enum_var_type type)
 
2416
void sys_var_timestamp::set_default(THD *thd,
 
2417
                                    enum_var_type type __attribute__((__unused__)))
2386
2418
{
2387
2419
  thd->user_time=0;
2388
2420
}
2389
2421
 
2390
2422
 
2391
 
uchar *sys_var_timestamp::value_ptr(THD *thd, enum_var_type type,
2392
 
                                   LEX_STRING *base)
 
2423
uchar *sys_var_timestamp::value_ptr(THD *thd,
 
2424
                                    enum_var_type type __attribute__((__unused__)),
 
2425
                                    LEX_STRING *base __attribute__((__unused__)))
2393
2426
{
2394
2427
  thd->sys_var_tmp.long_value= (long) thd->start_time;
2395
2428
  return (uchar*) &thd->sys_var_tmp.long_value;
2398
2431
 
2399
2432
bool sys_var_last_insert_id::update(THD *thd, set_var *var)
2400
2433
{
2401
 
  thd->first_successful_insert_id_in_prev_stmt= 
 
2434
  thd->first_successful_insert_id_in_prev_stmt=
2402
2435
    var->save_result.ulonglong_value;
2403
2436
  return 0;
2404
2437
}
2405
2438
 
2406
2439
 
2407
 
uchar *sys_var_last_insert_id::value_ptr(THD *thd, enum_var_type type,
2408
 
                                        LEX_STRING *base)
 
2440
uchar *sys_var_last_insert_id::value_ptr(THD *thd,
 
2441
                                         enum_var_type type __attribute__((__unused__)),
 
2442
                                         LEX_STRING *base __attribute__((__unused__)))
2409
2443
{
2410
2444
  /*
2411
 
    this tmp var makes it robust againt change of type of 
 
2445
    this tmp var makes it robust againt change of type of
2412
2446
    read_first_successful_insert_id_in_prev_stmt().
2413
2447
  */
2414
2448
  thd->sys_var_tmp.ulonglong_value= 
2424
2458
}
2425
2459
 
2426
2460
 
2427
 
uchar *sys_var_insert_id::value_ptr(THD *thd, enum_var_type type,
2428
 
                                   LEX_STRING *base)
 
2461
uchar *sys_var_insert_id::value_ptr(THD *thd,
 
2462
                                    enum_var_type type __attribute__((__unused__)),
 
2463
                                    LEX_STRING *base __attribute__((__unused__)))
2429
2464
{
2430
 
  thd->sys_var_tmp.ulonglong_value= 
 
2465
  thd->sys_var_tmp.ulonglong_value=
2431
2466
    thd->auto_inc_intervals_forced.minimum();
2432
2467
  return (uchar*) &thd->sys_var_tmp.ulonglong_value;
2433
2468
}
2477
2512
 
2478
2513
 
2479
2514
uchar *sys_var_thd_time_zone::value_ptr(THD *thd, enum_var_type type,
2480
 
                                       LEX_STRING *base)
 
2515
                                        LEX_STRING *base __attribute__((__unused__)))
2481
2516
{
2482
2517
  /* 
2483
2518
    We can use ptr() instead of c_ptr() here because String contaning
2539
2574
  }
2540
2575
}
2541
2576
 
2542
 
bool sys_var_max_user_conn::update(THD *thd, set_var *var)
 
2577
bool sys_var_max_user_conn::update(THD *thd __attribute__((__unused__)),
 
2578
                                   set_var *var)
2543
2579
{
2544
2580
  DBUG_ASSERT(var->type == OPT_GLOBAL);
2545
2581
  pthread_mutex_lock(&LOCK_global_system_variables);
2549
2585
}
2550
2586
 
2551
2587
 
2552
 
void sys_var_max_user_conn::set_default(THD *thd, enum_var_type type)
 
2588
void sys_var_max_user_conn::set_default(THD *thd __attribute__((__unused__)),
 
2589
                                        enum_var_type type __attribute__((__unused__)))
2553
2590
{
2554
2591
  DBUG_ASSERT(type == OPT_GLOBAL);
2555
2592
  pthread_mutex_lock(&LOCK_global_system_variables);
2559
2596
 
2560
2597
 
2561
2598
uchar *sys_var_max_user_conn::value_ptr(THD *thd, enum_var_type type,
2562
 
                                       LEX_STRING *base)
 
2599
                                        LEX_STRING *base __attribute__((__unused__)))
2563
2600
{
2564
2601
  if (type != OPT_GLOBAL &&
2565
2602
      thd->user_connect && thd->user_connect->user_resources.user_conn)
2568
2605
}
2569
2606
 
2570
2607
 
2571
 
bool sys_var_thd_lc_time_names::check(THD *thd, set_var *var)
 
2608
bool sys_var_thd_lc_time_names::check(THD *thd __attribute__((__unused__)),
 
2609
                                      set_var *var)
2572
2610
{
2573
2611
  MY_LOCALE *locale_match;
2574
2612
 
2615
2653
}
2616
2654
 
2617
2655
 
2618
 
uchar *sys_var_thd_lc_time_names::value_ptr(THD *thd, enum_var_type type,
2619
 
                                          LEX_STRING *base)
 
2656
uchar *sys_var_thd_lc_time_names::value_ptr(THD *thd,
 
2657
                                            enum_var_type type,
 
2658
                                            LEX_STRING *base __attribute__((__unused__)))
2620
2659
{
2621
2660
  return type == OPT_GLOBAL ?
2622
2661
                 (uchar *) global_system_variables.lc_time_names->name :
2677
2716
 
2678
2717
 
2679
2718
uchar *sys_var_microseconds::value_ptr(THD *thd, enum_var_type type,
2680
 
                                          LEX_STRING *base)
 
2719
                                          LEX_STRING *base __attribute__((__unused__)))
2681
2720
{
2682
2721
  thd->tmp_double_value= (double) ((type == OPT_GLOBAL) ?
2683
2722
                                   global_system_variables.*offset :
2732
2771
  return 0;
2733
2772
}
2734
2773
 
2735
 
static int check_log_update(THD *thd, set_var *var)
 
2774
static int check_log_update(THD *thd __attribute__((__unused__)),
 
2775
                            set_var *var __attribute__((__unused__)))
2736
2776
{
2737
2777
  return 0;
2738
2778
}
2739
2779
 
2740
 
static bool set_log_update(THD *thd, set_var *var)
 
2780
static bool set_log_update(THD *thd __attribute__((__unused__)),
 
2781
                           set_var *var __attribute__((__unused__)))
2741
2782
{
2742
2783
  /*
2743
2784
    The update log is not supported anymore since 5.0.
2760
2801
}
2761
2802
 
2762
2803
 
2763
 
static int check_pseudo_thread_id(THD *thd, set_var *var)
 
2804
static int check_pseudo_thread_id(THD *thd __attribute__((__unused__)),
 
2805
                                  set_var *var)
2764
2806
{
2765
2807
  var->save_result.ulonglong_value= var->value->val_int();
2766
2808
  return 0;
2797
2839
  @retval
2798
2840
    ptr         pointer to NUL-terminated string
2799
2841
*/
2800
 
static uchar *get_tmpdir(THD *thd)
 
2842
static uchar *get_tmpdir(THD *thd __attribute__((__unused__)))
2801
2843
{
2802
2844
  if (opt_mysql_tmpdir)
2803
2845
    return (uchar *)opt_mysql_tmpdir;
2848
2890
*/
2849
2891
 
2850
2892
static uchar *get_sys_var_length(const sys_var *var, size_t *length,
2851
 
                                 my_bool first)
 
2893
                                 my_bool first __attribute__((__unused__)))
2852
2894
{
2853
2895
  *length= var->name_length;
2854
2896
  return (uchar*) var->name;
3230
3272
}
3231
3273
 
3232
3274
 
3233
 
int set_var_user::update(THD *thd)
 
3275
int set_var_user::update(THD *thd __attribute__((__unused__)))
3234
3276
{
3235
3277
  if (user_var_item->update())
3236
3278
  {
3279
3321
 
3280
3322
 
3281
3323
uchar *sys_var_thd_storage_engine::value_ptr(THD *thd, enum_var_type type,
3282
 
                                            LEX_STRING *base)
 
3324
                                             LEX_STRING *base __attribute__((__unused__)))
3283
3325
{
3284
3326
  uchar* result;
3285
3327
  handlerton *hton;
3361
3403
 
3362
3404
 
3363
3405
uchar *sys_var_thd_optimizer_switch::value_ptr(THD *thd, enum_var_type type,
3364
 
                                               LEX_STRING *base)
 
3406
                                               LEX_STRING *base __attribute__((__unused__)))
3365
3407
{
3366
3408
  LEX_STRING opts;
3367
3409
  ulonglong val= ((type == OPT_GLOBAL) ? global_system_variables.*offset :
3464
3506
}
3465
3507
 
3466
3508
 
3467
 
void free_key_cache(const char *name, KEY_CACHE *key_cache)
 
3509
void free_key_cache(const char *name __attribute__((__unused__)),
 
3510
                    KEY_CACHE *key_cache)
3468
3511
{
3469
3512
  ha_end_key_cache(key_cache);
3470
3513
  my_free((char*) key_cache, MYF(0));
3548
3591
  DBUG_RETURN(result);
3549
3592
}
3550
3593
 
3551
 
bool sys_var_thd_dbug::update(THD *thd, set_var *var)
 
3594
bool sys_var_thd_dbug::update(THD *thd __attribute__((__unused__)),
 
3595
                              set_var *var)
3552
3596
{
3553
3597
  if (var->type == OPT_GLOBAL)
3554
3598
  {
3563
3607
}
3564
3608
 
3565
3609
 
3566
 
uchar *sys_var_thd_dbug::value_ptr(THD *thd, enum_var_type type, LEX_STRING *b)
 
3610
uchar *sys_var_thd_dbug::value_ptr(THD *thd, enum_var_type type,
 
3611
                                   LEX_STRING *b __attribute__((__unused__)))
3567
3612
{
3568
3613
  char buf[256];
3569
3614
  if (type == OPT_GLOBAL)