~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/set_var.h

  • Committer: Monty Taylor
  • Date: 2009-04-14 19:16:51 UTC
  • mto: (997.2.5 mordred)
  • mto: This revision was merged to the branch mainline in revision 994.
  • Revision ID: mordred@inaugust.com-20090414191651-ltbww6hpqks8k7qk
Clarified instructions in README.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#ifndef DRIZZLED_SET_VAR_H
21
 
#define DRIZZLED_SET_VAR_H
 
20
#ifndef DRIZZLED_ITEM_SET_H
 
21
#define DRIZZLED_ITEM_SET_H
 
22
 
 
23
#include <drizzled/function/func.h>
 
24
#include <drizzled/function/set_user_var.h>
 
25
#include <drizzled/item/string.h>
22
26
 
23
27
#include <string>
24
28
 
25
 
#include "drizzled/function/func.h"
26
 
#include "drizzled/function/set_user_var.h"
27
 
#include "drizzled/item/string.h"
28
 
#include "drizzled/item/field.h"
29
 
 
30
 
namespace drizzled
31
 
{
32
 
 
33
29
/* Classes to support the SET command */
34
30
 
35
31
 
42
38
class set_var;
43
39
class sys_var_pluginvar; /* opaque */
44
40
class Time_zone;
 
41
typedef struct system_variables SV;
45
42
typedef struct my_locale_st MY_LOCALE;
46
43
 
47
 
extern TYPELIB bool_typelib;
 
44
extern TYPELIB bool_typelib, delay_key_write_typelib, sql_mode_typelib,
 
45
       optimizer_switch_typelib, slave_exec_mode_typelib;
48
46
 
49
47
typedef int (*sys_check_func)(Session *,  set_var *);
50
48
typedef bool (*sys_update_func)(Session *, set_var *);
51
 
typedef void (*sys_after_update_func)(Session *, sql_var_t);
52
 
typedef void (*sys_set_default_func)(Session *, sql_var_t);
 
49
typedef void (*sys_after_update_func)(Session *,enum_var_type);
 
50
typedef void (*sys_set_default_func)(Session *, enum_var_type);
53
51
typedef unsigned char *(*sys_value_ptr_func)(Session *session);
54
52
 
55
 
static const std::vector<std::string> empty_aliases;
56
 
extern struct system_variables max_system_variables;
57
 
extern size_t table_def_size;
58
 
 
59
 
extern char *drizzle_tmpdir;
60
 
extern const char *first_keyword;
61
 
extern const char *in_left_expr_name;
62
 
extern const char *in_additional_cond;
63
 
extern const char *in_having_cond;
64
 
extern char language[FN_REFLEN];
65
 
extern char glob_hostname[FN_REFLEN];
66
 
extern char drizzle_home[FN_REFLEN];
67
 
extern char pidfile_name[FN_REFLEN];
68
 
extern char system_time_zone[30];
69
 
extern char *opt_tc_log_file;
70
 
extern uint64_t session_startup_options;
71
 
extern uint32_t global_thread_id;
72
 
extern uint64_t aborted_threads;
73
 
extern uint64_t aborted_connects;
74
 
extern uint64_t table_cache_size;
75
 
extern uint64_t max_connect_errors;
76
 
extern uint32_t back_log;
77
 
extern uint32_t ha_open_options;
78
 
extern char *drizzled_bind_host;
79
 
extern uint32_t dropping_tables;
80
 
extern bool opt_endinfo;
81
 
extern uint32_t volatile thread_running;
82
 
extern uint32_t volatile global_read_lock;
83
 
extern bool opt_readonly;
84
 
extern char* opt_secure_file_priv;
85
 
extern char *default_tz_name;
86
 
 
87
 
uint64_t fix_unsigned(Session *, uint64_t, const struct option *);
88
 
 
89
53
struct sys_var_chain
90
54
{
91
55
  sys_var *first;
92
56
  sys_var *last;
93
57
};
94
58
 
95
 
/**
96
 
 * A class which represents a variable, either global or 
97
 
 * session-local.
98
 
 */
99
59
class sys_var
100
60
{
101
 
protected:
102
 
  const std::string name; /**< The name of the variable */
103
 
  sys_after_update_func after_update; /**< Function pointer triggered after the variable's value is updated */
104
 
  struct option *option_limits; /**< Updated by by set_var_init() */
105
 
  bool m_allow_empty_value; /**< Does variable allow an empty value? */
 
61
public:
 
62
 
 
63
  /**
 
64
    Enumeration type to indicate for a system variable whether it will be written to the binlog or not.
 
65
  */
 
66
  enum Binlog_status_enum
 
67
  {
 
68
    /* The variable value is not in the binlog. */
 
69
    NOT_IN_BINLOG,
 
70
    /* The value of the @@session variable is in the binlog. */
 
71
    SESSION_VARIABLE_IN_BINLOG
 
72
    /*
 
73
      Currently, no @@global variable is ever in the binlog, so we
 
74
      don't need an enumeration value for that.
 
75
    */
 
76
  };
 
77
 
106
78
  sys_var *next;
107
 
public:
108
 
  sys_var(const std::string name_arg, sys_after_update_func func= NULL)
109
 
    :
110
 
    name(name_arg),
111
 
    after_update(func),
 
79
  struct my_option *option_limits;      /* Updated by by set_var_init() */
 
80
  uint32_t name_length;                 /* Updated by by set_var_init() */
 
81
  const char *name;
 
82
 
 
83
  sys_after_update_func after_update;
 
84
  sys_var(const char *name_arg, sys_after_update_func func= NULL,
 
85
          Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG)
 
86
    :name(name_arg), after_update(func),
 
87
    binlog_status(binlog_status_arg),
112
88
    m_allow_empty_value(true)
113
89
  {}
114
90
  virtual ~sys_var() {}
120
96
      chain_arg->first= this;
121
97
    chain_arg->last= this;
122
98
  }
123
 
 
124
 
  /** 
125
 
   * Returns the name of the variable.
126
 
   *
127
 
   * @note 
128
 
   *
129
 
   * So that we can exist in a Registry. We really need to formalize that 
130
 
   */
131
 
  inline const std::string &getName() const
132
 
  {
133
 
    return name;
134
 
  }
135
 
  /**
136
 
   * Returns a vector of strings representing aliases
137
 
   * for this variable's name.
138
 
   */
139
 
  const std::vector<std::string>& getAliases() const
140
 
  {
141
 
    return empty_aliases;
142
 
  }
143
 
  /**
144
 
   * Returns a pointer to the next sys_var, or NULL if none.
145
 
   */
146
 
  inline sys_var *getNext() const
147
 
  {
148
 
    return next;
149
 
  }
150
 
  /**
151
 
   * Sets the pointer to the next sys_var.
152
 
   *
153
 
   * @param Pointer to the next sys_var, or NULL if you set the tail...
154
 
   */
155
 
  inline void setNext(sys_var *in_next)
156
 
  {
157
 
    next= in_next;
158
 
  }
159
 
  /**
160
 
   * Returns a pointer to the variable's option limits
161
 
   */
162
 
  inline struct option *getOptionLimits() const
163
 
  {
164
 
    return option_limits;
165
 
  }
166
 
  /**
167
 
   * Sets the pointer to the variable's option limits
168
 
   *
169
 
   * @param Pointer to the option limits option variable
170
 
   */
171
 
  inline void setOptionLimits(struct option *in_option_limits)
172
 
  {
173
 
    option_limits= in_option_limits;
174
 
  }
175
 
  /** 
176
 
   * Returns the function pointer for after update trigger, or NULL if none.
177
 
   */
178
 
  inline sys_after_update_func getAfterUpdateTrigger() const
179
 
  {
180
 
    return after_update;
181
 
  }
182
99
  virtual bool check(Session *session, set_var *var);
183
100
  bool check_enum(Session *session, set_var *var, const TYPELIB *enum_names);
 
101
  bool check_set(Session *session, set_var *var, TYPELIB *enum_names);
184
102
  virtual bool update(Session *session, set_var *var)=0;
185
 
  virtual void set_default(Session *, sql_var_t)
 
103
  virtual void set_default(Session *, enum_var_type)
186
104
  {}
187
 
  virtual SHOW_TYPE show_type()
188
 
  {
189
 
    return SHOW_UNDEF;
190
 
  }
191
 
  virtual unsigned char *value_ptr(Session *, sql_var_t, const LEX_STRING *)
192
 
  {
193
 
    return 0;
194
 
  }
195
 
  virtual bool check_type(sql_var_t type)
196
 
  {
197
 
    return type != OPT_GLOBAL;
198
 
  }             /* Error if not GLOBAL */
 
105
  virtual SHOW_TYPE show_type() { return SHOW_UNDEF; }
 
106
  virtual unsigned char *value_ptr(Session *, enum_var_type, const LEX_STRING *)
 
107
  { return 0; }
 
108
  virtual bool check_type(enum_var_type type)
 
109
  { return type != OPT_GLOBAL; }                /* Error if not GLOBAL */
199
110
  virtual bool check_update_type(Item_result type)
200
 
  {
201
 
    return type != INT_RESULT;
202
 
  }             /* Assume INT */
203
 
  virtual bool check_default(sql_var_t)
204
 
  {
205
 
    return option_limits == 0;
206
 
  }
207
 
  Item *item(Session *session, sql_var_t type, const LEX_STRING *base);
208
 
  virtual bool is_readonly() const
209
 
  {
210
 
    return 0;
211
 
  }
212
 
  virtual sys_var_pluginvar *cast_pluginvar()
213
 
  {
214
 
    return 0;
215
 
  }
 
111
  { return type != INT_RESULT; }                /* Assume INT */
 
112
  virtual bool check_default(enum_var_type)
 
113
  { return option_limits == 0; }
 
114
  Item *item(Session *session, enum_var_type type, const LEX_STRING *base);
 
115
  virtual bool is_struct() { return 0; }
 
116
  virtual bool is_readonly() const { return 0; }
 
117
  virtual sys_var_pluginvar *cast_pluginvar() { return 0; }
 
118
 
 
119
protected:
 
120
  void set_allow_empty_value(bool allow_empty_value)
 
121
  {
 
122
    m_allow_empty_value= allow_empty_value;
 
123
  }
 
124
 
 
125
private:
 
126
  const Binlog_status_enum binlog_status;
 
127
 
 
128
  bool m_allow_empty_value;
216
129
};
217
130
 
218
 
/**
219
 
 * A base class for all variables that require its access to
220
 
 * be guarded with a mutex.
221
 
 */
 
131
 
 
132
/*
 
133
  A base class for all variables that require its access to
 
134
  be guarded with a mutex.
 
135
*/
 
136
 
222
137
class sys_var_global: public sys_var
223
138
{
224
139
protected:
225
140
  pthread_mutex_t *guard;
226
141
public:
227
 
  sys_var_global(const char *name_arg,
228
 
                 sys_after_update_func after_update_arg,
 
142
  sys_var_global(const char *name_arg, sys_after_update_func after_update_arg,
229
143
                 pthread_mutex_t *guard_arg)
230
 
    :
231
 
      sys_var(name_arg, after_update_arg), 
232
 
      guard(guard_arg) 
233
 
  {}
 
144
    :sys_var(name_arg, after_update_arg), guard(guard_arg) {}
234
145
};
235
146
 
 
147
 
236
148
class sys_var_uint32_t_ptr :public sys_var
237
149
{
238
150
  uint32_t *value;
248
160
  { chain_sys_var(chain); }
249
161
  bool check(Session *session, set_var *var);
250
162
  bool update(Session *session, set_var *var);
251
 
  void set_default(Session *session, sql_var_t type);
 
163
  void set_default(Session *session, enum_var_type type);
252
164
  SHOW_TYPE show_type() { return SHOW_INT; }
253
 
  unsigned char *value_ptr(Session *, sql_var_t, const LEX_STRING *)
 
165
  unsigned char *value_ptr(Session *, enum_var_type, const LEX_STRING *)
254
166
  { return (unsigned char*) value; }
255
167
};
256
168
 
267
179
    :sys_var(name_arg,func), value(value_ptr_arg)
268
180
  { chain_sys_var(chain); }
269
181
  bool update(Session *session, set_var *var);
270
 
  void set_default(Session *session, sql_var_t type);
 
182
  void set_default(Session *session, enum_var_type type);
271
183
  SHOW_TYPE show_type() { return SHOW_LONGLONG; }
272
 
  unsigned char *value_ptr(Session *, sql_var_t,
 
184
  unsigned char *value_ptr(Session *, enum_var_type,
273
185
                           const LEX_STRING *)
274
186
  { return (unsigned char*) value; }
275
187
};
286
198
    :sys_var(name_arg,func), value(value_ptr_arg)
287
199
  { chain_sys_var(chain); }
288
200
  bool update(Session *session, set_var *var);
289
 
  void set_default(Session *session, sql_var_t type);
 
201
  void set_default(Session *session, enum_var_type type);
290
202
  SHOW_TYPE show_type() { return SHOW_SIZE; }
291
 
  unsigned char *value_ptr(Session *, sql_var_t, const LEX_STRING *)
 
203
  unsigned char *value_ptr(Session *, enum_var_type, const LEX_STRING *)
292
204
  { return (unsigned char*) value; }
293
205
};
294
206
 
304
216
    return check_enum(session, var, &bool_typelib);
305
217
  }
306
218
  bool update(Session *session, set_var *var);
307
 
  void set_default(Session *session, sql_var_t type);
 
219
  void set_default(Session *session, enum_var_type type);
308
220
  SHOW_TYPE show_type() { return SHOW_MY_BOOL; }
309
 
  unsigned char *value_ptr(Session *, sql_var_t, const LEX_STRING *)
 
221
  unsigned char *value_ptr(Session *, enum_var_type, const LEX_STRING *)
310
222
  { return (unsigned char*) value; }
311
223
  bool check_update_type(Item_result)
312
224
  { return 0; }
344
256
  {
345
257
    return (*update_func)(session, var);
346
258
  }
347
 
  void set_default(Session *session, sql_var_t type)
 
259
  void set_default(Session *session, enum_var_type type)
348
260
  {
349
261
    (*set_default_func)(session, type);
350
262
  }
351
263
  SHOW_TYPE show_type() { return SHOW_CHAR; }
352
 
  unsigned char *value_ptr(Session *, sql_var_t, const LEX_STRING *)
 
264
  unsigned char *value_ptr(Session *, enum_var_type, const LEX_STRING *)
353
265
  { return (unsigned char*) value; }
354
266
  bool check_update_type(Item_result type)
355
267
  {
356
268
    return type != STRING_RESULT;               /* Only accept strings */
357
269
  }
358
 
  bool check_default(sql_var_t)
 
270
  bool check_default(enum_var_type)
359
271
  { return 0; }
360
272
};
361
273
 
381
293
    return 1;
382
294
  }
383
295
  SHOW_TYPE show_type() { return SHOW_CHAR; }
384
 
  unsigned char *value_ptr(Session *, sql_var_t, const LEX_STRING *)
 
296
  unsigned char *value_ptr(Session *, enum_var_type, const LEX_STRING *)
385
297
  {
386
298
    return (unsigned char*) value;
387
299
  }
389
301
  {
390
302
    return 1;
391
303
  }
392
 
  bool check_default(sql_var_t)
 
304
  bool check_default(enum_var_type)
393
305
  { return 1; }
394
306
  bool is_readonly() const { return 1; }
395
307
};
411
323
    return 1;
412
324
  }
413
325
  SHOW_TYPE show_type() { return SHOW_CHAR; }
414
 
  unsigned char *value_ptr(Session *, sql_var_t, const LEX_STRING *)
 
326
  unsigned char *value_ptr(Session *, enum_var_type, const LEX_STRING *)
415
327
  {
416
328
    return (unsigned char*) *value;
417
329
  }
419
331
  {
420
332
    return 1;
421
333
  }
422
 
  bool check_default(sql_var_t)
 
334
  bool check_default(enum_var_type)
423
335
  { return 1; }
424
336
  bool is_readonly(void) const { return 1; }
425
337
};
426
338
 
427
339
 
 
340
class sys_var_enum :public sys_var
 
341
{
 
342
  uint32_t *value;
 
343
  TYPELIB *enum_names;
 
344
public:
 
345
  sys_var_enum(sys_var_chain *chain, const char *name_arg, uint32_t *value_arg,
 
346
               TYPELIB *typelib, sys_after_update_func func)
 
347
    :sys_var(name_arg,func), value(value_arg), enum_names(typelib)
 
348
  { chain_sys_var(chain); }
 
349
  bool check(Session *session, set_var *var)
 
350
  {
 
351
    return check_enum(session, var, enum_names);
 
352
  }
 
353
  bool update(Session *session, set_var *var);
 
354
  SHOW_TYPE show_type() { return SHOW_CHAR; }
 
355
  unsigned char *value_ptr(Session *session, enum_var_type type,
 
356
                           const LEX_STRING *base);
 
357
  bool check_update_type(Item_result)
 
358
  { return 0; }
 
359
};
 
360
 
 
361
 
 
362
class sys_var_enum_const :public sys_var
 
363
{
 
364
  uint32_t SV::*offset;
 
365
  TYPELIB *enum_names;
 
366
public:
 
367
  sys_var_enum_const(sys_var_chain *chain, const char *name_arg, uint32_t SV::*offset_arg,
 
368
      TYPELIB *typelib, sys_after_update_func func)
 
369
    :sys_var(name_arg,func), offset(offset_arg), enum_names(typelib)
 
370
  { chain_sys_var(chain); }
 
371
  bool check(Session *, set_var *)
 
372
  { return 1; }
 
373
  bool update(Session *, set_var *)
 
374
  { return 1; }
 
375
  SHOW_TYPE show_type() { return SHOW_CHAR; }
 
376
  bool check_update_type(Item_result)
 
377
  { return 1; }
 
378
  bool is_readonly() const { return 1; }
 
379
  unsigned char *value_ptr(Session *session, enum_var_type type,
 
380
                           const LEX_STRING *base);
 
381
};
 
382
 
 
383
 
428
384
class sys_var_session :public sys_var
429
385
{
430
386
public:
431
387
  sys_var_session(const char *name_arg,
432
 
              sys_after_update_func func= NULL)
433
 
    :sys_var(name_arg, func)
 
388
              sys_after_update_func func= NULL,
 
389
              Binlog_status_enum bl_status= NOT_IN_BINLOG)
 
390
    :sys_var(name_arg, func, bl_status)
434
391
  {}
435
 
  bool check_type(sql_var_t)
 
392
  bool check_type(enum_var_type)
436
393
  { return 0; }
437
 
  bool check_default(sql_var_t type)
 
394
  bool check_default(enum_var_type type)
438
395
  {
439
396
    return type == OPT_GLOBAL && !option_limits;
440
397
  }
444
401
{
445
402
  sys_check_func check_func;
446
403
public:
447
 
  uint32_t system_variables::*offset;
 
404
  uint32_t SV::*offset;
448
405
  sys_var_session_uint32_t(sys_var_chain *chain, const char *name_arg,
449
 
                           uint32_t system_variables::*offset_arg,
 
406
                           uint32_t SV::*offset_arg,
450
407
                           sys_check_func c_func= NULL,
451
 
                           sys_after_update_func au_func= NULL)
452
 
    :sys_var_session(name_arg, au_func), check_func(c_func),
 
408
                           sys_after_update_func au_func= NULL,
 
409
                           Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG)
 
410
    :sys_var_session(name_arg, au_func, binlog_status_arg), check_func(c_func),
453
411
    offset(offset_arg)
454
412
  { chain_sys_var(chain); }
455
413
  bool check(Session *session, set_var *var);
456
414
  bool update(Session *session, set_var *var);
457
 
  void set_default(Session *session, sql_var_t type);
 
415
  void set_default(Session *session, enum_var_type type);
458
416
  SHOW_TYPE show_type() { return SHOW_INT; }
459
 
  unsigned char *value_ptr(Session *session, sql_var_t type,
 
417
  unsigned char *value_ptr(Session *session, enum_var_type type,
460
418
                           const LEX_STRING *base);
461
419
};
462
420
 
464
422
class sys_var_session_ha_rows :public sys_var_session
465
423
{
466
424
public:
467
 
  ha_rows system_variables::*offset;
 
425
  ha_rows SV::*offset;
468
426
  sys_var_session_ha_rows(sys_var_chain *chain, const char *name_arg,
469
 
                      ha_rows system_variables::*offset_arg)
 
427
                      ha_rows SV::*offset_arg)
470
428
    :sys_var_session(name_arg), offset(offset_arg)
471
429
  { chain_sys_var(chain); }
472
430
  sys_var_session_ha_rows(sys_var_chain *chain, const char *name_arg,
473
 
                      ha_rows system_variables::*offset_arg,
 
431
                      ha_rows SV::*offset_arg,
474
432
                      sys_after_update_func func)
475
433
    :sys_var_session(name_arg,func), offset(offset_arg)
476
434
  { chain_sys_var(chain); }
477
435
  bool update(Session *session, set_var *var);
478
 
  void set_default(Session *session, sql_var_t type);
 
436
  void set_default(Session *session, enum_var_type type);
479
437
  SHOW_TYPE show_type() { return SHOW_HA_ROWS; }
480
 
  unsigned char *value_ptr(Session *session, sql_var_t type,
 
438
  unsigned char *value_ptr(Session *session, enum_var_type type,
481
439
                           const LEX_STRING *base);
482
440
};
483
441
 
486
444
{
487
445
  sys_check_func check_func;
488
446
public:
489
 
  uint64_t system_variables::*offset;
 
447
  uint64_t SV::*offset;
490
448
  bool only_global;
491
 
  sys_var_session_uint64_t(sys_var_chain *chain, 
492
 
                           const char *name_arg,
493
 
                           uint64_t system_variables::*offset_arg,
 
449
  sys_var_session_uint64_t(sys_var_chain *chain, const char *name_arg,
 
450
                           uint64_t SV::*offset_arg,
494
451
                           sys_after_update_func au_func= NULL,
495
 
                           sys_check_func c_func= NULL)
496
 
    :sys_var_session(name_arg, au_func),
 
452
                           sys_check_func c_func= NULL,
 
453
                           Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG)
 
454
    :sys_var_session(name_arg, au_func, binlog_status_arg),
497
455
    check_func(c_func),
498
456
    offset(offset_arg)
499
457
  { chain_sys_var(chain); }
500
458
  sys_var_session_uint64_t(sys_var_chain *chain,
501
459
                           const char *name_arg,
502
 
                           uint64_t system_variables::*offset_arg,
 
460
                           uint64_t SV::*offset_arg,
503
461
                           sys_after_update_func func,
504
462
                           bool only_global_arg,
505
463
                           sys_check_func cfunc= NULL)
509
467
    only_global(only_global_arg)
510
468
  { chain_sys_var(chain); }
511
469
  bool update(Session *session, set_var *var);
512
 
  void set_default(Session *session, sql_var_t type);
 
470
  void set_default(Session *session, enum_var_type type);
513
471
  SHOW_TYPE show_type() { return SHOW_LONGLONG; }
514
 
  unsigned char *value_ptr(Session *session, sql_var_t type,
 
472
  unsigned char *value_ptr(Session *session, enum_var_type type,
515
473
                           const LEX_STRING *base);
516
474
  bool check(Session *session, set_var *var);
517
 
  bool check_default(sql_var_t type)
 
475
  bool check_default(enum_var_type type)
518
476
  {
519
477
    return type == OPT_GLOBAL && !option_limits;
520
478
  }
521
 
  bool check_type(sql_var_t type)
 
479
  bool check_type(enum_var_type type)
522
480
  {
523
481
    return (only_global && type != OPT_GLOBAL);
524
482
  }
528
486
{
529
487
  sys_check_func check_func;
530
488
public:
531
 
  size_t system_variables::*offset;
 
489
  size_t SV::*offset;
532
490
  bool only_global;
533
491
  sys_var_session_size_t(sys_var_chain *chain, const char *name_arg,
534
 
                         size_t system_variables::*offset_arg,
 
492
                         size_t SV::*offset_arg,
535
493
                         sys_after_update_func au_func= NULL,
536
 
                         sys_check_func c_func= NULL)
537
 
    :sys_var_session(name_arg, au_func),
 
494
                         sys_check_func c_func= NULL,
 
495
                         Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG)
 
496
    :sys_var_session(name_arg, au_func, binlog_status_arg),
538
497
     check_func(c_func),
539
498
     offset(offset_arg)
540
499
  { chain_sys_var(chain); }
541
500
  sys_var_session_size_t(sys_var_chain *chain,
542
501
                         const char *name_arg,
543
 
                         size_t system_variables::*offset_arg,
 
502
                         size_t SV::*offset_arg,
544
503
                         sys_after_update_func func,
545
504
                         bool only_global_arg,
546
505
                         sys_check_func cfunc= NULL)
550
509
     only_global(only_global_arg)
551
510
  { chain_sys_var(chain); }
552
511
  bool update(Session *session, set_var *var);
553
 
  void set_default(Session *session, sql_var_t type);
 
512
  void set_default(Session *session, enum_var_type type);
554
513
  SHOW_TYPE show_type() { return SHOW_SIZE; }
555
 
  unsigned char *value_ptr(Session *session, sql_var_t type,
 
514
  unsigned char *value_ptr(Session *session, enum_var_type type,
556
515
                           const LEX_STRING *base);
557
516
  bool check(Session *session, set_var *var);
558
 
  bool check_default(sql_var_t type)
 
517
  bool check_default(enum_var_type type)
559
518
  {
560
519
    return type == OPT_GLOBAL && !option_limits;
561
520
  }
562
 
  bool check_type(sql_var_t type)
 
521
  bool check_type(enum_var_type type)
563
522
  {
564
523
    return (only_global && type != OPT_GLOBAL);
565
524
  }
569
528
class sys_var_session_bool :public sys_var_session
570
529
{
571
530
public:
572
 
  bool system_variables::*offset;
573
 
  sys_var_session_bool(sys_var_chain *chain, const char *name_arg, bool system_variables::*offset_arg)
 
531
  bool SV::*offset;
 
532
  sys_var_session_bool(sys_var_chain *chain, const char *name_arg, bool SV::*offset_arg)
574
533
    :sys_var_session(name_arg), offset(offset_arg)
575
534
  { chain_sys_var(chain); }
576
 
  sys_var_session_bool(sys_var_chain *chain, const char *name_arg, bool system_variables::*offset_arg,
 
535
  sys_var_session_bool(sys_var_chain *chain, const char *name_arg, bool SV::*offset_arg,
577
536
                   sys_after_update_func func)
578
537
    :sys_var_session(name_arg,func), offset(offset_arg)
579
538
  { chain_sys_var(chain); }
580
539
  bool update(Session *session, set_var *var);
581
 
  void set_default(Session *session, sql_var_t type);
 
540
  void set_default(Session *session, enum_var_type type);
582
541
  SHOW_TYPE show_type() { return SHOW_MY_BOOL; }
583
 
  unsigned char *value_ptr(Session *session, sql_var_t type,
 
542
  unsigned char *value_ptr(Session *session, enum_var_type type,
584
543
                           const LEX_STRING *base);
585
544
  bool check(Session *session, set_var *var)
586
545
  {
594
553
class sys_var_session_enum :public sys_var_session
595
554
{
596
555
protected:
597
 
  uint32_t system_variables::*offset;
 
556
  uint32_t SV::*offset;
598
557
  TYPELIB *enum_names;
599
558
  sys_check_func check_func;
600
559
public:
601
560
  sys_var_session_enum(sys_var_chain *chain, const char *name_arg,
602
 
                   uint32_t system_variables::*offset_arg, TYPELIB *typelib,
 
561
                   uint32_t SV::*offset_arg, TYPELIB *typelib,
603
562
                   sys_after_update_func func= NULL,
604
563
                   sys_check_func check_f= NULL)
605
564
    :sys_var_session(name_arg, func), offset(offset_arg),
613
572
    return ret ? ret : check_enum(session, var, enum_names);
614
573
  }
615
574
  bool update(Session *session, set_var *var);
616
 
  void set_default(Session *session, sql_var_t type);
 
575
  void set_default(Session *session, enum_var_type type);
617
576
  SHOW_TYPE show_type() { return SHOW_CHAR; }
618
 
  unsigned char *value_ptr(Session *session, sql_var_t type,
 
577
  unsigned char *value_ptr(Session *session, enum_var_type type,
619
578
                           const LEX_STRING *base);
620
579
  bool check_update_type(Item_result)
621
580
  { return 0; }
622
581
};
623
582
 
624
583
 
 
584
 
 
585
class sys_var_session_optimizer_switch :public sys_var_session_enum
 
586
{
 
587
public:
 
588
  sys_var_session_optimizer_switch(sys_var_chain *chain, const char *name_arg,
 
589
                                   uint32_t SV::*offset_arg)
 
590
    :sys_var_session_enum(chain, name_arg, offset_arg, &optimizer_switch_typelib)
 
591
  {}
 
592
  bool check(Session *session, set_var *var)
 
593
  {
 
594
    return check_set(session, var, enum_names);
 
595
  }
 
596
  void set_default(Session *session, enum_var_type type);
 
597
  unsigned char *value_ptr(Session *session, enum_var_type type,
 
598
                           const LEX_STRING *base);
 
599
  static bool symbolic_mode_representation(Session *session, uint32_t sql_mode,
 
600
                                           LEX_STRING *rep);
 
601
};
 
602
 
 
603
 
625
604
class sys_var_session_storage_engine :public sys_var_session
626
605
{
627
606
protected:
628
 
  plugin::StorageEngine *system_variables::*offset;
 
607
  StorageEngine *SV::*offset;
629
608
public:
630
609
  sys_var_session_storage_engine(sys_var_chain *chain, const char *name_arg,
631
 
                                 plugin::StorageEngine *system_variables::*offset_arg)
 
610
                                 StorageEngine *SV::*offset_arg)
632
611
    :sys_var_session(name_arg), offset(offset_arg)
633
612
  { chain_sys_var(chain); }
634
613
  bool check(Session *session, set_var *var);
637
616
  {
638
617
    return type != STRING_RESULT;               /* Only accept strings */
639
618
  }
640
 
  void set_default(Session *session, sql_var_t type);
 
619
  void set_default(Session *session, enum_var_type type);
641
620
  bool update(Session *session, set_var *var);
642
 
  unsigned char *value_ptr(Session *session, sql_var_t type,
 
621
  unsigned char *value_ptr(Session *session, enum_var_type type,
643
622
                           const LEX_STRING *base);
644
623
};
645
624
 
652
631
  bool reverse;
653
632
  sys_var_session_bit(sys_var_chain *chain, const char *name_arg,
654
633
                  sys_check_func c_func, sys_update_func u_func,
655
 
                  uint64_t bit, bool reverse_arg=0)
656
 
    :sys_var_session(name_arg, NULL), check_func(c_func),
 
634
                  uint64_t bit, bool reverse_arg=0,
 
635
                  Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG)
 
636
    :sys_var_session(name_arg, NULL, binlog_status_arg), check_func(c_func),
657
637
    update_func(u_func), bit_flag(bit), reverse(reverse_arg)
658
638
  { chain_sys_var(chain); }
659
639
  bool check(Session *session, set_var *var);
660
640
  bool update(Session *session, set_var *var);
661
641
  bool check_update_type(Item_result)
662
642
  { return 0; }
663
 
  bool check_type(sql_var_t type) { return type == OPT_GLOBAL; }
 
643
  bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
664
644
  SHOW_TYPE show_type() { return SHOW_MY_BOOL; }
665
 
  unsigned char *value_ptr(Session *session, sql_var_t type,
 
645
  unsigned char *value_ptr(Session *session, enum_var_type type,
666
646
                           const LEX_STRING *base);
667
647
};
668
648
 
671
651
class sys_var_timestamp :public sys_var
672
652
{
673
653
public:
674
 
  sys_var_timestamp(sys_var_chain *chain, const char *name_arg)
675
 
    :sys_var(name_arg, NULL)
 
654
  sys_var_timestamp(sys_var_chain *chain, const char *name_arg,
 
655
                    Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG)
 
656
    :sys_var(name_arg, NULL, binlog_status_arg)
676
657
  { chain_sys_var(chain); }
677
658
  bool update(Session *session, set_var *var);
678
 
  void set_default(Session *session, sql_var_t type);
679
 
  bool check_type(sql_var_t type)    { return type == OPT_GLOBAL; }
680
 
  bool check_default(sql_var_t)
 
659
  void set_default(Session *session, enum_var_type type);
 
660
  bool check_type(enum_var_type type)    { return type == OPT_GLOBAL; }
 
661
  bool check_default(enum_var_type)
681
662
  { return 0; }
682
663
  SHOW_TYPE show_type(void) { return SHOW_LONG; }
683
 
  unsigned char *value_ptr(Session *session, sql_var_t type,
 
664
  unsigned char *value_ptr(Session *session, enum_var_type type,
684
665
                           const LEX_STRING *base);
685
666
};
686
667
 
688
669
class sys_var_last_insert_id :public sys_var
689
670
{
690
671
public:
691
 
  sys_var_last_insert_id(sys_var_chain *chain, const char *name_arg)
692
 
    :sys_var(name_arg, NULL)
 
672
  sys_var_last_insert_id(sys_var_chain *chain, const char *name_arg,
 
673
                         Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG)
 
674
    :sys_var(name_arg, NULL, binlog_status_arg)
693
675
  { chain_sys_var(chain); }
694
676
  bool update(Session *session, set_var *var);
695
 
  bool check_type(sql_var_t type) { return type == OPT_GLOBAL; }
 
677
  bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
696
678
  SHOW_TYPE show_type() { return SHOW_LONGLONG; }
697
 
  unsigned char *value_ptr(Session *session, sql_var_t type,
 
679
  unsigned char *value_ptr(Session *session, enum_var_type type,
698
680
                           const LEX_STRING *base);
699
681
};
700
682
 
702
684
class sys_var_collation :public sys_var_session
703
685
{
704
686
public:
705
 
  sys_var_collation(const char *name_arg)
706
 
    :sys_var_session(name_arg, NULL)
 
687
  sys_var_collation(const char *name_arg,
 
688
                    Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG)
 
689
    :sys_var_session(name_arg, NULL, binlog_status_arg)
707
690
  { }
708
691
  bool check(Session *session, set_var *var);
709
692
  SHOW_TYPE show_type() { return SHOW_CHAR; }
711
694
  {
712
695
    return ((type != STRING_RESULT) && (type != INT_RESULT));
713
696
  }
714
 
  bool check_default(sql_var_t) { return 0; }
715
 
  virtual void set_default(Session *session, sql_var_t type)= 0;
 
697
  bool check_default(enum_var_type) { return 0; }
 
698
  virtual void set_default(Session *session, enum_var_type type)= 0;
716
699
};
717
700
 
718
701
class sys_var_collation_sv :public sys_var_collation
719
702
{
720
 
  const CHARSET_INFO *system_variables::*offset;
 
703
  const CHARSET_INFO *SV::*offset;
721
704
  const CHARSET_INFO **global_default;
722
705
public:
723
706
  sys_var_collation_sv(sys_var_chain *chain, const char *name_arg,
724
 
                       const CHARSET_INFO *system_variables::*offset_arg,
725
 
                       const CHARSET_INFO **global_default_arg)
726
 
    :sys_var_collation(name_arg),
 
707
                       const CHARSET_INFO *SV::*offset_arg,
 
708
                       const CHARSET_INFO **global_default_arg,
 
709
                       Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG)
 
710
    :sys_var_collation(name_arg, binlog_status_arg),
727
711
    offset(offset_arg), global_default(global_default_arg)
728
712
  {
729
713
    chain_sys_var(chain);
730
714
  }
731
715
  bool update(Session *session, set_var *var);
732
 
  void set_default(Session *session, sql_var_t type);
733
 
  unsigned char *value_ptr(Session *session, sql_var_t type,
734
 
                           const LEX_STRING *base);
 
716
  void set_default(Session *session, enum_var_type type);
 
717
  unsigned char *value_ptr(Session *session, enum_var_type type,
 
718
                           const LEX_STRING *base);
 
719
};
 
720
 
 
721
 
 
722
class sys_var_key_cache_param :public sys_var
 
723
{
 
724
protected:
 
725
  size_t offset;
 
726
public:
 
727
  sys_var_key_cache_param(sys_var_chain *chain, const char *name_arg,
 
728
                          size_t offset_arg)
 
729
    :sys_var(name_arg), offset(offset_arg)
 
730
  { chain_sys_var(chain); }
 
731
  unsigned char *value_ptr(Session *session, enum_var_type type,
 
732
                           const LEX_STRING *base);
 
733
  bool check_default(enum_var_type)
 
734
  { return 1; }
 
735
  bool is_struct() { return 1; }
 
736
};
 
737
 
 
738
 
 
739
class sys_var_key_buffer_size :public sys_var_key_cache_param
 
740
{
 
741
public:
 
742
  sys_var_key_buffer_size(sys_var_chain *chain, const char *name_arg)
 
743
    :sys_var_key_cache_param(chain, name_arg,
 
744
                             offsetof(KEY_CACHE, param_buff_size))
 
745
  {}
 
746
  bool update(Session *session, set_var *var);
 
747
  SHOW_TYPE show_type() { return SHOW_LONGLONG; }
 
748
};
 
749
 
 
750
 
 
751
class sys_var_key_cache_uint32_t :public sys_var_key_cache_param
 
752
{
 
753
public:
 
754
  sys_var_key_cache_uint32_t(sys_var_chain *chain, const char *name_arg, size_t offset_arg)
 
755
    :sys_var_key_cache_param(chain, name_arg, offset_arg)
 
756
  {}
 
757
  bool update(Session *session, set_var *var);
 
758
  SHOW_TYPE show_type() { return SHOW_INT; }
735
759
};
736
760
 
737
761
/* Variable that you can only read from */
739
763
class sys_var_readonly: public sys_var
740
764
{
741
765
public:
742
 
  sql_var_t var_type;
 
766
  enum_var_type var_type;
743
767
  SHOW_TYPE show_type_value;
744
768
  sys_value_ptr_func value_ptr_func;
745
 
  sys_var_readonly(sys_var_chain *chain, const char *name_arg, sql_var_t type,
 
769
  sys_var_readonly(sys_var_chain *chain, const char *name_arg, enum_var_type type,
746
770
                   SHOW_TYPE show_type_arg,
747
771
                   sys_value_ptr_func value_ptr_func_arg)
748
772
    :sys_var(name_arg), var_type(type),
750
774
  { chain_sys_var(chain); }
751
775
  bool update(Session *, set_var *)
752
776
  { return 1; }
753
 
  bool check_default(sql_var_t)
 
777
  bool check_default(enum_var_type)
754
778
  { return 1; }
755
 
  bool check_type(sql_var_t type) { return type != var_type; }
 
779
  bool check_type(enum_var_type type) { return type != var_type; }
756
780
  bool check_update_type(Item_result)
757
781
  { return 1; }
758
 
  unsigned char *value_ptr(Session *session, sql_var_t,
 
782
  unsigned char *value_ptr(Session *session, enum_var_type,
759
783
                           const LEX_STRING *)
760
784
  {
761
785
    return (*value_ptr_func)(session);
765
789
};
766
790
 
767
791
 
 
792
class sys_var_have_option: public sys_var
 
793
{
 
794
protected:
 
795
  virtual SHOW_COMP_OPTION get_option() = 0;
 
796
public:
 
797
  sys_var_have_option(sys_var_chain *chain, const char *variable_name):
 
798
    sys_var(variable_name)
 
799
  { chain_sys_var(chain); }
 
800
  unsigned char *value_ptr(Session *, enum_var_type,
 
801
                           const LEX_STRING *)
 
802
  {
 
803
    return (unsigned char*) show_comp_option_name[get_option()];
 
804
  }
 
805
  bool update(Session *, set_var *) { return 1; }
 
806
  bool check_default(enum_var_type)
 
807
  { return 1; }
 
808
  bool check_type(enum_var_type type) { return type != OPT_GLOBAL; }
 
809
  bool check_update_type(Item_result)
 
810
  { return 1; }
 
811
  SHOW_TYPE show_type() { return SHOW_CHAR; }
 
812
  bool is_readonly() const { return 1; }
 
813
};
 
814
 
 
815
 
 
816
class sys_var_have_variable: public sys_var_have_option
 
817
{
 
818
  SHOW_COMP_OPTION *have_variable;
 
819
 
 
820
public:
 
821
  sys_var_have_variable(sys_var_chain *chain, const char *variable_name,
 
822
                        SHOW_COMP_OPTION *have_variable_arg):
 
823
    sys_var_have_option(chain, variable_name),
 
824
    have_variable(have_variable_arg)
 
825
  { }
 
826
  SHOW_COMP_OPTION get_option() { return *have_variable; }
 
827
};
 
828
 
 
829
 
 
830
class sys_var_have_plugin: public sys_var_have_option
 
831
{
 
832
  const char *plugin_name_str;
 
833
  const uint32_t plugin_name_len;
 
834
  const int plugin_type;
 
835
 
 
836
public:
 
837
  sys_var_have_plugin(sys_var_chain *chain, const char *variable_name,
 
838
                      const char *plugin_name_str_arg, uint32_t plugin_name_len_arg,
 
839
                      int plugin_type_arg):
 
840
    sys_var_have_option(chain, variable_name),
 
841
    plugin_name_str(plugin_name_str_arg), plugin_name_len(plugin_name_len_arg),
 
842
    plugin_type(plugin_type_arg)
 
843
  { }
 
844
  /* the following method is declared in sql_plugin.cc */
 
845
  SHOW_COMP_OPTION get_option();
 
846
};
 
847
 
 
848
 
768
849
class sys_var_session_time_zone :public sys_var_session
769
850
{
770
851
public:
771
 
  sys_var_session_time_zone(sys_var_chain *chain, const char *name_arg)
772
 
    :sys_var_session(name_arg, NULL)
 
852
  sys_var_session_time_zone(sys_var_chain *chain, const char *name_arg,
 
853
                        Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG)
 
854
    :sys_var_session(name_arg, NULL, binlog_status_arg)
773
855
  {
774
856
    chain_sys_var(chain);
775
857
  }
779
861
  {
780
862
    return type != STRING_RESULT;               /* Only accept strings */
781
863
  }
782
 
  bool check_default(sql_var_t)
 
864
  bool check_default(enum_var_type)
783
865
  { return 0; }
784
866
  bool update(Session *session, set_var *var);
785
 
  unsigned char *value_ptr(Session *session, sql_var_t type,
 
867
  unsigned char *value_ptr(Session *session, enum_var_type type,
786
868
                           const LEX_STRING *base);
787
 
  virtual void set_default(Session *session, sql_var_t type);
 
869
  virtual void set_default(Session *session, enum_var_type type);
788
870
};
789
871
 
790
872
 
791
873
class sys_var_microseconds :public sys_var_session
792
874
{
793
 
  uint64_t system_variables::*offset;
 
875
  uint64_t SV::*offset;
794
876
public:
795
877
  sys_var_microseconds(sys_var_chain *chain, const char *name_arg,
796
 
                       uint64_t system_variables::*offset_arg):
 
878
                       uint64_t SV::*offset_arg):
797
879
    sys_var_session(name_arg), offset(offset_arg)
798
880
  { chain_sys_var(chain); }
799
881
  bool check(Session *, set_var *) {return 0;}
800
882
  bool update(Session *session, set_var *var);
801
 
  void set_default(Session *session, sql_var_t type);
 
883
  void set_default(Session *session, enum_var_type type);
802
884
  SHOW_TYPE show_type() { return SHOW_DOUBLE; }
803
885
  bool check_update_type(Item_result type)
804
886
  {
805
887
    return (type != INT_RESULT && type != REAL_RESULT && type != DECIMAL_RESULT);
806
888
  }
 
889
  unsigned char *value_ptr(Session *session, enum_var_type type,
 
890
                           const LEX_STRING *base);
807
891
};
808
892
 
809
893
class sys_var_session_lc_time_names :public sys_var_session
810
894
{
811
895
public:
812
 
  sys_var_session_lc_time_names(sys_var_chain *chain, const char *name_arg)
813
 
    : sys_var_session(name_arg, NULL)
 
896
  sys_var_session_lc_time_names(sys_var_chain *chain, const char *name_arg,
 
897
                            Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG)
 
898
    : sys_var_session(name_arg, NULL, binlog_status_arg)
814
899
  {
815
900
    chain_sys_var(chain);
816
901
  }
820
905
  {
821
906
    return ((type != STRING_RESULT) && (type != INT_RESULT));
822
907
  }
823
 
  bool check_default(sql_var_t)
 
908
  bool check_default(enum_var_type)
824
909
  { return 0; }
825
910
  bool update(Session *session, set_var *var);
826
 
  unsigned char *value_ptr(Session *session, sql_var_t type,
 
911
  unsigned char *value_ptr(Session *session, enum_var_type type,
827
912
                           const LEX_STRING *base);
828
 
  virtual void set_default(Session *session, sql_var_t type);
 
913
  virtual void set_default(Session *session, enum_var_type type);
829
914
};
830
915
 
831
916
 
833
918
  Classes for parsing of the SET command
834
919
****************************************************************************/
835
920
 
836
 
class set_var_base :public memory::SqlAlloc
 
921
class set_var_base :public Sql_alloc
837
922
{
838
923
public:
839
924
  set_var_base() {}
843
928
  /* light check for PS */
844
929
};
845
930
 
 
931
 
846
932
/* MySQL internal variables */
 
933
 
847
934
class set_var :public set_var_base
848
935
{
849
936
public:
850
937
  sys_var *var;
851
938
  Item *value;
852
 
  sql_var_t type;
 
939
  enum_var_type type;
853
940
  union
854
941
  {
855
942
    const CHARSET_INFO *charset;
856
943
    uint32_t uint32_t_value;
857
944
    uint64_t uint64_t_value;
858
945
    size_t size_t_value;
859
 
    plugin::StorageEngine *storage_engine;
 
946
    StorageEngine *storage_engine;
860
947
    Time_zone *time_zone;
861
948
    MY_LOCALE *locale_value;
862
949
  } save_result;
863
950
  LEX_STRING base;                      /* for structs */
864
951
 
865
 
  set_var(sql_var_t type_arg, sys_var *var_arg,
 
952
  set_var(enum_var_type type_arg, sys_var *var_arg,
866
953
          const LEX_STRING *base_name_arg, Item *value_arg)
867
954
    :var(var_arg), type(type_arg), base(*base_name_arg)
868
955
  {
900
987
};
901
988
 
902
989
 
 
990
extern "C"
 
991
{
 
992
  typedef int (*process_key_cache_t) (const char *, KEY_CACHE *);
 
993
}
 
994
 
 
995
/* Named lists (used for keycaches) */
 
996
 
 
997
class NAMED_LIST :public ilink
 
998
{
 
999
  std::string name;
 
1000
public:
 
1001
  unsigned char* data;
 
1002
 
 
1003
  NAMED_LIST(I_List<NAMED_LIST> *links, const char *name_arg,
 
1004
                   uint32_t name_length_arg, unsigned char* data_arg);
 
1005
  bool cmp(const char *name_cmp, uint32_t length);
 
1006
  friend bool process_key_caches(process_key_cache_t func);
 
1007
  friend void delete_elements(I_List<NAMED_LIST> *list,
 
1008
                              void (*free_element)(const char*,
 
1009
                                                   unsigned char*));
 
1010
};
 
1011
 
 
1012
/* updated in sql_acl.cc */
 
1013
 
 
1014
extern sys_var_session_bool sys_old_alter_table;
 
1015
extern LEX_STRING default_key_cache_base;
 
1016
 
903
1017
/* For sql_yacc */
904
1018
struct sys_var_with_base
905
1019
{
913
1027
 
914
1028
int set_var_init();
915
1029
void set_var_free();
916
 
drizzle_show_var* enumerate_sys_vars(Session *session, bool sorted);
917
 
void drizzle_add_plugin_sysvar(sys_var_pluginvar *var);
918
 
void drizzle_del_plugin_sysvar();
919
 
int mysql_add_sys_var_chain(sys_var *chain, struct option *long_options);
 
1030
int mysql_append_static_vars(const SHOW_VAR *show_vars, uint32_t count);
 
1031
SHOW_VAR* enumerate_sys_vars(Session *session, bool sorted);
 
1032
int mysql_add_sys_var_chain(sys_var *chain, struct my_option *long_options);
920
1033
int mysql_del_sys_var_chain(sys_var *chain);
921
1034
sys_var *find_sys_var(Session *session, const char *str, uint32_t length=0);
922
1035
int sql_set_variables(Session *session, List<set_var_base> *var_list);
923
1036
bool not_all_support_one_shot(List<set_var_base> *var_list);
 
1037
void fix_delay_key_write(Session *session, enum_var_type type);
 
1038
void fix_slave_exec_mode(enum_var_type type);
924
1039
extern sys_var_session_time_zone sys_time_zone;
925
1040
extern sys_var_session_bit sys_autocommit;
926
1041
const CHARSET_INFO *get_old_charset_by_name(const char *old_name);
 
1042
unsigned char* find_named(I_List<NAMED_LIST> *list, const char *name, uint32_t length,
 
1043
                NAMED_LIST **found);
927
1044
 
928
1045
extern sys_var_str sys_var_general_log_path, sys_var_slow_log_path;
929
1046
 
930
 
} /* namespace drizzled */
 
1047
/* key_cache functions */
 
1048
KEY_CACHE *get_key_cache(const LEX_STRING *cache_name);
 
1049
KEY_CACHE *get_or_create_key_cache(const char *name, uint32_t length);
 
1050
void free_key_cache(const char *name, KEY_CACHE *key_cache);
 
1051
bool process_key_caches(process_key_cache_t func);
 
1052
void delete_elements(I_List<NAMED_LIST> *list,
 
1053
                     void (*free_element)(const char*, unsigned char*));
931
1054
 
932
 
#endif /* DRIZZLED_SET_VAR_H */
 
1055
#endif /* DRIZZLED_ITEM_SET_H */