~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/set_var.cc

  • Committer: Brian Aker
  • Date: 2008-11-25 16:51:19 UTC
  • Revision ID: brian@tangent.org-20081125165119-e0p27zl7jcto1see
Added 32bit system variable support

Show diffs side-by-side

added added

removed removed

Lines of Context:
234
234
static sys_var_session_ha_rows  sys_max_join_size(&vars, "max_join_size",
235
235
                                          &SV::max_join_size,
236
236
                                          fix_max_join_size);
237
 
static sys_var_session_ulong    sys_max_seeks_for_key(&vars, "max_seeks_for_key",
238
 
                                              &SV::max_seeks_for_key);
239
 
static sys_var_session_ulong   sys_max_length_for_sort_data(&vars, "max_length_for_sort_data",
240
 
                                                 &SV::max_length_for_sort_data);
 
237
static sys_var_session_uint32_t sys_max_seeks_for_key(&vars, "max_seeks_for_key",
 
238
                                                      &SV::max_seeks_for_key);
 
239
static sys_var_session_uint64_t   sys_max_length_for_sort_data(&vars, "max_length_for_sort_data",
 
240
                                                               &SV::max_length_for_sort_data);
241
241
static sys_var_long_ptr sys_max_relay_log_size(&vars, "max_relay_log_size",
242
242
                                               &max_relay_log_size,
243
243
                                               fix_max_relay_log_size);
244
 
static sys_var_session_ulong    sys_max_sort_length(&vars, "max_sort_length",
245
 
                                            &SV::max_sort_length);
246
 
static sys_var_session_ulong    sys_max_tmp_tables(&vars, "max_tmp_tables",
247
 
                                           &SV::max_tmp_tables);
 
244
static sys_var_session_uint32_t sys_max_sort_length(&vars, "max_sort_length",
 
245
                                                    &SV::max_sort_length);
 
246
static sys_var_session_uint64_t sys_max_tmp_tables(&vars, "max_tmp_tables",
 
247
                                                   &SV::max_tmp_tables);
248
248
static sys_var_long_ptr sys_max_write_lock_count(&vars, "max_write_lock_count",
249
249
                                                 &max_write_lock_count);
250
250
static sys_var_session_ulong       sys_min_examined_row_limit(&vars, "min_examined_row_limit",
300
300
static sys_var_session_ulong    sys_div_precincrement(&vars, "div_precision_increment",
301
301
                                              &SV::div_precincrement);
302
302
 
303
 
static sys_var_session_ulong    sys_range_alloc_block_size(&vars, "range_alloc_block_size",
304
 
                                                   &SV::range_alloc_block_size);
305
 
static sys_var_session_ulong    sys_query_alloc_block_size(&vars, "query_alloc_block_size",
306
 
                                                   &SV::query_alloc_block_size,
307
 
                                                   0, fix_session_mem_root);
308
 
static sys_var_session_ulong    sys_query_prealloc_size(&vars, "query_prealloc_size",
309
 
                                                &SV::query_prealloc_size,
310
 
                                                0, fix_session_mem_root);
 
303
static sys_var_session_uint32_t sys_range_alloc_block_size(&vars, "range_alloc_block_size",
 
304
                                                           &SV::range_alloc_block_size);
 
305
static sys_var_session_uint32_t sys_query_alloc_block_size(&vars, "query_alloc_block_size",
 
306
                                                           &SV::query_alloc_block_size,
 
307
                                                           0, fix_session_mem_root);
 
308
static sys_var_session_uint32_t sys_query_prealloc_size(&vars, "query_prealloc_size",
 
309
                                                        &SV::query_prealloc_size,
 
310
                                                        0, fix_session_mem_root);
311
311
static sys_var_readonly        sys_tmpdir(&vars, "tmpdir", OPT_GLOBAL, SHOW_CHAR, get_tmpdir);
312
 
static sys_var_session_ulong    sys_trans_alloc_block_size(&vars, "transaction_alloc_block_size",
313
 
                                                   &SV::trans_alloc_block_size,
314
 
                                                   0, fix_trans_mem_root);
315
 
static sys_var_session_ulong    sys_trans_prealloc_size(&vars, "transaction_prealloc_size",
316
 
                                                &SV::trans_prealloc_size,
317
 
                                                0, fix_trans_mem_root);
 
312
static sys_var_session_uint32_t sys_trans_alloc_block_size(&vars, "transaction_alloc_block_size",
 
313
                                                           &SV::trans_alloc_block_size,
 
314
                                                           0, fix_trans_mem_root);
 
315
static sys_var_session_uint32_t sys_trans_prealloc_size(&vars, "transaction_prealloc_size",
 
316
                                                        &SV::trans_prealloc_size,
 
317
                                                        0, fix_trans_mem_root);
318
318
 
319
319
static sys_var_const_str_ptr sys_secure_file_priv(&vars, "secure_file_priv",
320
320
                                             &opt_secure_file_priv);
482
482
static sys_var_rand_seed2 sys_rand_seed2(&vars, "rand_seed2",
483
483
                                         sys_var::SESSION_VARIABLE_IN_BINLOG);
484
484
 
485
 
static sys_var_session_ulong        sys_default_week_format(&vars, "default_week_format",
486
 
                                                        &SV::default_week_format);
 
485
static sys_var_session_uint32_t sys_default_week_format(&vars, "default_week_format",
 
486
                                                        &SV::default_week_format);
487
487
 
488
 
sys_var_session_ulong               sys_group_concat_max_len(&vars, "group_concat_max_len",
489
 
                                                         &SV::group_concat_max_len);
 
488
sys_var_session_uint32_t sys_group_concat_max_len(&vars, "group_concat_max_len",
 
489
                                               &SV::group_concat_max_len);
490
490
 
491
491
sys_var_session_time_zone sys_time_zone(&vars, "time_zone",
492
492
                                    sys_var::SESSION_VARIABLE_IN_BINLOG);
1068
1068
  return (unsigned char*) &(session->variables.*offset);
1069
1069
}
1070
1070
 
 
1071
/*
 
1072
  32 bit types for session variables 
 
1073
*/
 
1074
bool sys_var_session_uint32_t::check(Session *session, set_var *var)
 
1075
{
 
1076
  return (get_unsigned(session, var) ||
 
1077
          (check_func && (*check_func)(session, var)));
 
1078
}
 
1079
 
 
1080
bool sys_var_session_uint32_t::update(Session *session, set_var *var)
 
1081
{
 
1082
  uint64_t tmp= var->save_result.uint64_t_value;
 
1083
  
 
1084
  /* Don't use bigger value than given with --maximum-variable-name=.. */
 
1085
  if ((uint32_t) tmp > max_system_variables.*offset)
 
1086
  {
 
1087
    throw_bounds_warning(session, true, true, name, (int64_t) tmp);
 
1088
    tmp= max_system_variables.*offset;
 
1089
  }
 
1090
  
 
1091
  if (option_limits)
 
1092
    tmp= (uint32_t) fix_unsigned(session, tmp, option_limits);
 
1093
  else if (tmp > UINT32_MAX)
 
1094
  {
 
1095
    tmp= UINT32_MAX;
 
1096
    throw_bounds_warning(session, true, true, name, (int64_t) var->save_result.uint64_t_value);
 
1097
  }
 
1098
  
 
1099
  if (var->type == OPT_GLOBAL)
 
1100
     global_system_variables.*offset= (uint32_t) tmp;
 
1101
   else
 
1102
     session->variables.*offset= (uint32_t) tmp;
 
1103
 
 
1104
   return 0;
 
1105
 }
 
1106
 
 
1107
 
 
1108
 void sys_var_session_uint32_t::set_default(Session *session, enum_var_type type)
 
1109
 {
 
1110
   if (type == OPT_GLOBAL)
 
1111
   {
 
1112
     bool not_used;
 
1113
     /* We will not come here if option_limits is not set */
 
1114
     global_system_variables.*offset=
 
1115
       (uint32_t) getopt_ull_limit_value((uint32_t) option_limits->def_value,
 
1116
                                      option_limits, &not_used);
 
1117
   }
 
1118
   else
 
1119
     session->variables.*offset= global_system_variables.*offset;
 
1120
 }
 
1121
 
 
1122
 
 
1123
unsigned char *sys_var_session_uint32_t::value_ptr(Session *session,
 
1124
                                                enum_var_type type,
 
1125
                                                LEX_STRING *)
 
1126
{
 
1127
  if (type == OPT_GLOBAL)
 
1128
    return (unsigned char*) &(global_system_variables.*offset);
 
1129
  return (unsigned char*) &(session->variables.*offset);
 
1130
}
 
1131
 
1071
1132
 
1072
1133
bool sys_var_session_ha_rows::update(Session *session, set_var *var)
1073
1134
{