~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sys_var.cc

  • Committer: Stewart Smith
  • Date: 2010-11-03 03:27:09 UTC
  • mto: (1902.1.1 build) (1910.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 1903.
  • Revision ID: stewart@flamingspork.com-20101103032709-oyvfrc6eb8fzj0mr
fix docs warning: docs/unlock.rst:2: (WARNING/2) Title underline too short.

Show diffs side-by-side

added added

removed removed

Lines of Context:
88
88
extern const CHARSET_INFO *character_set_filesystem;
89
89
extern size_t my_thread_stack_size;
90
90
 
 
91
class sys_var_pluginvar;
91
92
typedef map<string, sys_var *> SystemVariableMap;
92
93
static SystemVariableMap system_variable_map;
93
94
extern char *opt_drizzle_tmpdir;
140
141
 
141
142
static sys_var_size_t_ptr sys_thread_stack_size("thread_stack",
142
143
                                                      &my_thread_stack_size);
143
 
static sys_var_constrained_value_readonly<uint32_t> sys_back_log("back_log", back_log);
 
144
static sys_var_constrained_value<uint32_t> sys_back_log("back_log", back_log);
144
145
 
145
146
static sys_var_session_uint64_t sys_bulk_insert_buff_size("bulk_insert_buffer_size",
146
147
                                                          &drizzle_system_variables::bulk_insert_buff_size);
196
197
 
197
198
static sys_var_session_size_t   sys_range_alloc_block_size("range_alloc_block_size",
198
199
                                                           &drizzle_system_variables::range_alloc_block_size);
199
 
 
200
 
static sys_var_session_bool sys_replicate_query("replicate_query",
201
 
                                                &drizzle_system_variables::replicate_query);
202
 
 
203
200
static sys_var_session_uint32_t sys_query_alloc_block_size("query_alloc_block_size",
204
201
                                                           &drizzle_system_variables::query_alloc_block_size,
205
202
                                                           NULL, fix_session_mem_root);
320
317
/* Global read-only variable containing hostname */
321
318
static sys_var_const_str        sys_hostname("hostname", glob_hostname);
322
319
 
323
 
bool sys_var::check(Session *session, set_var *var)
 
320
bool sys_var::check(Session *, set_var *var)
324
321
{
325
 
  if (check_func)
326
 
  {
327
 
    int res;
328
 
    if ((res=(*check_func)(session, var)) < 0)
329
 
      my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), getName().c_str(), var->value->str_value.ptr());
330
 
    return res;
331
 
  }
332
322
  var->save_result.uint64_t_value= var->value->val_int();
333
323
  return 0;
334
324
}
335
325
 
336
326
bool sys_var_str::check(Session *session, set_var *var)
337
327
{
 
328
  int res;
338
329
  if (!check_func)
339
330
    return 0;
340
331
 
341
 
  int res;
342
332
  if ((res=(*check_func)(session, var)) < 0)
343
333
    my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), getName().c_str(), var->value->str_value.ptr());
344
334
  return res;
345
335
}
346
336
 
347
 
bool sys_var_std_string::check(Session *session, set_var *var)
348
 
{
349
 
  if (check_func == NULL)
350
 
  {
351
 
    return false;
352
 
  }
353
 
 
354
 
  int res= (*check_func)(session, var);
355
 
  if (res != 0)
356
 
  {
357
 
    my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), getName().c_str(), var->value->str_value.ptr());
358
 
    return true;
359
 
  }
360
 
  return false;
361
 
}
362
 
 
363
337
/*
364
338
  Functions to check and update variables
365
339
*/
567
541
 
568
542
void sys_var_uint64_t_ptr::set_default(Session *, sql_var_t)
569
543
{
570
 
  if (have_default_value)
571
 
  {
572
 
    *value= default_value;
573
 
  }
574
 
  else
575
 
  {
576
 
    bool not_used;
577
 
    LOCK_global_system_variables.lock();
578
 
    *value= getopt_ull_limit_value((uint64_t) option_limits->def_value,
579
 
                                   option_limits, &not_used);
580
 
    LOCK_global_system_variables.unlock();
581
 
  }
 
544
  bool not_used;
 
545
  LOCK_global_system_variables.lock();
 
546
  *value= getopt_ull_limit_value((uint64_t) option_limits->def_value,
 
547
                                 option_limits, &not_used);
 
548
  LOCK_global_system_variables.unlock();
582
549
}
583
550
 
584
551
 
613
580
 
614
581
void sys_var_bool_ptr::set_default(Session *, sql_var_t)
615
582
{
616
 
  *value= default_value;
 
583
  *value= (bool) option_limits->def_value;
617
584
}
618
585
 
619
586
 
1634
1601
    add_sys_var_to_list(&sys_range_alloc_block_size, my_long_options);
1635
1602
    add_sys_var_to_list(&sys_read_buff_size, my_long_options);
1636
1603
    add_sys_var_to_list(&sys_read_rnd_buff_size, my_long_options);
1637
 
    add_sys_var_to_list(&sys_replicate_query, my_long_options);
1638
1604
    add_sys_var_to_list(&sys_scheduler, my_long_options);
1639
1605
    add_sys_var_to_list(&sys_secure_file_priv, my_long_options);
1640
1606
    add_sys_var_to_list(&sys_select_limit, my_long_options);
1663
1629
    add_sys_var_to_list(&sys_version_compile_vendor, my_long_options);
1664
1630
    add_sys_var_to_list(&sys_warning_count, my_long_options);
1665
1631
  }
1666
 
  catch (std::exception&)
 
1632
  catch (...)
1667
1633
  {
1668
1634
    errmsg_printf(ERRMSG_LVL_ERROR, _("Failed to initialize system variables"));
1669
1635
    return(1);