~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sys_var.cc

  • Committer: Lee Bieber
  • Date: 2010-10-27 18:28:56 UTC
  • mfrom: (1883.1.3 build)
  • Revision ID: kalebral@gmail.com-20101027182856-q3wqtbv1t4egkjsk
Merge Andrew - fix bug 667360: --defaults-file not processed before paths read           
Merge Andrew - fix bug 656577: Importing SQL script results in silent failure    
Merge Andrew - fix bug 667053: drizzledump minor output cleanup needed

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems, Inc.
 
4
 *  Copyright (C) 2008 Sun Microsystems
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
36
36
  @todo
37
37
    Add full support for the variable character_set (for 4.1)
38
38
 
 
39
  @note
 
40
    Be careful with var->save_result: sys_var::check() only updates
 
41
    uint64_t_value; so other members of the union are garbage then; to use
 
42
    them you must first assign a value to them (in specific ::check() for
 
43
    example).
39
44
*/
40
45
 
41
46
#include "config.h"
60
65
#include "drizzled/charset.h"
61
66
#include "drizzled/transaction_services.h"
62
67
#include "drizzled/constrained_value.h"
63
 
#include "drizzled/visibility.h"
64
 
#include "drizzled/plugin/storage_engine.h"
65
68
 
66
69
#include <cstdio>
67
70
#include <map>
85
88
extern const CHARSET_INFO *character_set_filesystem;
86
89
extern size_t my_thread_stack_size;
87
90
 
 
91
class sys_var_pluginvar;
88
92
typedef map<string, sys_var *> SystemVariableMap;
89
93
static SystemVariableMap system_variable_map;
90
94
extern char *opt_drizzle_tmpdir;
107
111
static void fix_max_join_size(Session *session, sql_var_t type);
108
112
static void fix_session_mem_root(Session *session, sql_var_t type);
109
113
static void fix_server_id(Session *session, sql_var_t type);
 
114
static bool get_unsigned32(Session *session, set_var *var);
 
115
static bool get_unsigned64(Session *session, set_var *var);
110
116
bool throw_bounds_warning(Session *session, bool fixed, bool unsignd,
111
117
                          const std::string &name, int64_t val);
112
118
static unsigned char *get_error_count(Session *session);
135
141
 
136
142
static sys_var_size_t_ptr sys_thread_stack_size("thread_stack",
137
143
                                                      &my_thread_stack_size);
138
 
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);
139
145
 
140
146
static sys_var_session_uint64_t sys_bulk_insert_buff_size("bulk_insert_buffer_size",
141
147
                                                          &drizzle_system_variables::bulk_insert_buff_size);
151
157
                                                     &drizzle_system_variables::join_buff_size);
152
158
static sys_var_session_uint32_t sys_max_allowed_packet("max_allowed_packet",
153
159
                                                       &drizzle_system_variables::max_allowed_packet);
 
160
static sys_var_uint64_t_ptr     sys_max_connect_errors("max_connect_errors",
 
161
                                               &max_connect_errors);
154
162
static sys_var_session_uint64_t sys_max_error_count("max_error_count",
155
163
                                                  &drizzle_system_variables::max_error_count);
156
164
static sys_var_session_uint64_t sys_max_heap_table_size("max_heap_table_size",
189
197
 
190
198
static sys_var_session_size_t   sys_range_alloc_block_size("range_alloc_block_size",
191
199
                                                           &drizzle_system_variables::range_alloc_block_size);
192
 
 
193
 
static sys_var_session_bool sys_replicate_query("replicate_query",
194
 
                                                &drizzle_system_variables::replicate_query);
195
 
 
196
200
static sys_var_session_uint32_t sys_query_alloc_block_size("query_alloc_block_size",
197
201
                                                           &drizzle_system_variables::query_alloc_block_size,
198
202
                                                           NULL, fix_session_mem_root);
213
217
static sys_var_session_size_t   sys_sort_buffer("sort_buffer_size",
214
218
                                                &drizzle_system_variables::sortbuff_size);
215
219
 
216
 
static sys_var_size_t_ptr_readonly sys_transaction_message_threshold("transaction_message_threshold",
217
 
                                                                &transaction_message_threshold);
 
220
static sys_var_session_size_t sys_transaction_message_threshold("transaction_message_threshold",
 
221
                                                                &drizzle_system_variables::transaction_message_threshold);
218
222
 
219
223
static sys_var_session_storage_engine sys_storage_engine("storage_engine",
220
224
                                       &drizzle_system_variables::storage_engine);
313
317
/* Global read-only variable containing hostname */
314
318
static sys_var_const_str        sys_hostname("hostname", glob_hostname);
315
319
 
316
 
bool sys_var::check(Session *session, set_var *var)
 
320
bool sys_var::check(Session *, set_var *var)
317
321
{
318
 
  if (check_func)
319
 
  {
320
 
    int res;
321
 
    if ((res=(*check_func)(session, var)) < 0)
322
 
      my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), getName().c_str(), var->value->str_value.ptr());
323
 
    return res;
324
 
  }
325
 
  var->updateValue();
 
322
  var->save_result.uint64_t_value= var->value->val_int();
326
323
  return 0;
327
324
}
328
325
 
329
326
bool sys_var_str::check(Session *session, set_var *var)
330
327
{
 
328
  int res;
331
329
  if (!check_func)
332
330
    return 0;
333
331
 
334
 
  int res;
335
332
  if ((res=(*check_func)(session, var)) < 0)
336
333
    my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), getName().c_str(), var->value->str_value.ptr());
337
334
  return res;
338
335
}
339
336
 
340
 
bool sys_var_std_string::check(Session *session, set_var *var)
341
 
{
342
 
  if (check_func == NULL)
343
 
  {
344
 
    return false;
345
 
  }
346
 
 
347
 
  int res= (*check_func)(session, var);
348
 
  if (res != 0)
349
 
  {
350
 
    my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), getName().c_str(), var->value->str_value.ptr());
351
 
    return true;
352
 
  }
353
 
  return false;
354
 
}
355
 
 
356
337
/*
357
338
  Functions to check and update variables
358
339
*/
432
413
{
433
414
  if (fixed)
434
415
  {
435
 
    char buf[DECIMAL_LONGLONG_DIGITS];
 
416
    char buf[22];
436
417
 
437
418
    if (unsignd)
438
419
      internal::ullstr((uint64_t) val, buf);
467
448
  return out;
468
449
}
469
450
 
 
451
static bool get_unsigned32(Session *session, set_var *var)
 
452
{
 
453
  if (var->value->unsigned_flag)
 
454
    var->save_result.uint32_t_value= 
 
455
      static_cast<uint32_t>(var->value->val_int());
 
456
  else
 
457
  {
 
458
    int64_t v= var->value->val_int();
 
459
    if (v > UINT32_MAX)
 
460
      throw_bounds_warning(session, true, true,var->var->getName().c_str(), v);
 
461
    
 
462
    var->save_result.uint32_t_value= 
 
463
      static_cast<uint32_t>((v > UINT32_MAX) ? UINT32_MAX : (v < 0) ? 0 : v);
 
464
  }
 
465
  return false;
 
466
}
 
467
 
 
468
static bool get_unsigned64(Session *, set_var *var)
 
469
{
 
470
  if (var->value->unsigned_flag)
 
471
      var->save_result.uint64_t_value=(uint64_t) var->value->val_int();
 
472
  else
 
473
  {
 
474
    int64_t v= var->value->val_int();
 
475
      var->save_result.uint64_t_value= (uint64_t) ((v < 0) ? 0 : v);
 
476
  }
 
477
  return 0;
 
478
}
 
479
 
 
480
static bool get_size_t(Session *, set_var *var)
 
481
{
 
482
  if (var->value->unsigned_flag)
 
483
    var->save_result.size_t_value= (size_t) var->value->val_int();
 
484
  else
 
485
  {
 
486
    ssize_t v= (ssize_t)var->value->val_int();
 
487
    var->save_result.size_t_value= (size_t) ((v < 0) ? 0 : v);
 
488
  }
 
489
  return 0;
 
490
}
 
491
 
470
492
bool sys_var_uint32_t_ptr::check(Session *, set_var *var)
471
493
{
472
 
  var->updateValue();
 
494
  var->save_result.uint32_t_value= (uint32_t)var->value->val_int();
473
495
  return 0;
474
496
}
475
497
 
476
498
bool sys_var_uint32_t_ptr::update(Session *session, set_var *var)
477
499
{
478
 
  uint64_t tmp= var->getInteger();
479
 
  boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
480
 
 
 
500
  uint32_t tmp= var->save_result.uint32_t_value;
 
501
  LOCK_global_system_variables.lock();
481
502
  if (option_limits)
482
503
  {
483
504
    uint32_t newvalue= (uint32_t) fix_unsigned(session, tmp, option_limits);
484
 
    if(static_cast<uint64_t>(newvalue) == tmp)
 
505
    if(newvalue==tmp)
485
506
      *value= newvalue;
486
507
  }
487
508
  else
488
 
  {
489
 
    *value= static_cast<uint32_t>(tmp);
490
 
  }
491
 
 
 
509
    *value= (uint32_t) tmp;
 
510
  LOCK_global_system_variables.unlock();
492
511
  return 0;
493
512
}
494
513
 
495
514
 
496
 
void sys_var_uint32_t_ptr::set_default(Session *session, sql_var_t)
 
515
void sys_var_uint32_t_ptr::set_default(Session *, sql_var_t)
497
516
{
498
517
  bool not_used;
499
 
  boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
 
518
  LOCK_global_system_variables.lock();
500
519
  *value= (uint32_t)getopt_ull_limit_value((uint32_t) option_limits->def_value,
501
520
                                           option_limits, &not_used);
 
521
  LOCK_global_system_variables.unlock();
502
522
}
503
523
 
504
524
 
505
525
bool sys_var_uint64_t_ptr::update(Session *session, set_var *var)
506
526
{
507
 
  uint64_t tmp= var->getInteger();
508
 
  boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
509
 
 
 
527
  uint64_t tmp= var->save_result.uint64_t_value;
 
528
  LOCK_global_system_variables.lock();
510
529
  if (option_limits)
511
530
  {
512
 
    uint64_t newvalue= fix_unsigned(session, tmp, option_limits);
 
531
    uint64_t newvalue= (uint64_t) fix_unsigned(session, tmp, option_limits);
513
532
    if(newvalue==tmp)
514
533
      *value= newvalue;
515
534
  }
516
535
  else
517
 
  {
518
 
    *value= tmp;
519
 
  }
520
 
 
 
536
    *value= (uint64_t) tmp;
 
537
  LOCK_global_system_variables.unlock();
521
538
  return 0;
522
539
}
523
540
 
524
541
 
525
 
void sys_var_uint64_t_ptr::set_default(Session *session, sql_var_t)
 
542
void sys_var_uint64_t_ptr::set_default(Session *, sql_var_t)
526
543
{
527
 
  if (have_default_value)
528
 
  {
529
 
    *value= default_value;
530
 
  }
531
 
  else
532
 
  {
533
 
    bool not_used;
534
 
    boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
535
 
    *value= getopt_ull_limit_value((uint64_t) option_limits->def_value,
536
 
                                   option_limits, &not_used);
537
 
  }
 
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();
538
549
}
539
550
 
540
551
 
541
552
bool sys_var_size_t_ptr::update(Session *session, set_var *var)
542
553
{
543
 
  size_t tmp= size_t(var->getInteger());
544
 
 
545
 
  boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
546
 
 
 
554
  size_t tmp= var->save_result.size_t_value;
 
555
  LOCK_global_system_variables.lock();
547
556
  if (option_limits)
548
557
    *value= fix_size_t(session, tmp, option_limits);
549
558
  else
550
559
    *value= tmp;
551
 
 
 
560
  LOCK_global_system_variables.unlock();
552
561
  return 0;
553
562
}
554
563
 
555
564
 
556
 
void sys_var_size_t_ptr::set_default(Session *session, sql_var_t)
 
565
void sys_var_size_t_ptr::set_default(Session *, sql_var_t)
557
566
{
558
567
  bool not_used;
559
 
  boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
 
568
  LOCK_global_system_variables.lock();
560
569
  *value= (size_t)getopt_ull_limit_value((size_t) option_limits->def_value,
561
570
                                         option_limits, &not_used);
562
 
}
563
 
 
564
 
bool sys_var_bool_ptr::check(Session *session, set_var *var)
565
 
{
566
 
  return check_enum(session, var, &bool_typelib);
 
571
  LOCK_global_system_variables.unlock();
567
572
}
568
573
 
569
574
bool sys_var_bool_ptr::update(Session *, set_var *var)
570
575
{
571
 
  *value= bool(var->getInteger());
 
576
  *value= (bool) var->save_result.uint32_t_value;
572
577
  return 0;
573
578
}
574
579
 
575
580
 
576
581
void sys_var_bool_ptr::set_default(Session *, sql_var_t)
577
582
{
578
 
  *value= default_value;
 
583
  *value= (bool) option_limits->def_value;
579
584
}
580
585
 
581
586
 
584
589
*/
585
590
bool sys_var_session_uint32_t::check(Session *session, set_var *var)
586
591
{
587
 
  var->updateValue();
588
 
  return (check_func && (*check_func)(session, var));
 
592
  return (get_unsigned32(session, var) ||
 
593
          (check_func && (*check_func)(session, var)));
589
594
}
590
595
 
591
596
bool sys_var_session_uint32_t::update(Session *session, set_var *var)
592
597
{
593
 
  uint64_t tmp= var->getInteger();
 
598
  uint64_t tmp= (uint64_t) var->save_result.uint32_t_value;
594
599
 
595
600
  /* Don't use bigger value than given with --maximum-variable-name=.. */
596
601
  if ((uint32_t) tmp > max_system_variables.*offset)
604
609
  else if (tmp > UINT32_MAX)
605
610
  {
606
611
    tmp= UINT32_MAX;
607
 
    throw_bounds_warning(session, true, true, getName(), int64_t(var->getInteger()));
 
612
    throw_bounds_warning(session, true, true, getName(), (int64_t) var->save_result.uint64_t_value);
608
613
  }
609
614
 
610
615
  if (var->type == OPT_GLOBAL)
643
648
 
644
649
bool sys_var_session_ha_rows::update(Session *session, set_var *var)
645
650
{
646
 
  uint64_t tmp= var->getInteger();
 
651
  uint64_t tmp= var->save_result.uint64_t_value;
647
652
 
648
653
  /* Don't use bigger value than given with --maximum-variable-name=.. */
649
654
  if ((ha_rows) tmp > max_system_variables.*offset)
654
659
  if (var->type == OPT_GLOBAL)
655
660
  {
656
661
    /* Lock is needed to make things safe on 32 bit systems */
657
 
    boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
 
662
    LOCK_global_system_variables.lock();
658
663
    global_system_variables.*offset= (ha_rows) tmp;
 
664
    LOCK_global_system_variables.unlock();
659
665
  }
660
666
  else
661
 
  {
662
667
    session->variables.*offset= (ha_rows) tmp;
663
 
  }
664
 
 
665
668
  return 0;
666
669
}
667
670
 
672
675
  {
673
676
    bool not_used;
674
677
    /* We will not come here if option_limits is not set */
675
 
    boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
 
678
    LOCK_global_system_variables.lock();
676
679
    global_system_variables.*offset=
677
680
      (ha_rows) getopt_ull_limit_value((ha_rows) option_limits->def_value,
678
681
                                       option_limits, &not_used);
 
682
    LOCK_global_system_variables.unlock();
679
683
  }
680
684
  else
681
 
  {
682
685
    session->variables.*offset= global_system_variables.*offset;
683
 
  }
684
686
}
685
687
 
686
688
 
695
697
 
696
698
bool sys_var_session_uint64_t::check(Session *session, set_var *var)
697
699
{
698
 
  var->updateValue();
699
 
  return (check_func && (*check_func)(session, var));
 
700
  return (get_unsigned64(session, var) ||
 
701
          (check_func && (*check_func)(session, var)));
700
702
}
701
703
 
702
704
bool sys_var_session_uint64_t::update(Session *session,  set_var *var)
703
705
{
704
 
  uint64_t tmp= var->getInteger();
 
706
  uint64_t tmp= var->save_result.uint64_t_value;
705
707
 
706
708
  if (tmp > max_system_variables.*offset)
707
709
  {
714
716
  if (var->type == OPT_GLOBAL)
715
717
  {
716
718
    /* Lock is needed to make things safe on 32 bit systems */
717
 
    boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
 
719
    LOCK_global_system_variables.lock();
718
720
    global_system_variables.*offset= (uint64_t) tmp;
 
721
    LOCK_global_system_variables.unlock();
719
722
  }
720
723
  else
721
 
  {
722
724
    session->variables.*offset= (uint64_t) tmp;
723
 
  }
724
 
 
725
725
  return 0;
726
726
}
727
727
 
731
731
  if (type == OPT_GLOBAL)
732
732
  {
733
733
    bool not_used;
734
 
    boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
 
734
    LOCK_global_system_variables.lock();
735
735
    global_system_variables.*offset=
736
736
      getopt_ull_limit_value((uint64_t) option_limits->def_value,
737
737
                             option_limits, &not_used);
 
738
    LOCK_global_system_variables.unlock();
738
739
  }
739
740
  else
740
 
  {
741
741
    session->variables.*offset= global_system_variables.*offset;
742
 
  }
743
742
}
744
743
 
745
744
 
754
753
 
755
754
bool sys_var_session_size_t::check(Session *session, set_var *var)
756
755
{
757
 
  var->updateValue();
758
 
  return (check_func && (*check_func)(session, var));
 
756
  return (get_size_t(session, var) ||
 
757
          (check_func && (*check_func)(session, var)));
759
758
}
760
759
 
761
760
bool sys_var_session_size_t::update(Session *session,  set_var *var)
762
761
{
763
 
  size_t tmp= size_t(var->getInteger());
 
762
  size_t tmp= var->save_result.size_t_value;
764
763
 
765
764
  if (tmp > max_system_variables.*offset)
766
765
    tmp= max_system_variables.*offset;
770
769
  if (var->type == OPT_GLOBAL)
771
770
  {
772
771
    /* Lock is needed to make things safe on 32 bit systems */
773
 
    boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
 
772
    LOCK_global_system_variables.lock();
774
773
    global_system_variables.*offset= tmp;
 
774
    LOCK_global_system_variables.unlock();
775
775
  }
776
776
  else
777
 
  {
778
777
    session->variables.*offset= tmp;
779
 
  }
780
 
 
781
778
  return 0;
782
779
}
783
780
 
787
784
  if (type == OPT_GLOBAL)
788
785
  {
789
786
    bool not_used;
790
 
    boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
 
787
    LOCK_global_system_variables.lock();
791
788
    global_system_variables.*offset=
792
789
      (size_t)getopt_ull_limit_value((size_t) option_limits->def_value,
793
790
                                     option_limits, &not_used);
 
791
    LOCK_global_system_variables.unlock();
794
792
  }
795
793
  else
796
 
  {
797
794
    session->variables.*offset= global_system_variables.*offset;
798
 
  }
799
795
}
800
796
 
801
797
 
808
804
  return (unsigned char*) &(session->variables.*offset);
809
805
}
810
806
 
811
 
bool sys_var_session_bool::check(Session *session, set_var *var)
812
 
{
813
 
  return check_enum(session, var, &bool_typelib);
814
 
}
815
807
 
816
808
bool sys_var_session_bool::update(Session *session,  set_var *var)
817
809
{
818
810
  if (var->type == OPT_GLOBAL)
819
 
    global_system_variables.*offset= bool(var->getInteger());
 
811
    global_system_variables.*offset= (bool) var->save_result.uint32_t_value;
820
812
  else
821
 
    session->variables.*offset= bool(var->getInteger());
822
 
 
 
813
    session->variables.*offset= (bool) var->save_result.uint32_t_value;
823
814
  return 0;
824
815
}
825
816
 
852
843
 
853
844
  if (var->value->result_type() == STRING_RESULT)
854
845
  {
855
 
    res= var->value->val_str(&str);
856
 
    if (res == NULL)
 
846
    if (!(res=var->value->val_str(&str)) ||
 
847
        (var->save_result.uint32_t_value= find_type(enum_names, res->ptr(),
 
848
                                                    res->length(),1)) == 0)
857
849
    {
858
 
      value= "NULL";
 
850
      value= res ? res->c_ptr() : "NULL";
859
851
      goto err;
860
852
    }
861
853
 
862
 
    uint64_t tmp_val= find_type(enum_names, res->ptr(), res->length(),1);
863
 
    if (tmp_val == 0)
864
 
    {
865
 
      value= res->c_ptr();
866
 
      goto err;
867
 
    }
868
 
    var->setValue(tmp_val-1);
 
854
    var->save_result.uint32_t_value--;
869
855
  }
870
856
  else
871
857
  {
872
 
    uint64_t tmp= var->value->val_int();
 
858
    uint64_t tmp=var->value->val_int();
873
859
    if (tmp >= enum_names->count)
874
860
    {
875
861
      internal::llstr(tmp,buff);
876
862
      value=buff;                               // Wrong value is here
877
863
      goto err;
878
864
    }
879
 
    var->setValue(tmp); // Save for update
 
865
    var->save_result.uint32_t_value= (uint32_t) tmp;    // Save for update
880
866
  }
881
867
  return 0;
882
868
 
912
898
  case SHOW_INT:
913
899
  {
914
900
    uint32_t value;
915
 
    boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
 
901
    LOCK_global_system_variables.lock();
916
902
    value= *(uint*) value_ptr(session, var_type, base);
917
 
 
 
903
    LOCK_global_system_variables.unlock();
918
904
    return new Item_uint((uint64_t) value);
919
905
  }
920
906
  case SHOW_LONGLONG:
921
907
  {
922
908
    int64_t value;
923
 
    boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
 
909
    LOCK_global_system_variables.lock();
924
910
    value= *(int64_t*) value_ptr(session, var_type, base);
925
 
 
 
911
    LOCK_global_system_variables.unlock();
926
912
    return new Item_int(value);
927
913
  }
928
914
  case SHOW_DOUBLE:
929
915
  {
930
916
    double value;
931
 
    {
932
 
      boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
933
 
      value= *(double*) value_ptr(session, var_type, base);
934
 
    }
935
 
 
 
917
    LOCK_global_system_variables.lock();
 
918
    value= *(double*) value_ptr(session, var_type, base);
 
919
    LOCK_global_system_variables.unlock();
936
920
    /* 6, as this is for now only used with microseconds */
937
921
    return new Item_float(value, 6);
938
922
  }
939
923
  case SHOW_HA_ROWS:
940
924
  {
941
925
    ha_rows value;
942
 
    boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
 
926
    LOCK_global_system_variables.lock();
943
927
    value= *(ha_rows*) value_ptr(session, var_type, base);
944
 
 
 
928
    LOCK_global_system_variables.unlock();
945
929
    return new Item_int((uint64_t) value);
946
930
  }
947
931
  case SHOW_SIZE:
948
932
  {
949
933
    size_t value;
950
 
    boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
 
934
    LOCK_global_system_variables.lock();
951
935
    value= *(size_t*) value_ptr(session, var_type, base);
952
 
 
 
936
    LOCK_global_system_variables.unlock();
953
937
    return new Item_int((uint64_t) value);
954
938
  }
955
939
  case SHOW_MY_BOOL:
956
940
  {
957
941
    int32_t value;
958
 
    boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
 
942
    LOCK_global_system_variables.lock();
959
943
    value= *(bool*) value_ptr(session, var_type, base);
 
944
    LOCK_global_system_variables.unlock();
960
945
    return new Item_int(value,1);
961
946
  }
962
947
  case SHOW_CHAR_PTR:
963
948
  {
964
949
    Item *tmp;
965
 
    boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
 
950
    LOCK_global_system_variables.lock();
966
951
    char *str= *(char**) value_ptr(session, var_type, base);
967
952
    if (str)
968
953
    {
975
960
      tmp= new Item_null();
976
961
      tmp->collation.set(system_charset_info, DERIVATION_SYSCONST);
977
962
    }
978
 
 
 
963
    LOCK_global_system_variables.unlock();
979
964
    return tmp;
980
965
  }
981
966
  case SHOW_CHAR:
982
967
  {
983
968
    Item *tmp;
984
 
    boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
 
969
    LOCK_global_system_variables.lock();
985
970
    char *str= (char*) value_ptr(session, var_type, base);
986
971
    if (str)
987
972
      tmp= new Item_string(str, strlen(str),
991
976
      tmp= new Item_null();
992
977
      tmp->collation.set(system_charset_info, DERIVATION_SYSCONST);
993
978
    }
994
 
 
 
979
    LOCK_global_system_variables.unlock();
995
980
    return tmp;
996
981
  }
997
982
  default:
1004
989
bool sys_var_session_enum::update(Session *session, set_var *var)
1005
990
{
1006
991
  if (var->type == OPT_GLOBAL)
1007
 
    global_system_variables.*offset= var->getInteger();
 
992
    global_system_variables.*offset= var->save_result.uint32_t_value;
1008
993
  else
1009
 
    session->variables.*offset= var->getInteger();
 
994
    session->variables.*offset= var->save_result.uint32_t_value;
1010
995
  return 0;
1011
996
}
1012
997
 
1056
1041
}
1057
1042
 
1058
1043
 
1059
 
bool sys_var_collation_sv::update(Session *session, set_var *var)
 
1044
typedef struct old_names_map_st
 
1045
{
 
1046
  const char *old_name;
 
1047
  const char *new_name;
 
1048
} my_old_conv;
 
1049
 
 
1050
bool sys_var_collation::check(Session *, set_var *var)
1060
1051
{
1061
1052
  const CHARSET_INFO *tmp;
1062
1053
 
1066
1057
    String str(buff,sizeof(buff), system_charset_info), *res;
1067
1058
    if (!(res=var->value->val_str(&str)))
1068
1059
    {
1069
 
      boost::throw_exception(invalid_option_value(var->var->getName()) << invalid_value(std::string("NULL")));
 
1060
      my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name.c_str(), "NULL");
1070
1061
      return 1;
1071
1062
    }
1072
1063
    if (!(tmp=get_charset_by_name(res->c_ptr())))
1073
1064
    {
1074
1065
      my_error(ER_UNKNOWN_COLLATION, MYF(0), res->c_ptr());
1075
 
      boost::throw_exception(invalid_option_value(var->var->getName()) << invalid_value(std::string(res->c_ptr())));
1076
1066
      return 1;
1077
1067
    }
1078
1068
  }
1083
1073
      char buf[20];
1084
1074
      internal::int10_to_str((int) var->value->val_int(), buf, -10);
1085
1075
      my_error(ER_UNKNOWN_COLLATION, MYF(0), buf);
1086
 
      boost::throw_exception(invalid_option_value(var->var->getName()) << invalid_value(boost::lexical_cast<std::string>(var->value->val_int())));
1087
1076
      return 1;
1088
1077
    }
1089
1078
  }
 
1079
  var->save_result.charset= tmp;        // Save for update
 
1080
  return 0;
 
1081
}
 
1082
 
 
1083
 
 
1084
bool sys_var_collation_sv::update(Session *session, set_var *var)
 
1085
{
1090
1086
  if (var->type == OPT_GLOBAL)
1091
 
    global_system_variables.*offset= tmp;
 
1087
    global_system_variables.*offset= var->save_result.charset;
1092
1088
  else
1093
1089
  {
1094
 
    session->variables.*offset= tmp;
 
1090
    session->variables.*offset= var->save_result.charset;
1095
1091
  }
1096
1092
  return 0;
1097
1093
}
1122
1118
 
1123
1119
bool sys_var_timestamp::update(Session *session,  set_var *var)
1124
1120
{
1125
 
  session->set_time(time_t(var->getInteger()));
 
1121
  session->set_time((time_t) var->save_result.uint64_t_value);
1126
1122
  return 0;
1127
1123
}
1128
1124
 
1129
1125
 
1130
1126
void sys_var_timestamp::set_default(Session *session, sql_var_t)
1131
1127
{
1132
 
  session->resetUserTime();
 
1128
  session->user_time=0;
1133
1129
}
1134
1130
 
1135
1131
 
1136
1132
unsigned char *sys_var_timestamp::value_ptr(Session *session, sql_var_t,
1137
1133
                                            const LEX_STRING *)
1138
1134
{
1139
 
  session->sys_var_tmp.int32_t_value= (int32_t) session->getCurrentTimestampEpoch();
 
1135
  session->sys_var_tmp.int32_t_value= (int32_t) session->start_time;
1140
1136
  return (unsigned char*) &session->sys_var_tmp.int32_t_value;
1141
1137
}
1142
1138
 
1143
1139
 
1144
1140
bool sys_var_last_insert_id::update(Session *session, set_var *var)
1145
1141
{
1146
 
  session->first_successful_insert_id_in_prev_stmt= var->getInteger();
 
1142
  session->first_successful_insert_id_in_prev_stmt=
 
1143
    var->save_result.uint64_t_value;
1147
1144
  return 0;
1148
1145
}
1149
1146
 
1162
1159
}
1163
1160
 
1164
1161
 
1165
 
bool sys_var_session_time_zone::update(Session *session, set_var *var)
 
1162
bool sys_var_session_time_zone::check(Session *session, set_var *var)
1166
1163
{
1167
1164
  char buff[MAX_TIME_ZONE_NAME_LENGTH];
1168
1165
  String str(buff, sizeof(buff), &my_charset_utf8_general_ci);
1169
1166
  String *res= var->value->val_str(&str);
1170
1167
 
1171
 
  Time_zone *tmp= my_tz_find(session, res);
1172
 
  if (tmp == NULL)
 
1168
  if (!(var->save_result.time_zone= my_tz_find(session, res)))
1173
1169
  {
1174
 
    boost::throw_exception(invalid_option_value(var->var->getName()) << invalid_value(std::string(res ? res->c_ptr() : "NULL")));
 
1170
    my_error(ER_UNKNOWN_TIME_ZONE, MYF(0), res ? res->c_ptr() : "NULL");
1175
1171
    return 1;
1176
1172
  }
 
1173
  return 0;
 
1174
}
 
1175
 
 
1176
 
 
1177
bool sys_var_session_time_zone::update(Session *session, set_var *var)
 
1178
{
1177
1179
  /* We are using Time_zone object found during check() phase. */
1178
1180
  if (var->type == OPT_GLOBAL)
1179
1181
  {
1180
 
    boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
1181
 
    global_system_variables.time_zone= tmp;
 
1182
    LOCK_global_system_variables.lock();
 
1183
    global_system_variables.time_zone= var->save_result.time_zone;
 
1184
    LOCK_global_system_variables.unlock();
1182
1185
  }
1183
1186
  else
1184
 
  {
1185
 
    session->variables.time_zone= tmp;
1186
 
  }
1187
 
 
 
1187
    session->variables.time_zone= var->save_result.time_zone;
1188
1188
  return 0;
1189
1189
}
1190
1190
 
1216
1216
 
1217
1217
void sys_var_session_time_zone::set_default(Session *session, sql_var_t type)
1218
1218
{
1219
 
  boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
1220
 
  if (type == OPT_GLOBAL)
1221
 
  {
1222
 
    if (default_tz_name)
1223
 
    {
1224
 
      String str(default_tz_name, &my_charset_utf8_general_ci);
1225
 
      /*
1226
 
        We are guaranteed to find this time zone since its existence
1227
 
        is checked during start-up.
1228
 
      */
1229
 
      global_system_variables.time_zone= my_tz_find(session, &str);
1230
 
    }
1231
 
    else
1232
 
      global_system_variables.time_zone= my_tz_SYSTEM;
1233
 
  }
1234
 
  else
1235
 
    session->variables.time_zone= global_system_variables.time_zone;
 
1219
 LOCK_global_system_variables.lock();
 
1220
 if (type == OPT_GLOBAL)
 
1221
 {
 
1222
   if (default_tz_name)
 
1223
   {
 
1224
     String str(default_tz_name, &my_charset_utf8_general_ci);
 
1225
     /*
 
1226
       We are guaranteed to find this time zone since its existence
 
1227
       is checked during start-up.
 
1228
     */
 
1229
     global_system_variables.time_zone= my_tz_find(session, &str);
 
1230
   }
 
1231
   else
 
1232
     global_system_variables.time_zone= my_tz_SYSTEM;
 
1233
 }
 
1234
 else
 
1235
   session->variables.time_zone= global_system_variables.time_zone;
 
1236
 LOCK_global_system_variables.unlock();
1236
1237
}
1237
1238
 
1238
1239
 
1239
 
 
1240
 
bool sys_var_session_lc_time_names::update(Session *session, set_var *var)
 
1240
bool sys_var_session_lc_time_names::check(Session *, set_var *var)
1241
1241
{
1242
1242
  MY_LOCALE *locale_match;
1243
1243
 
1245
1245
  {
1246
1246
    if (!(locale_match= my_locale_by_number((uint32_t) var->value->val_int())))
1247
1247
    {
1248
 
      char buf[DECIMAL_LONGLONG_DIGITS];
 
1248
      char buf[20];
1249
1249
      internal::int10_to_str((int) var->value->val_int(), buf, -10);
1250
1250
      my_printf_error(ER_UNKNOWN_ERROR, "Unknown locale: '%s'", MYF(0), buf);
1251
1251
      return 1;
1269
1269
    }
1270
1270
  }
1271
1271
 
 
1272
  var->save_result.locale_value= locale_match;
 
1273
  return 0;
 
1274
}
 
1275
 
 
1276
 
 
1277
bool sys_var_session_lc_time_names::update(Session *session, set_var *var)
 
1278
{
1272
1279
  if (var->type == OPT_GLOBAL)
1273
 
    global_system_variables.lc_time_names= locale_match;
 
1280
    global_system_variables.lc_time_names= var->save_result.locale_value;
1274
1281
  else
1275
 
    session->variables.lc_time_names= locale_match;
 
1282
    session->variables.lc_time_names= var->save_result.locale_value;
1276
1283
  return 0;
1277
1284
}
1278
1285
 
1315
1322
  microseconds= (int64_t) (num * 1000000.0 + 0.5);
1316
1323
  if (var->type == OPT_GLOBAL)
1317
1324
  {
1318
 
    boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
 
1325
    LOCK_global_system_variables.lock();
1319
1326
    (global_system_variables.*offset)= microseconds;
 
1327
    LOCK_global_system_variables.unlock();
1320
1328
  }
1321
1329
  else
1322
1330
    session->variables.*offset= microseconds;
1329
1337
  int64_t microseconds= (int64_t) (option_limits->def_value * 1000000.0);
1330
1338
  if (type == OPT_GLOBAL)
1331
1339
  {
1332
 
    boost::mutex::scoped_lock scopedLock(session->catalog().systemVariableLock());
 
1340
    LOCK_global_system_variables.lock();
1333
1341
    global_system_variables.*offset= microseconds;
 
1342
    LOCK_global_system_variables.unlock();
1334
1343
  }
1335
1344
  else
1336
1345
    session->variables.*offset= microseconds;
1343
1352
static bool set_option_bit(Session *session, set_var *var)
1344
1353
{
1345
1354
  sys_var_session_bit *sys_var= ((sys_var_session_bit*) var->var);
1346
 
  if ((var->getInteger() != 0) == sys_var->reverse)
 
1355
  if ((var->save_result.uint32_t_value != 0) == sys_var->reverse)
1347
1356
    session->options&= ~sys_var->bit_flag;
1348
1357
  else
1349
1358
    session->options|= sys_var->bit_flag;
1353
1362
 
1354
1363
static bool set_option_autocommit(Session *session, set_var *var)
1355
1364
{
1356
 
  bool success= true;
1357
1365
  /* The test is negative as the flag we use is NOT autocommit */
1358
1366
 
1359
1367
  uint64_t org_options= session->options;
1360
 
  uint64_t new_options= session->options;
1361
1368
 
1362
 
  if (var->getInteger() != 0)
1363
 
    new_options&= ~((sys_var_session_bit*) var->var)->bit_flag;
 
1369
  if (var->save_result.uint32_t_value != 0)
 
1370
    session->options&= ~((sys_var_session_bit*) var->var)->bit_flag;
1364
1371
  else
1365
 
    new_options|= ((sys_var_session_bit*) var->var)->bit_flag;
 
1372
    session->options|= ((sys_var_session_bit*) var->var)->bit_flag;
1366
1373
 
1367
 
  if ((org_options ^ new_options) & OPTION_NOT_AUTOCOMMIT)
 
1374
  if ((org_options ^ session->options) & OPTION_NOT_AUTOCOMMIT)
1368
1375
  {
1369
1376
    if ((org_options & OPTION_NOT_AUTOCOMMIT))
1370
1377
    {
1371
 
      success= session->endActiveTransaction();
1372
1378
      /* We changed to auto_commit mode */
1373
1379
      session->options&= ~(uint64_t) (OPTION_BEGIN);
1374
1380
      session->server_status|= SERVER_STATUS_AUTOCOMMIT;
 
1381
      TransactionServices &transaction_services= TransactionServices::singleton();
 
1382
      if (transaction_services.commitTransaction(session, true))
 
1383
        return 1;
1375
1384
    }
1376
1385
    else
1377
1386
    {
1378
1387
      session->server_status&= ~SERVER_STATUS_AUTOCOMMIT;
1379
1388
    }
1380
1389
  }
1381
 
 
1382
 
  if (var->getInteger() != 0)
1383
 
    session->options&= ~((sys_var_session_bit*) var->var)->bit_flag;
1384
 
  else
1385
 
    session->options|= ((sys_var_session_bit*) var->var)->bit_flag;
1386
 
 
1387
 
  if (not success)
1388
 
    return true;
1389
 
 
1390
1390
  return 0;
1391
1391
}
1392
1392
 
1393
1393
static int check_pseudo_thread_id(Session *, set_var *var)
1394
1394
{
1395
 
  var->updateValue();
 
1395
  var->save_result.uint64_t_value= var->value->val_int();
1396
1396
  return 0;
1397
1397
}
1398
1398
 
1490
1490
drizzle_show_var* enumerate_sys_vars(Session *session)
1491
1491
{
1492
1492
  int size= sizeof(drizzle_show_var) * (system_variable_map.size() + 1);
1493
 
  drizzle_show_var *result= (drizzle_show_var*) session->getMemRoot()->allocate(size);
 
1493
  drizzle_show_var *result= (drizzle_show_var*) session->alloc(size);
1494
1494
 
1495
1495
  if (result)
1496
1496
  {
1524
1524
  /* this fails if there is a conflicting variable name. */
1525
1525
  if (system_variable_map.find(lower_name) != system_variable_map.end())
1526
1526
  {
1527
 
    errmsg_printf(error::ERROR, _("Variable named %s already exists!\n"),
 
1527
    errmsg_printf(ERRMSG_LVL_ERROR, _("Variable named %s already exists!\n"),
1528
1528
                  var->getName().c_str());
1529
1529
    throw exception();
1530
1530
  } 
1533
1533
    system_variable_map.insert(make_pair(lower_name, var));
1534
1534
  if (ret.second == false)
1535
1535
  {
1536
 
    errmsg_printf(error::ERROR, _("Could not add Variable: %s\n"),
 
1536
    errmsg_printf(ERRMSG_LVL_ERROR, _("Could not add Variable: %s\n"),
1537
1537
                  var->getName().c_str());
1538
1538
    throw exception();
1539
1539
  }
1581
1581
    add_sys_var_to_list(&sys_last_insert_id, my_long_options);
1582
1582
    add_sys_var_to_list(&sys_lc_time_names, my_long_options);
1583
1583
    add_sys_var_to_list(&sys_max_allowed_packet, my_long_options);
 
1584
    add_sys_var_to_list(&sys_max_connect_errors, my_long_options);
1584
1585
    add_sys_var_to_list(&sys_max_error_count, my_long_options);
1585
1586
    add_sys_var_to_list(&sys_max_heap_table_size, my_long_options);
1586
1587
    add_sys_var_to_list(&sys_max_join_size, my_long_options);
1600
1601
    add_sys_var_to_list(&sys_range_alloc_block_size, my_long_options);
1601
1602
    add_sys_var_to_list(&sys_read_buff_size, my_long_options);
1602
1603
    add_sys_var_to_list(&sys_read_rnd_buff_size, my_long_options);
1603
 
    add_sys_var_to_list(&sys_replicate_query, my_long_options);
1604
1604
    add_sys_var_to_list(&sys_scheduler, my_long_options);
1605
1605
    add_sys_var_to_list(&sys_secure_file_priv, my_long_options);
1606
1606
    add_sys_var_to_list(&sys_select_limit, my_long_options);
1629
1629
    add_sys_var_to_list(&sys_version_compile_vendor, my_long_options);
1630
1630
    add_sys_var_to_list(&sys_warning_count, my_long_options);
1631
1631
  }
1632
 
  catch (std::exception&)
 
1632
  catch (...)
1633
1633
  {
1634
 
    errmsg_printf(error::ERROR, _("Failed to initialize system variables"));
 
1634
    errmsg_printf(ERRMSG_LVL_ERROR, _("Failed to initialize system variables"));
1635
1635
    return(1);
1636
1636
  }
1637
1637
  return(0);
1641
1641
/**
1642
1642
  Find a user set-table variable.
1643
1643
 
1644
 
  @param name      Name of system variable to find
 
1644
  @param str       Name of system variable to find
 
1645
  @param length    Length of variable.  zero means that we should use strlen()
 
1646
                   on the variable
 
1647
  @param no_error  Refuse to emit an error, even if one occurred.
1645
1648
 
1646
1649
  @retval
1647
1650
    pointer     pointer to variable definitions
1649
1652
    0           Unknown variable (error message is given)
1650
1653
*/
1651
1654
 
1652
 
sys_var *find_sys_var(const std::string &name)
 
1655
sys_var *intern_find_sys_var(const char *str, uint32_t, bool no_error)
1653
1656
{
1654
 
  string lower_name(name);
 
1657
  string lower_name(str);
1655
1658
  transform(lower_name.begin(), lower_name.end(),
1656
1659
            lower_name.begin(), ::tolower);
1657
1660
 
1663
1666
    result= (*iter).second;
1664
1667
  } 
1665
1668
 
 
1669
  /*
 
1670
    This function is only called from the sql_plugin.cc.
 
1671
    A lock on LOCK_system_variable_hash should be held
 
1672
  */
1666
1673
  if (result == NULL)
1667
1674
  {
1668
 
    my_error(ER_UNKNOWN_SYSTEM_VARIABLE, MYF(0), name.c_str());
1669
 
    return NULL;
 
1675
    if (no_error)
 
1676
    {
 
1677
      return NULL;
 
1678
    }
 
1679
    else
 
1680
    {
 
1681
      my_error(ER_UNKNOWN_SYSTEM_VARIABLE, MYF(0), (char*) str);
 
1682
      return NULL;
 
1683
    }
1670
1684
  }
1671
1685
 
1672
1686
  return result;
1677
1691
 Functions to handle table_type
1678
1692
****************************************************************************/
1679
1693
 
 
1694
/* Based upon sys_var::check_enum() */
 
1695
 
 
1696
bool sys_var_session_storage_engine::check(Session *session, set_var *var)
 
1697
{
 
1698
  char buff[STRING_BUFFER_USUAL_SIZE];
 
1699
  const char *value;
 
1700
  String str(buff, sizeof(buff), &my_charset_utf8_general_ci), *res;
 
1701
 
 
1702
  var->save_result.storage_engine= NULL;
 
1703
  if (var->value->result_type() == STRING_RESULT)
 
1704
  {
 
1705
    res= var->value->val_str(&str);
 
1706
    if (res == NULL || res->ptr() == NULL)
 
1707
    {
 
1708
      value= "NULL";
 
1709
      goto err;
 
1710
    }
 
1711
    else
 
1712
    {
 
1713
      const std::string engine_name(res->ptr());
 
1714
      plugin::StorageEngine *engine;
 
1715
      var->save_result.storage_engine= plugin::StorageEngine::findByName(*session, engine_name);
 
1716
      if (var->save_result.storage_engine == NULL)
 
1717
      {
 
1718
        value= res->c_ptr();
 
1719
        goto err;
 
1720
      }
 
1721
      engine= var->save_result.storage_engine;
 
1722
    }
 
1723
    return 0;
 
1724
  }
 
1725
  value= "unknown";
 
1726
 
 
1727
err:
 
1728
  my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), value);
 
1729
  return 1;
 
1730
}
 
1731
 
 
1732
 
1680
1733
unsigned char *sys_var_session_storage_engine::value_ptr(Session *session,
1681
1734
                                                         sql_var_t type,
1682
1735
                                                         const LEX_STRING *)
1714
1767
 
1715
1768
bool sys_var_session_storage_engine::update(Session *session, set_var *var)
1716
1769
{
1717
 
  char buff[STRING_BUFFER_USUAL_SIZE];
1718
 
  const char *name_value;
1719
 
  String str(buff, sizeof(buff), &my_charset_utf8_general_ci), *res;
1720
 
 
1721
 
  plugin::StorageEngine *tmp= NULL;
1722
 
  plugin::StorageEngine **value= NULL;
1723
 
    
1724
 
  if (var->value->result_type() == STRING_RESULT)
1725
 
  {
1726
 
    res= var->value->val_str(&str);
1727
 
    if (res == NULL || res->ptr() == NULL)
1728
 
    {
1729
 
      name_value= "NULL";
1730
 
      goto err;
1731
 
    }
1732
 
    else
1733
 
    {
1734
 
      const std::string engine_name(res->ptr());
1735
 
      tmp= plugin::StorageEngine::findByName(*session, engine_name);
1736
 
      if (tmp == NULL)
1737
 
      {
1738
 
        name_value= res->c_ptr();
1739
 
        goto err;
1740
 
      }
1741
 
    }
1742
 
  }
1743
 
  else
1744
 
  {
1745
 
    name_value= "unknown";
1746
 
  }
1747
 
 
1748
 
  value= &(global_system_variables.*offset);
 
1770
  plugin::StorageEngine **value= &(global_system_variables.*offset), *old_value;
1749
1771
   if (var->type != OPT_GLOBAL)
1750
1772
     value= &(session->variables.*offset);
1751
 
  if (*value != tmp)
 
1773
  old_value= *value;
 
1774
  if (old_value != var->save_result.storage_engine)
1752
1775
  {
1753
 
    *value= tmp;
 
1776
    *value= var->save_result.storage_engine;
1754
1777
  }
1755
1778
  return 0;
1756
 
err:
1757
 
  my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), name_value);
1758
 
  return 1;
1759
1779
}
1760
1780
 
1761
1781
} /* namespace drizzled */