~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/set_var.h

  • Committer: Brian Aker
  • Date: 2009-04-17 01:45:33 UTC
  • Revision ID: brian@gaz-20090417014533-exdrtriab9zecqs2
Refactor get_variable to session

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2002-2006 MySQL AB
2
 
 
3
 
   This program is free software; you can redistribute it and/or modify
4
 
   it under the terms of the GNU General Public License as published by
5
 
   the Free Software Foundation; version 2 of the License.
6
 
 
7
 
   This program is distributed in the hope that it will be useful,
8
 
   but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
 
   GNU General Public License for more details.
11
 
 
12
 
   You should have received a copy of the GNU General Public License
13
 
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
 
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
 
3
 *
 
4
 *  Copyright (C) 2008 Sun Microsystems
 
5
 *
 
6
 *  This program is free software; you can redistribute it and/or modify
 
7
 *  it under the terms of the GNU General Public License as published by
 
8
 *  the Free Software Foundation; version 2 of the License.
 
9
 *
 
10
 *  This program is distributed in the hope that it will be useful,
 
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 *  GNU General Public License for more details.
 
14
 *
 
15
 *  You should have received a copy of the GNU General Public License
 
16
 *  along with this program; if not, write to the Free Software
 
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
18
 */
 
19
 
 
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>
 
26
 
 
27
#include <string>
15
28
 
16
29
/* Classes to support the SET command */
17
30
 
18
 
#ifdef USE_PRAGMA_INTERFACE
19
 
#pragma interface                       /* gcc class implementation */
20
 
#endif
21
31
 
22
32
/****************************************************************************
23
33
  Variables that are changable runtime are declared using the
27
37
class sys_var;
28
38
class set_var;
29
39
class sys_var_pluginvar; /* opaque */
 
40
class Time_zone;
30
41
typedef struct system_variables SV;
31
42
typedef struct my_locale_st MY_LOCALE;
32
43
 
33
44
extern TYPELIB bool_typelib, delay_key_write_typelib, sql_mode_typelib,
34
 
  optimizer_switch_typelib, slave_exec_mode_typelib;
 
45
       optimizer_switch_typelib, slave_exec_mode_typelib;
35
46
 
36
 
typedef int (*sys_check_func)(THD *,  set_var *);
37
 
typedef bool (*sys_update_func)(THD *, set_var *);
38
 
typedef void (*sys_after_update_func)(THD *,enum_var_type);
39
 
typedef void (*sys_set_default_func)(THD *, enum_var_type);
40
 
typedef uchar *(*sys_value_ptr_func)(THD *thd);
 
47
typedef int (*sys_check_func)(Session *,  set_var *);
 
48
typedef bool (*sys_update_func)(Session *, set_var *);
 
49
typedef void (*sys_after_update_func)(Session *,enum_var_type);
 
50
typedef void (*sys_set_default_func)(Session *, enum_var_type);
 
51
typedef unsigned char *(*sys_value_ptr_func)(Session *session);
41
52
 
42
53
struct sys_var_chain
43
54
{
53
64
    Enumeration type to indicate for a system variable whether it will be written to the binlog or not.
54
65
  */
55
66
  enum Binlog_status_enum
56
 
  {  
 
67
  {
57
68
    /* The variable value is not in the binlog. */
58
69
    NOT_IN_BINLOG,
59
70
    /* The value of the @@session variable is in the binlog. */
66
77
 
67
78
  sys_var *next;
68
79
  struct my_option *option_limits;      /* Updated by by set_var_init() */
69
 
  uint name_length;                     /* Updated by by set_var_init() */
 
80
  uint32_t name_length;                 /* Updated by by set_var_init() */
70
81
  const char *name;
71
82
 
72
83
  sys_after_update_func after_update;
73
 
  bool no_support_one_shot;
74
84
  sys_var(const char *name_arg, sys_after_update_func func= NULL,
75
85
          Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG)
76
 
    :name(name_arg), after_update(func), no_support_one_shot(1),
 
86
    :name(name_arg), after_update(func),
77
87
    binlog_status(binlog_status_arg),
78
88
    m_allow_empty_value(true)
79
89
  {}
86
96
      chain_arg->first= this;
87
97
    chain_arg->last= this;
88
98
  }
89
 
  virtual bool check(THD *thd, set_var *var);
90
 
  bool check_enum(THD *thd, set_var *var, const TYPELIB *enum_names);
91
 
  bool check_set(THD *thd, set_var *var, TYPELIB *enum_names);
92
 
  bool is_written_to_binlog(enum_var_type type)
93
 
  {
94
 
    return (type == OPT_SESSION || type == OPT_DEFAULT) &&
95
 
      (binlog_status == SESSION_VARIABLE_IN_BINLOG);
96
 
  }
97
 
  virtual bool update(THD *thd, set_var *var)=0;
98
 
  virtual void set_default(THD *thd_arg __attribute__((unused)),
99
 
                           enum_var_type type __attribute__((unused)))
 
99
  virtual bool check(Session *session, set_var *var);
 
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);
 
102
  virtual bool update(Session *session, set_var *var)=0;
 
103
  virtual void set_default(Session *, enum_var_type)
100
104
  {}
101
105
  virtual SHOW_TYPE show_type() { return SHOW_UNDEF; }
102
 
  virtual uchar *value_ptr(THD *thd __attribute__((unused)),
103
 
                           enum_var_type type __attribute__((unused)),
104
 
                           LEX_STRING *base __attribute__((unused)))
 
106
  virtual unsigned char *value_ptr(Session *, enum_var_type, const LEX_STRING *)
105
107
  { return 0; }
106
108
  virtual bool check_type(enum_var_type type)
107
109
  { return type != OPT_GLOBAL; }                /* Error if not GLOBAL */
108
110
  virtual bool check_update_type(Item_result type)
109
111
  { return type != INT_RESULT; }                /* Assume INT */
110
 
  virtual bool check_default(enum_var_type type __attribute__((unused)))
 
112
  virtual bool check_default(enum_var_type)
111
113
  { return option_limits == 0; }
112
 
  Item *item(THD *thd, enum_var_type type, LEX_STRING *base);
 
114
  Item *item(Session *session, enum_var_type type, const LEX_STRING *base);
113
115
  virtual bool is_struct() { return 0; }
114
116
  virtual bool is_readonly() const { return 0; }
115
117
  virtual sys_var_pluginvar *cast_pluginvar() { return 0; }
143
145
};
144
146
 
145
147
 
146
 
/*
147
 
  A global-only ulong variable that requires its access to be
148
 
  protected with a mutex.
149
 
*/
150
 
 
151
 
class sys_var_long_ptr_global: public sys_var_global
152
 
{
153
 
  ulong *value;
154
 
public:
155
 
  sys_var_long_ptr_global(sys_var_chain *chain, const char *name_arg,
156
 
                          ulong *value_ptr_arg,
157
 
                          pthread_mutex_t *guard_arg,
158
 
                          sys_after_update_func after_update_arg= NULL)
159
 
    :sys_var_global(name_arg, after_update_arg, guard_arg),
160
 
    value(value_ptr_arg)
161
 
  { chain_sys_var(chain); }
162
 
  bool check(THD *thd, set_var *var);
163
 
  bool update(THD *thd, set_var *var);
164
 
  void set_default(THD *thd, enum_var_type type);
165
 
  SHOW_TYPE show_type() { return SHOW_LONG; }
166
 
  uchar *value_ptr(THD *thd __attribute__((unused)),
167
 
                   enum_var_type type __attribute__((unused)),
168
 
                   LEX_STRING *base __attribute__((unused)))
169
 
  { return (uchar*) value; }
170
 
};
171
 
 
172
 
 
173
 
/*
174
 
  A global ulong variable that is protected by LOCK_global_system_variables
175
 
*/
176
 
 
177
 
class sys_var_long_ptr :public sys_var_long_ptr_global
178
 
{
179
 
public:
180
 
  sys_var_long_ptr(sys_var_chain *chain, const char *name_arg, ulong *value_ptr,
181
 
                   sys_after_update_func after_update_arg= NULL);
 
148
class sys_var_uint32_t_ptr :public sys_var
 
149
{
 
150
  uint32_t *value;
 
151
public:
 
152
  sys_var_uint32_t_ptr(sys_var_chain *chain, const char *name_arg,
 
153
                       uint32_t *value_ptr_arg)
 
154
    :sys_var(name_arg),value(value_ptr_arg)
 
155
  { chain_sys_var(chain); }
 
156
  sys_var_uint32_t_ptr(sys_var_chain *chain, const char *name_arg,
 
157
                       uint32_t *value_ptr_arg,
 
158
                       sys_after_update_func func)
 
159
    :sys_var(name_arg,func), value(value_ptr_arg)
 
160
  { chain_sys_var(chain); }
 
161
  bool check(Session *session, set_var *var);
 
162
  bool update(Session *session, set_var *var);
 
163
  void set_default(Session *session, enum_var_type type);
 
164
  SHOW_TYPE show_type() { return SHOW_INT; }
 
165
  unsigned char *value_ptr(Session *, enum_var_type, const LEX_STRING *)
 
166
  { return (unsigned char*) value; }
182
167
};
183
168
 
184
169
 
193
178
                       sys_after_update_func func)
194
179
    :sys_var(name_arg,func), value(value_ptr_arg)
195
180
  { chain_sys_var(chain); }
196
 
  bool update(THD *thd, set_var *var);
197
 
  void set_default(THD *thd, enum_var_type type);
 
181
  bool update(Session *session, set_var *var);
 
182
  void set_default(Session *session, enum_var_type type);
198
183
  SHOW_TYPE show_type() { return SHOW_LONGLONG; }
199
 
  uchar *value_ptr(THD *thd __attribute__((unused)),
200
 
                   enum_var_type type __attribute__((unused)),
201
 
                   LEX_STRING *base __attribute__((unused)))
202
 
  { return (uchar*) value; }
 
184
  unsigned char *value_ptr(Session *, enum_var_type,
 
185
                           const LEX_STRING *)
 
186
  { return (unsigned char*) value; }
203
187
};
204
188
 
 
189
class sys_var_size_t_ptr :public sys_var
 
190
{
 
191
  size_t *value;
 
192
public:
 
193
  sys_var_size_t_ptr(sys_var_chain *chain, const char *name_arg, size_t *value_ptr_arg)
 
194
    :sys_var(name_arg),value(value_ptr_arg)
 
195
  { chain_sys_var(chain); }
 
196
  sys_var_size_t_ptr(sys_var_chain *chain, const char *name_arg, size_t *value_ptr_arg,
 
197
                     sys_after_update_func func)
 
198
    :sys_var(name_arg,func), value(value_ptr_arg)
 
199
  { chain_sys_var(chain); }
 
200
  bool update(Session *session, set_var *var);
 
201
  void set_default(Session *session, enum_var_type type);
 
202
  SHOW_TYPE show_type() { return SHOW_SIZE; }
 
203
  unsigned char *value_ptr(Session *, enum_var_type, const LEX_STRING *)
 
204
  { return (unsigned char*) value; }
 
205
};
205
206
 
206
207
class sys_var_bool_ptr :public sys_var
207
208
{
210
211
  sys_var_bool_ptr(sys_var_chain *chain, const char *name_arg, bool *value_arg)
211
212
    :sys_var(name_arg),value(value_arg)
212
213
  { chain_sys_var(chain); }
213
 
  bool check(THD *thd, set_var *var)
 
214
  bool check(Session *session, set_var *var)
214
215
  {
215
 
    return check_enum(thd, var, &bool_typelib);
 
216
    return check_enum(session, var, &bool_typelib);
216
217
  }
217
 
  bool update(THD *thd, set_var *var);
218
 
  void set_default(THD *thd, enum_var_type type);
 
218
  bool update(Session *session, set_var *var);
 
219
  void set_default(Session *session, enum_var_type type);
219
220
  SHOW_TYPE show_type() { return SHOW_MY_BOOL; }
220
 
  uchar *value_ptr(THD *thd __attribute__((unused)),
221
 
                   enum_var_type type __attribute__((unused)),
222
 
                   LEX_STRING *base __attribute__((unused)))
223
 
  { return (uchar*) value; }
224
 
  bool check_update_type(Item_result type __attribute__((unused)))
 
221
  unsigned char *value_ptr(Session *, enum_var_type, const LEX_STRING *)
 
222
  { return (unsigned char*) value; }
 
223
  bool check_update_type(Item_result)
225
224
  { return 0; }
226
225
};
227
226
 
240
239
{
241
240
public:
242
241
  char *value;                                  // Pointer to allocated string
243
 
  uint value_length;
 
242
  uint32_t value_length;
244
243
  sys_check_func check_func;
245
244
  sys_update_func update_func;
246
245
  sys_set_default_func set_default_func;
252
251
    :sys_var(name_arg), value(value_arg), check_func(check_func_arg),
253
252
    update_func(update_func_arg),set_default_func(set_default_func_arg)
254
253
  { chain_sys_var(chain); }
255
 
  bool check(THD *thd, set_var *var);
256
 
  bool update(THD *thd, set_var *var)
 
254
  bool check(Session *session, set_var *var);
 
255
  bool update(Session *session, set_var *var)
257
256
  {
258
 
    return (*update_func)(thd, var);
 
257
    return (*update_func)(session, var);
259
258
  }
260
 
  void set_default(THD *thd, enum_var_type type)
 
259
  void set_default(Session *session, enum_var_type type)
261
260
  {
262
 
    (*set_default_func)(thd, type);
 
261
    (*set_default_func)(session, type);
263
262
  }
264
263
  SHOW_TYPE show_type() { return SHOW_CHAR; }
265
 
  uchar *value_ptr(THD *thd __attribute__((unused)),
266
 
                   enum_var_type type __attribute__((unused)),
267
 
                   LEX_STRING *base __attribute__((unused)))
268
 
  { return (uchar*) value; }
 
264
  unsigned char *value_ptr(Session *, enum_var_type, const LEX_STRING *)
 
265
  { return (unsigned char*) value; }
269
266
  bool check_update_type(Item_result type)
270
267
  {
271
268
    return type != STRING_RESULT;               /* Only accept strings */
272
269
  }
273
 
  bool check_default(enum_var_type type __attribute__((unused)))
 
270
  bool check_default(enum_var_type)
274
271
  { return 0; }
275
272
};
276
273
 
287
284
  {
288
285
    value= new_value;
289
286
  }
290
 
  bool check(THD *thd __attribute__((unused)),
291
 
             set_var *var __attribute__((unused)))
 
287
  bool check(Session *, set_var *)
292
288
  {
293
289
    return 1;
294
290
  }
295
 
  bool update(THD *thd __attribute__((unused)),
296
 
              set_var *var __attribute__((unused)))
 
291
  bool update(Session *, set_var *)
297
292
  {
298
293
    return 1;
299
294
  }
300
295
  SHOW_TYPE show_type() { return SHOW_CHAR; }
301
 
  uchar *value_ptr(THD *thd __attribute__((unused)),
302
 
                   enum_var_type type __attribute__((unused)),
303
 
                   LEX_STRING *base __attribute__((unused)))
 
296
  unsigned char *value_ptr(Session *, enum_var_type, const LEX_STRING *)
304
297
  {
305
 
    return (uchar*) value;
 
298
    return (unsigned char*) value;
306
299
  }
307
 
  bool check_update_type(Item_result type __attribute__((unused)))
 
300
  bool check_update_type(Item_result)
308
301
  {
309
302
    return 1;
310
303
  }
311
 
  bool check_default(enum_var_type type __attribute__((unused)))
 
304
  bool check_default(enum_var_type)
312
305
  { return 1; }
313
306
  bool is_readonly() const { return 1; }
314
307
};
321
314
  sys_var_const_str_ptr(sys_var_chain *chain, const char *name_arg, char **value_arg)
322
315
    :sys_var(name_arg),value(value_arg)
323
316
  { chain_sys_var(chain); }
324
 
  bool check(THD *thd __attribute__((unused)),
325
 
             set_var *var __attribute__((unused)))
 
317
  bool check(Session *, set_var *)
326
318
  {
327
319
    return 1;
328
320
  }
329
 
  bool update(THD *thd __attribute__((unused)),
330
 
              set_var *var __attribute__((unused)))
 
321
  bool update(Session *, set_var *)
331
322
  {
332
323
    return 1;
333
324
  }
334
325
  SHOW_TYPE show_type() { return SHOW_CHAR; }
335
 
  uchar *value_ptr(THD *thd __attribute__((unused)),
336
 
                   enum_var_type type __attribute__((unused)),
337
 
                   LEX_STRING *base __attribute__((unused)))
 
326
  unsigned char *value_ptr(Session *, enum_var_type, const LEX_STRING *)
338
327
  {
339
 
    return (uchar*) *value;
 
328
    return (unsigned char*) *value;
340
329
  }
341
 
  bool check_update_type(Item_result type __attribute__((unused)))
 
330
  bool check_update_type(Item_result)
342
331
  {
343
332
    return 1;
344
333
  }
345
 
  bool check_default(enum_var_type type __attribute__((unused)))
 
334
  bool check_default(enum_var_type)
346
335
  { return 1; }
347
336
  bool is_readonly(void) const { return 1; }
348
337
};
350
339
 
351
340
class sys_var_enum :public sys_var
352
341
{
353
 
  uint *value;
 
342
  uint32_t *value;
354
343
  TYPELIB *enum_names;
355
344
public:
356
 
  sys_var_enum(sys_var_chain *chain, const char *name_arg, uint *value_arg,
 
345
  sys_var_enum(sys_var_chain *chain, const char *name_arg, uint32_t *value_arg,
357
346
               TYPELIB *typelib, sys_after_update_func func)
358
347
    :sys_var(name_arg,func), value(value_arg), enum_names(typelib)
359
348
  { chain_sys_var(chain); }
360
 
  bool check(THD *thd, set_var *var)
 
349
  bool check(Session *session, set_var *var)
361
350
  {
362
 
    return check_enum(thd, var, enum_names);
 
351
    return check_enum(session, var, enum_names);
363
352
  }
364
 
  bool update(THD *thd, set_var *var);
 
353
  bool update(Session *session, set_var *var);
365
354
  SHOW_TYPE show_type() { return SHOW_CHAR; }
366
 
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
367
 
  bool check_update_type(Item_result type __attribute__((unused)))
 
355
  unsigned char *value_ptr(Session *session, enum_var_type type,
 
356
                           const LEX_STRING *base);
 
357
  bool check_update_type(Item_result)
368
358
  { return 0; }
369
359
};
370
360
 
371
361
 
372
362
class sys_var_enum_const :public sys_var
373
363
{
374
 
  ulong SV::*offset;
 
364
  uint32_t SV::*offset;
375
365
  TYPELIB *enum_names;
376
366
public:
377
 
  sys_var_enum_const(sys_var_chain *chain, const char *name_arg, ulong SV::*offset_arg,
 
367
  sys_var_enum_const(sys_var_chain *chain, const char *name_arg, uint32_t SV::*offset_arg,
378
368
      TYPELIB *typelib, sys_after_update_func func)
379
369
    :sys_var(name_arg,func), offset(offset_arg), enum_names(typelib)
380
370
  { chain_sys_var(chain); }
381
 
  bool check(THD *thd __attribute__((unused)),
382
 
             set_var *var __attribute__((unused)))
 
371
  bool check(Session *, set_var *)
383
372
  { return 1; }
384
 
  bool update(THD *thd __attribute__((unused)),
385
 
              set_var *var __attribute__((unused)))
 
373
  bool update(Session *, set_var *)
386
374
  { return 1; }
387
375
  SHOW_TYPE show_type() { return SHOW_CHAR; }
388
 
  bool check_update_type(Item_result type __attribute__((unused)))
 
376
  bool check_update_type(Item_result)
389
377
  { return 1; }
390
378
  bool is_readonly() const { return 1; }
391
 
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
379
  unsigned char *value_ptr(Session *session, enum_var_type type,
 
380
                           const LEX_STRING *base);
392
381
};
393
382
 
394
383
 
395
 
class sys_var_thd :public sys_var
 
384
class sys_var_session :public sys_var
396
385
{
397
386
public:
398
 
  sys_var_thd(const char *name_arg, 
 
387
  sys_var_session(const char *name_arg,
399
388
              sys_after_update_func func= NULL,
400
 
              Binlog_status_enum binlog_status= NOT_IN_BINLOG)
401
 
    :sys_var(name_arg, func, binlog_status)
 
389
              Binlog_status_enum bl_status= NOT_IN_BINLOG)
 
390
    :sys_var(name_arg, func, bl_status)
402
391
  {}
403
 
  bool check_type(enum_var_type type __attribute__((unused)))
 
392
  bool check_type(enum_var_type)
404
393
  { return 0; }
405
394
  bool check_default(enum_var_type type)
406
395
  {
408
397
  }
409
398
};
410
399
 
411
 
 
412
 
class sys_var_thd_ulong :public sys_var_thd
 
400
class sys_var_session_uint32_t :public sys_var_session
413
401
{
414
402
  sys_check_func check_func;
415
403
public:
416
 
  ulong SV::*offset;
417
 
  sys_var_thd_ulong(sys_var_chain *chain, const char *name_arg,
418
 
                    ulong SV::*offset_arg,
419
 
                    sys_check_func c_func= NULL,
420
 
                    sys_after_update_func au_func= NULL,
421
 
                    Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG)
422
 
    :sys_var_thd(name_arg, au_func, binlog_status_arg), check_func(c_func),
 
404
  uint32_t SV::*offset;
 
405
  sys_var_session_uint32_t(sys_var_chain *chain, const char *name_arg,
 
406
                           uint32_t SV::*offset_arg,
 
407
                           sys_check_func c_func= NULL,
 
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),
423
411
    offset(offset_arg)
424
412
  { chain_sys_var(chain); }
425
 
  bool check(THD *thd, set_var *var);
426
 
  bool update(THD *thd, set_var *var);
427
 
  void set_default(THD *thd, enum_var_type type);
428
 
  SHOW_TYPE show_type() { return SHOW_LONG; }
429
 
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
413
  bool check(Session *session, set_var *var);
 
414
  bool update(Session *session, set_var *var);
 
415
  void set_default(Session *session, enum_var_type type);
 
416
  SHOW_TYPE show_type() { return SHOW_INT; }
 
417
  unsigned char *value_ptr(Session *session, enum_var_type type,
 
418
                           const LEX_STRING *base);
430
419
};
431
420
 
432
421
 
433
 
class sys_var_thd_ha_rows :public sys_var_thd
 
422
class sys_var_session_ha_rows :public sys_var_session
434
423
{
435
424
public:
436
425
  ha_rows SV::*offset;
437
 
  sys_var_thd_ha_rows(sys_var_chain *chain, const char *name_arg, 
 
426
  sys_var_session_ha_rows(sys_var_chain *chain, const char *name_arg,
438
427
                      ha_rows SV::*offset_arg)
439
 
    :sys_var_thd(name_arg), offset(offset_arg)
 
428
    :sys_var_session(name_arg), offset(offset_arg)
440
429
  { chain_sys_var(chain); }
441
 
  sys_var_thd_ha_rows(sys_var_chain *chain, const char *name_arg, 
 
430
  sys_var_session_ha_rows(sys_var_chain *chain, const char *name_arg,
442
431
                      ha_rows SV::*offset_arg,
443
432
                      sys_after_update_func func)
444
 
    :sys_var_thd(name_arg,func), offset(offset_arg)
 
433
    :sys_var_session(name_arg,func), offset(offset_arg)
445
434
  { chain_sys_var(chain); }
446
 
  bool update(THD *thd, set_var *var);
447
 
  void set_default(THD *thd, enum_var_type type);
 
435
  bool update(Session *session, set_var *var);
 
436
  void set_default(Session *session, enum_var_type type);
448
437
  SHOW_TYPE show_type() { return SHOW_HA_ROWS; }
449
 
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
438
  unsigned char *value_ptr(Session *session, enum_var_type type,
 
439
                           const LEX_STRING *base);
450
440
};
451
441
 
452
442
 
453
 
class sys_var_thd_uint64_t :public sys_var_thd
 
443
class sys_var_session_uint64_t :public sys_var_session
454
444
{
 
445
  sys_check_func check_func;
455
446
public:
456
447
  uint64_t SV::*offset;
457
448
  bool only_global;
458
 
  sys_var_thd_uint64_t(sys_var_chain *chain, const char *name_arg, 
459
 
                        uint64_t SV::*offset_arg)
460
 
    :sys_var_thd(name_arg), offset(offset_arg)
 
449
  sys_var_session_uint64_t(sys_var_chain *chain, const char *name_arg,
 
450
                           uint64_t SV::*offset_arg,
 
451
                           sys_after_update_func au_func= NULL,
 
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),
 
455
    check_func(c_func),
 
456
    offset(offset_arg)
461
457
  { chain_sys_var(chain); }
462
 
  sys_var_thd_uint64_t(sys_var_chain *chain, const char *name_arg, 
463
 
                        uint64_t SV::*offset_arg,
464
 
                        sys_after_update_func func, bool only_global_arg)
465
 
    :sys_var_thd(name_arg, func), offset(offset_arg),
 
458
  sys_var_session_uint64_t(sys_var_chain *chain,
 
459
                           const char *name_arg,
 
460
                           uint64_t SV::*offset_arg,
 
461
                           sys_after_update_func func,
 
462
                           bool only_global_arg,
 
463
                           sys_check_func cfunc= NULL)
 
464
    :sys_var_session(name_arg, func),
 
465
    check_func(cfunc),
 
466
    offset(offset_arg),
466
467
    only_global(only_global_arg)
467
468
  { chain_sys_var(chain); }
468
 
  bool update(THD *thd, set_var *var);
469
 
  void set_default(THD *thd, enum_var_type type);
 
469
  bool update(Session *session, set_var *var);
 
470
  void set_default(Session *session, enum_var_type type);
470
471
  SHOW_TYPE show_type() { return SHOW_LONGLONG; }
471
 
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
472
 
  bool check(THD *thd, set_var *var);
473
 
  bool check_default(enum_var_type type)
474
 
  {
475
 
    return type == OPT_GLOBAL && !option_limits;
476
 
  }
477
 
  bool check_type(enum_var_type type)
478
 
  {
479
 
    return (only_global && type != OPT_GLOBAL);
480
 
  }
481
 
};
482
 
 
483
 
 
484
 
class sys_var_thd_bool :public sys_var_thd
 
472
  unsigned char *value_ptr(Session *session, enum_var_type type,
 
473
                           const LEX_STRING *base);
 
474
  bool check(Session *session, set_var *var);
 
475
  bool check_default(enum_var_type type)
 
476
  {
 
477
    return type == OPT_GLOBAL && !option_limits;
 
478
  }
 
479
  bool check_type(enum_var_type type)
 
480
  {
 
481
    return (only_global && type != OPT_GLOBAL);
 
482
  }
 
483
};
 
484
 
 
485
class sys_var_session_size_t :public sys_var_session
 
486
{
 
487
  sys_check_func check_func;
 
488
public:
 
489
  size_t SV::*offset;
 
490
  bool only_global;
 
491
  sys_var_session_size_t(sys_var_chain *chain, const char *name_arg,
 
492
                         size_t SV::*offset_arg,
 
493
                         sys_after_update_func au_func= NULL,
 
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),
 
497
     check_func(c_func),
 
498
     offset(offset_arg)
 
499
  { chain_sys_var(chain); }
 
500
  sys_var_session_size_t(sys_var_chain *chain,
 
501
                         const char *name_arg,
 
502
                         size_t SV::*offset_arg,
 
503
                         sys_after_update_func func,
 
504
                         bool only_global_arg,
 
505
                         sys_check_func cfunc= NULL)
 
506
    :sys_var_session(name_arg, func),
 
507
     check_func(cfunc),
 
508
     offset(offset_arg),
 
509
     only_global(only_global_arg)
 
510
  { chain_sys_var(chain); }
 
511
  bool update(Session *session, set_var *var);
 
512
  void set_default(Session *session, enum_var_type type);
 
513
  SHOW_TYPE show_type() { return SHOW_SIZE; }
 
514
  unsigned char *value_ptr(Session *session, enum_var_type type,
 
515
                           const LEX_STRING *base);
 
516
  bool check(Session *session, set_var *var);
 
517
  bool check_default(enum_var_type type)
 
518
  {
 
519
    return type == OPT_GLOBAL && !option_limits;
 
520
  }
 
521
  bool check_type(enum_var_type type)
 
522
  {
 
523
    return (only_global && type != OPT_GLOBAL);
 
524
  }
 
525
};
 
526
 
 
527
 
 
528
class sys_var_session_bool :public sys_var_session
485
529
{
486
530
public:
487
531
  bool SV::*offset;
488
 
  sys_var_thd_bool(sys_var_chain *chain, const char *name_arg, bool SV::*offset_arg)
489
 
    :sys_var_thd(name_arg), offset(offset_arg)
 
532
  sys_var_session_bool(sys_var_chain *chain, const char *name_arg, bool SV::*offset_arg)
 
533
    :sys_var_session(name_arg), offset(offset_arg)
490
534
  { chain_sys_var(chain); }
491
 
  sys_var_thd_bool(sys_var_chain *chain, const char *name_arg, bool SV::*offset_arg,
 
535
  sys_var_session_bool(sys_var_chain *chain, const char *name_arg, bool SV::*offset_arg,
492
536
                   sys_after_update_func func)
493
 
    :sys_var_thd(name_arg,func), offset(offset_arg)
 
537
    :sys_var_session(name_arg,func), offset(offset_arg)
494
538
  { chain_sys_var(chain); }
495
 
  bool update(THD *thd, set_var *var);
496
 
  void set_default(THD *thd, enum_var_type type);
 
539
  bool update(Session *session, set_var *var);
 
540
  void set_default(Session *session, enum_var_type type);
497
541
  SHOW_TYPE show_type() { return SHOW_MY_BOOL; }
498
 
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
499
 
  bool check(THD *thd, set_var *var)
 
542
  unsigned char *value_ptr(Session *session, enum_var_type type,
 
543
                           const LEX_STRING *base);
 
544
  bool check(Session *session, set_var *var)
500
545
  {
501
 
    return check_enum(thd, var, &bool_typelib);
 
546
    return check_enum(session, var, &bool_typelib);
502
547
  }
503
 
  bool check_update_type(Item_result type __attribute__((unused)))
 
548
  bool check_update_type(Item_result)
504
549
  { return 0; }
505
550
};
506
551
 
507
552
 
508
 
class sys_var_thd_enum :public sys_var_thd
 
553
class sys_var_session_enum :public sys_var_session
509
554
{
510
555
protected:
511
 
  ulong SV::*offset;
 
556
  uint32_t SV::*offset;
512
557
  TYPELIB *enum_names;
513
558
  sys_check_func check_func;
514
559
public:
515
 
  sys_var_thd_enum(sys_var_chain *chain, const char *name_arg,
516
 
                   ulong SV::*offset_arg, TYPELIB *typelib,
 
560
  sys_var_session_enum(sys_var_chain *chain, const char *name_arg,
 
561
                   uint32_t SV::*offset_arg, TYPELIB *typelib,
517
562
                   sys_after_update_func func= NULL,
518
 
                   sys_check_func check= NULL)
519
 
    :sys_var_thd(name_arg, func), offset(offset_arg),
520
 
    enum_names(typelib), check_func(check)
 
563
                   sys_check_func check_f= NULL)
 
564
    :sys_var_session(name_arg, func), offset(offset_arg),
 
565
    enum_names(typelib), check_func(check_f)
521
566
  { chain_sys_var(chain); }
522
 
  bool check(THD *thd, set_var *var)
 
567
  bool check(Session *session, set_var *var)
523
568
  {
524
569
    int ret= 0;
525
570
    if (check_func)
526
 
      ret= (*check_func)(thd, var);
527
 
    return ret ? ret : check_enum(thd, var, enum_names);
 
571
      ret= (*check_func)(session, var);
 
572
    return ret ? ret : check_enum(session, var, enum_names);
528
573
  }
529
 
  bool update(THD *thd, set_var *var);
530
 
  void set_default(THD *thd, enum_var_type type);
 
574
  bool update(Session *session, set_var *var);
 
575
  void set_default(Session *session, enum_var_type type);
531
576
  SHOW_TYPE show_type() { return SHOW_CHAR; }
532
 
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
533
 
  bool check_update_type(Item_result type __attribute__((unused)))
 
577
  unsigned char *value_ptr(Session *session, enum_var_type type,
 
578
                           const LEX_STRING *base);
 
579
  bool check_update_type(Item_result)
534
580
  { return 0; }
535
581
};
536
582
 
537
583
 
538
584
 
539
 
class sys_var_thd_optimizer_switch :public sys_var_thd_enum
 
585
class sys_var_session_optimizer_switch :public sys_var_session_enum
540
586
{
541
587
public:
542
 
  sys_var_thd_optimizer_switch(sys_var_chain *chain, const char *name_arg, 
543
 
                               ulong SV::*offset_arg)
544
 
    :sys_var_thd_enum(chain, name_arg, offset_arg, &optimizer_switch_typelib)
 
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)
545
591
  {}
546
 
  bool check(THD *thd, set_var *var)
 
592
  bool check(Session *session, set_var *var)
547
593
  {
548
 
    return check_set(thd, var, enum_names);
 
594
    return check_set(session, var, enum_names);
549
595
  }
550
 
  void set_default(THD *thd, enum_var_type type);
551
 
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
552
 
  static bool symbolic_mode_representation(THD *thd, uint64_t sql_mode,
 
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,
553
600
                                           LEX_STRING *rep);
554
601
};
555
602
 
556
603
 
557
 
class sys_var_thd_storage_engine :public sys_var_thd
 
604
class sys_var_session_storage_engine :public sys_var_session
558
605
{
559
606
protected:
560
 
  plugin_ref SV::*offset;
 
607
  StorageEngine *SV::*offset;
561
608
public:
562
 
  sys_var_thd_storage_engine(sys_var_chain *chain, const char *name_arg, 
563
 
                             plugin_ref SV::*offset_arg)
564
 
    :sys_var_thd(name_arg), offset(offset_arg)
 
609
  sys_var_session_storage_engine(sys_var_chain *chain, const char *name_arg,
 
610
                                 StorageEngine *SV::*offset_arg)
 
611
    :sys_var_session(name_arg), offset(offset_arg)
565
612
  { chain_sys_var(chain); }
566
 
  bool check(THD *thd, set_var *var);
 
613
  bool check(Session *session, set_var *var);
567
614
  SHOW_TYPE show_type() { return SHOW_CHAR; }
568
615
  bool check_update_type(Item_result type)
569
616
  {
570
617
    return type != STRING_RESULT;               /* Only accept strings */
571
618
  }
572
 
  void set_default(THD *thd, enum_var_type type);
573
 
  bool update(THD *thd, set_var *var);
574
 
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
619
  void set_default(Session *session, enum_var_type type);
 
620
  bool update(Session *session, set_var *var);
 
621
  unsigned char *value_ptr(Session *session, enum_var_type type,
 
622
                           const LEX_STRING *base);
575
623
};
576
624
 
577
 
class sys_var_thd_bit :public sys_var_thd
 
625
class sys_var_session_bit :public sys_var_session
578
626
{
579
627
  sys_check_func check_func;
580
628
  sys_update_func update_func;
581
629
public:
582
630
  uint64_t bit_flag;
583
631
  bool reverse;
584
 
  sys_var_thd_bit(sys_var_chain *chain, const char *name_arg,
 
632
  sys_var_session_bit(sys_var_chain *chain, const char *name_arg,
585
633
                  sys_check_func c_func, sys_update_func u_func,
586
634
                  uint64_t bit, bool reverse_arg=0,
587
635
                  Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG)
588
 
    :sys_var_thd(name_arg, NULL, binlog_status_arg), check_func(c_func),
 
636
    :sys_var_session(name_arg, NULL, binlog_status_arg), check_func(c_func),
589
637
    update_func(u_func), bit_flag(bit), reverse(reverse_arg)
590
638
  { chain_sys_var(chain); }
591
 
  bool check(THD *thd, set_var *var);
592
 
  bool update(THD *thd, set_var *var);
593
 
  bool check_update_type(Item_result type __attribute__((unused)))
 
639
  bool check(Session *session, set_var *var);
 
640
  bool update(Session *session, set_var *var);
 
641
  bool check_update_type(Item_result)
594
642
  { return 0; }
595
643
  bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
596
644
  SHOW_TYPE show_type() { return SHOW_MY_BOOL; }
597
 
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
645
  unsigned char *value_ptr(Session *session, enum_var_type type,
 
646
                           const LEX_STRING *base);
598
647
};
599
648
 
600
649
/* some variables that require special handling */
606
655
                    Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG)
607
656
    :sys_var(name_arg, NULL, binlog_status_arg)
608
657
  { chain_sys_var(chain); }
609
 
  bool update(THD *thd, set_var *var);
610
 
  void set_default(THD *thd, enum_var_type type);
 
658
  bool update(Session *session, set_var *var);
 
659
  void set_default(Session *session, enum_var_type type);
611
660
  bool check_type(enum_var_type type)    { return type == OPT_GLOBAL; }
612
 
  bool check_default(enum_var_type type __attribute__((unused)))
 
661
  bool check_default(enum_var_type)
613
662
  { return 0; }
614
663
  SHOW_TYPE show_type(void) { return SHOW_LONG; }
615
 
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
664
  unsigned char *value_ptr(Session *session, enum_var_type type,
 
665
                           const LEX_STRING *base);
616
666
};
617
667
 
618
668
 
623
673
                         Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG)
624
674
    :sys_var(name_arg, NULL, binlog_status_arg)
625
675
  { chain_sys_var(chain); }
626
 
  bool update(THD *thd, set_var *var);
627
 
  bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
628
 
  SHOW_TYPE show_type() { return SHOW_LONGLONG; }
629
 
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
630
 
};
631
 
 
632
 
 
633
 
class sys_var_insert_id :public sys_var
634
 
{
635
 
public:
636
 
  sys_var_insert_id(sys_var_chain *chain, const char *name_arg)
637
 
    :sys_var(name_arg)
638
 
  { chain_sys_var(chain); }
639
 
  bool update(THD *thd, set_var *var);
640
 
  bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
641
 
  SHOW_TYPE show_type() { return SHOW_LONGLONG; }
642
 
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
643
 
};
644
 
 
645
 
 
646
 
class sys_var_rand_seed1 :public sys_var
647
 
{
648
 
public:
649
 
  sys_var_rand_seed1(sys_var_chain *chain, const char *name_arg,
650
 
                     Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG)
651
 
    :sys_var(name_arg, NULL, binlog_status_arg)
652
 
  { chain_sys_var(chain); }
653
 
  bool update(THD *thd, set_var *var);
654
 
  bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
655
 
};
656
 
 
657
 
class sys_var_rand_seed2 :public sys_var
658
 
{
659
 
public:
660
 
  sys_var_rand_seed2(sys_var_chain *chain, const char *name_arg,
661
 
                     Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG)
662
 
    :sys_var(name_arg, NULL, binlog_status_arg)
663
 
  { chain_sys_var(chain); }
664
 
  bool update(THD *thd, set_var *var);
665
 
  bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
666
 
};
667
 
 
668
 
 
669
 
class sys_var_collation :public sys_var_thd
 
676
  bool update(Session *session, set_var *var);
 
677
  bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
 
678
  SHOW_TYPE show_type() { return SHOW_LONGLONG; }
 
679
  unsigned char *value_ptr(Session *session, enum_var_type type,
 
680
                           const LEX_STRING *base);
 
681
};
 
682
 
 
683
 
 
684
class sys_var_collation :public sys_var_session
670
685
{
671
686
public:
672
687
  sys_var_collation(const char *name_arg,
673
688
                    Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG)
674
 
    :sys_var_thd(name_arg, NULL, binlog_status_arg)
675
 
  {
676
 
    no_support_one_shot= 0;
677
 
  }
678
 
  bool check(THD *thd, set_var *var);
679
 
  SHOW_TYPE show_type() { return SHOW_CHAR; }
680
 
  bool check_update_type(Item_result type)
681
 
  {
682
 
    return ((type != STRING_RESULT) && (type != INT_RESULT));
683
 
  }
684
 
  bool check_default(enum_var_type type __attribute__((unused))) { return 0; }
685
 
  virtual void set_default(THD *thd, enum_var_type type)= 0;
686
 
};
687
 
 
688
 
class sys_var_character_set :public sys_var_thd
689
 
{
690
 
public:
691
 
  bool nullable;
692
 
  sys_var_character_set(const char *name_arg, bool is_nullable= 0,
693
 
                        Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG)
694
 
    :sys_var_thd(name_arg, NULL, binlog_status_arg), nullable(is_nullable)
695
 
  {
696
 
    /*
697
 
      In fact only almost all variables derived from sys_var_character_set
698
 
      support ONE_SHOT; character_set_results doesn't. But that's good enough.
699
 
    */
700
 
    no_support_one_shot= 0;
701
 
  }
702
 
  bool check(THD *thd, set_var *var);
703
 
  SHOW_TYPE show_type() { return SHOW_CHAR; }
704
 
  bool check_update_type(Item_result type)
705
 
  {
706
 
    return ((type != STRING_RESULT) && (type != INT_RESULT));
707
 
  }
708
 
  bool check_default(enum_var_type type __attribute__((unused)))
709
 
  { return 0; }
710
 
  bool update(THD *thd, set_var *var);
711
 
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
712
 
  virtual void set_default(THD *thd, enum_var_type type)= 0;
713
 
  virtual const CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type)= 0;
714
 
};
715
 
 
716
 
class sys_var_character_set_sv :public sys_var_character_set
717
 
{
718
 
  const CHARSET_INFO *SV::*offset;
719
 
  const CHARSET_INFO **global_default;
720
 
public:
721
 
  sys_var_character_set_sv(sys_var_chain *chain, const char *name_arg,
722
 
                           const CHARSET_INFO *SV::*offset_arg,
723
 
                           const CHARSET_INFO **global_default_arg,
724
 
                           bool is_nullable= 0,
725
 
                           Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG)
726
 
    : sys_var_character_set(name_arg, is_nullable, binlog_status_arg),
727
 
    offset(offset_arg), global_default(global_default_arg)
728
 
  { chain_sys_var(chain); }
729
 
  void set_default(THD *thd, enum_var_type type);
730
 
  const CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type);
731
 
};
732
 
 
733
 
 
734
 
class sys_var_character_set_client: public sys_var_character_set_sv
735
 
{
736
 
public:
737
 
  sys_var_character_set_client(sys_var_chain *chain, const char *name_arg,
738
 
                               const CHARSET_INFO *SV::*offset_arg,
739
 
                               const CHARSET_INFO **global_default_arg,
740
 
                               Binlog_status_enum binlog_status_arg)
741
 
    : sys_var_character_set_sv(chain, name_arg, offset_arg, global_default_arg,
742
 
                               0, binlog_status_arg)
 
689
    :sys_var_session(name_arg, NULL, binlog_status_arg)
743
690
  { }
744
 
  bool check(THD *thd, set_var *var);
745
 
};
746
 
 
747
 
 
748
 
class sys_var_character_set_database :public sys_var_character_set
749
 
{
750
 
public:
751
 
  sys_var_character_set_database(sys_var_chain *chain, const char *name_arg,
752
 
                                 Binlog_status_enum binlog_status_arg=
753
 
                                   NOT_IN_BINLOG)
754
 
    : sys_var_character_set(name_arg, 0, binlog_status_arg)
755
 
  { chain_sys_var(chain); }
756
 
  void set_default(THD *thd, enum_var_type type);
757
 
  const CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type);
 
691
  bool check(Session *session, set_var *var);
 
692
  SHOW_TYPE show_type() { return SHOW_CHAR; }
 
693
  bool check_update_type(Item_result type)
 
694
  {
 
695
    return ((type != STRING_RESULT) && (type != INT_RESULT));
 
696
  }
 
697
  bool check_default(enum_var_type) { return 0; }
 
698
  virtual void set_default(Session *session, enum_var_type type)= 0;
758
699
};
759
700
 
760
701
class sys_var_collation_sv :public sys_var_collation
771
712
  {
772
713
    chain_sys_var(chain);
773
714
  }
774
 
  bool update(THD *thd, set_var *var);
775
 
  void set_default(THD *thd, enum_var_type type);
776
 
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
715
  bool update(Session *session, set_var *var);
 
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);
777
719
};
778
720
 
779
721
 
782
724
protected:
783
725
  size_t offset;
784
726
public:
785
 
  sys_var_key_cache_param(sys_var_chain *chain, const char *name_arg, 
 
727
  sys_var_key_cache_param(sys_var_chain *chain, const char *name_arg,
786
728
                          size_t offset_arg)
787
729
    :sys_var(name_arg), offset(offset_arg)
788
730
  { chain_sys_var(chain); }
789
 
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
790
 
  bool check_default(enum_var_type type __attribute__((unused)))
 
731
  unsigned char *value_ptr(Session *session, enum_var_type type,
 
732
                           const LEX_STRING *base);
 
733
  bool check_default(enum_var_type)
791
734
  { return 1; }
792
735
  bool is_struct() { return 1; }
793
736
};
800
743
    :sys_var_key_cache_param(chain, name_arg,
801
744
                             offsetof(KEY_CACHE, param_buff_size))
802
745
  {}
803
 
  bool update(THD *thd, set_var *var);
 
746
  bool update(Session *session, set_var *var);
804
747
  SHOW_TYPE show_type() { return SHOW_LONGLONG; }
805
748
};
806
749
 
807
750
 
808
 
class sys_var_key_cache_long :public sys_var_key_cache_param
 
751
class sys_var_key_cache_uint32_t :public sys_var_key_cache_param
809
752
{
810
753
public:
811
 
  sys_var_key_cache_long(sys_var_chain *chain, const char *name_arg, size_t offset_arg)
 
754
  sys_var_key_cache_uint32_t(sys_var_chain *chain, const char *name_arg, size_t offset_arg)
812
755
    :sys_var_key_cache_param(chain, name_arg, offset_arg)
813
756
  {}
814
 
  bool update(THD *thd, set_var *var);
815
 
  SHOW_TYPE show_type() { return SHOW_LONG; }
816
 
};
817
 
 
818
 
 
819
 
class sys_var_thd_date_time_format :public sys_var_thd
820
 
{
821
 
  DATE_TIME_FORMAT *SV::*offset;
822
 
  timestamp_type date_time_type;
823
 
public:
824
 
  sys_var_thd_date_time_format(sys_var_chain *chain, const char *name_arg,
825
 
                               DATE_TIME_FORMAT *SV::*offset_arg,
826
 
                               timestamp_type date_time_type_arg)
827
 
    :sys_var_thd(name_arg), offset(offset_arg),
828
 
    date_time_type(date_time_type_arg)
829
 
  { chain_sys_var(chain); }
830
 
  SHOW_TYPE show_type() { return SHOW_CHAR; }
831
 
  bool check_update_type(Item_result type)
832
 
  {
833
 
    return type != STRING_RESULT;               /* Only accept strings */
834
 
  }
835
 
  bool check_default(enum_var_type type __attribute__((unused)))
836
 
  { return 0; }
837
 
  bool check(THD *thd, set_var *var);
838
 
  bool update(THD *thd, set_var *var);
839
 
  void update2(THD *thd, enum_var_type type, DATE_TIME_FORMAT *new_value);
840
 
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
841
 
  void set_default(THD *thd, enum_var_type type);
842
 
};
843
 
 
844
 
 
845
 
class sys_var_log_state :public sys_var_bool_ptr
846
 
{
847
 
  uint log_type;
848
 
public:
849
 
  sys_var_log_state(sys_var_chain *chain, const char *name_arg, bool *value_arg, 
850
 
                    uint log_type_arg)
851
 
    :sys_var_bool_ptr(chain, name_arg, value_arg), log_type(log_type_arg) {}
852
 
  bool update(THD *thd, set_var *var);
853
 
  void set_default(THD *thd, enum_var_type type);
854
 
};
855
 
 
856
 
 
857
 
class sys_var_set :public sys_var
858
 
{
859
 
protected:
860
 
  ulong *value;
861
 
  TYPELIB *enum_names;
862
 
public:
863
 
  sys_var_set(sys_var_chain *chain, const char *name_arg, ulong *value_arg,
864
 
              TYPELIB *typelib, sys_after_update_func func)
865
 
    :sys_var(name_arg, func), value(value_arg), enum_names(typelib)
866
 
  { chain_sys_var(chain); }
867
 
  virtual bool check(THD *thd, set_var *var)
868
 
  {
869
 
    return check_set(thd, var, enum_names);
870
 
  }
871
 
  virtual void set_default(THD *thd __attribute__((unused)),
872
 
                           enum_var_type type __attribute__((unused)))
873
 
  {
874
 
    *value= 0;
875
 
  }
876
 
  bool update(THD *thd, set_var *var);
877
 
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
878
 
  bool check_update_type(Item_result type __attribute__((unused)))
879
 
  { return 0; }
880
 
  SHOW_TYPE show_type() { return SHOW_CHAR; }
881
 
};
882
 
 
883
 
class sys_var_set_slave_mode :public sys_var_set
884
 
{
885
 
public:
886
 
  sys_var_set_slave_mode(sys_var_chain *chain, const char *name_arg,
887
 
                         ulong *value_arg,
888
 
                         TYPELIB *typelib, sys_after_update_func func) :
889
 
    sys_var_set(chain, name_arg, value_arg, typelib, func) {}
890
 
  void set_default(THD *thd, enum_var_type type);
891
 
  bool check(THD *thd, set_var *var);
892
 
  bool update(THD *thd, set_var *var);
893
 
};
894
 
 
895
 
class sys_var_log_output :public sys_var
896
 
{
897
 
  ulong *value;
898
 
  TYPELIB *enum_names;
899
 
public:
900
 
  sys_var_log_output(sys_var_chain *chain, const char *name_arg, ulong *value_arg,
901
 
                     TYPELIB *typelib, sys_after_update_func func)
902
 
    :sys_var(name_arg,func), value(value_arg), enum_names(typelib)
903
 
  {
904
 
    chain_sys_var(chain);
905
 
    set_allow_empty_value(false);
906
 
  }
907
 
  virtual bool check(THD *thd, set_var *var)
908
 
  {
909
 
    return check_set(thd, var, enum_names);
910
 
  }
911
 
  bool update(THD *thd, set_var *var);
912
 
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
913
 
  bool check_update_type(Item_result type __attribute__((unused)))
914
 
  { return 0; }
915
 
  void set_default(THD *thd, enum_var_type type);
916
 
  SHOW_TYPE show_type() { return SHOW_CHAR; }
917
 
};
918
 
 
 
757
  bool update(Session *session, set_var *var);
 
758
  SHOW_TYPE show_type() { return SHOW_INT; }
 
759
};
919
760
 
920
761
/* Variable that you can only read from */
921
762
 
928
769
  sys_var_readonly(sys_var_chain *chain, const char *name_arg, enum_var_type type,
929
770
                   SHOW_TYPE show_type_arg,
930
771
                   sys_value_ptr_func value_ptr_func_arg)
931
 
    :sys_var(name_arg), var_type(type), 
 
772
    :sys_var(name_arg), var_type(type),
932
773
       show_type_value(show_type_arg), value_ptr_func(value_ptr_func_arg)
933
774
  { chain_sys_var(chain); }
934
 
  bool update(THD *thd __attribute__((unused)),
935
 
              set_var *var __attribute__((unused)))
 
775
  bool update(Session *, set_var *)
936
776
  { return 1; }
937
 
  bool check_default(enum_var_type type __attribute__((unused)))
 
777
  bool check_default(enum_var_type)
938
778
  { return 1; }
939
779
  bool check_type(enum_var_type type) { return type != var_type; }
940
 
  bool check_update_type(Item_result type __attribute__((unused)))
 
780
  bool check_update_type(Item_result)
941
781
  { return 1; }
942
 
  uchar *value_ptr(THD *thd, enum_var_type type __attribute__((unused)),
943
 
                   LEX_STRING *base __attribute__((unused)))
 
782
  unsigned char *value_ptr(Session *session, enum_var_type,
 
783
                           const LEX_STRING *)
944
784
  {
945
 
    return (*value_ptr_func)(thd);
 
785
    return (*value_ptr_func)(session);
946
786
  }
947
787
  SHOW_TYPE show_type(void) { return show_type_value; }
948
788
  bool is_readonly(void) const { return 1; }
957
797
  sys_var_have_option(sys_var_chain *chain, const char *variable_name):
958
798
    sys_var(variable_name)
959
799
  { chain_sys_var(chain); }
960
 
  uchar *value_ptr(THD *thd __attribute__((unused)),
961
 
                   enum_var_type type __attribute__((unused)),
962
 
                   LEX_STRING *base __attribute__((unused)))
 
800
  unsigned char *value_ptr(Session *, enum_var_type,
 
801
                           const LEX_STRING *)
963
802
  {
964
 
    return (uchar*) show_comp_option_name[get_option()];
 
803
    return (unsigned char*) show_comp_option_name[get_option()];
965
804
  }
966
 
  bool update(THD *thd __attribute__((unused)),
967
 
              set_var *var __attribute__((unused))) { return 1; }
968
 
  bool check_default(enum_var_type type __attribute__((unused)))
 
805
  bool update(Session *, set_var *) { return 1; }
 
806
  bool check_default(enum_var_type)
969
807
  { return 1; }
970
808
  bool check_type(enum_var_type type) { return type != OPT_GLOBAL; }
971
 
  bool check_update_type(Item_result type __attribute__((unused)))
 
809
  bool check_update_type(Item_result)
972
810
  { return 1; }
973
811
  SHOW_TYPE show_type() { return SHOW_CHAR; }
974
812
  bool is_readonly() const { return 1; }
992
830
class sys_var_have_plugin: public sys_var_have_option
993
831
{
994
832
  const char *plugin_name_str;
995
 
  const uint plugin_name_len;
 
833
  const uint32_t plugin_name_len;
996
834
  const int plugin_type;
997
835
 
998
836
public:
999
837
  sys_var_have_plugin(sys_var_chain *chain, const char *variable_name,
1000
 
                      const char *plugin_name_str_arg, uint plugin_name_len_arg, 
 
838
                      const char *plugin_name_str_arg, uint32_t plugin_name_len_arg,
1001
839
                      int plugin_type_arg):
1002
 
    sys_var_have_option(chain, variable_name), 
 
840
    sys_var_have_option(chain, variable_name),
1003
841
    plugin_name_str(plugin_name_str_arg), plugin_name_len(plugin_name_len_arg),
1004
842
    plugin_type(plugin_type_arg)
1005
843
  { }
1008
846
};
1009
847
 
1010
848
 
1011
 
class sys_var_thd_time_zone :public sys_var_thd
 
849
class sys_var_session_time_zone :public sys_var_session
1012
850
{
1013
851
public:
1014
 
  sys_var_thd_time_zone(sys_var_chain *chain, const char *name_arg,
 
852
  sys_var_session_time_zone(sys_var_chain *chain, const char *name_arg,
1015
853
                        Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG)
1016
 
    :sys_var_thd(name_arg, NULL, binlog_status_arg)
 
854
    :sys_var_session(name_arg, NULL, binlog_status_arg)
1017
855
  {
1018
 
    no_support_one_shot= 0;
1019
856
    chain_sys_var(chain);
1020
857
  }
1021
 
  bool check(THD *thd, set_var *var);
 
858
  bool check(Session *session, set_var *var);
1022
859
  SHOW_TYPE show_type() { return SHOW_CHAR; }
1023
860
  bool check_update_type(Item_result type)
1024
861
  {
1025
862
    return type != STRING_RESULT;               /* Only accept strings */
1026
863
  }
1027
 
  bool check_default(enum_var_type type __attribute__((unused)))
 
864
  bool check_default(enum_var_type)
1028
865
  { return 0; }
1029
 
  bool update(THD *thd, set_var *var);
1030
 
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
1031
 
  virtual void set_default(THD *thd, enum_var_type type);
1032
 
};
1033
 
 
1034
 
 
1035
 
class sys_var_max_user_conn : public sys_var_thd
1036
 
{
1037
 
public:
1038
 
  sys_var_max_user_conn(sys_var_chain *chain, const char *name_arg):
1039
 
    sys_var_thd(name_arg)
1040
 
  { chain_sys_var(chain); }
1041
 
  bool check(THD *thd, set_var *var);
1042
 
  bool update(THD *thd, set_var *var);
1043
 
  bool check_default(enum_var_type type)
1044
 
  {
1045
 
    return type != OPT_GLOBAL || !option_limits;
1046
 
  }
1047
 
  void set_default(THD *thd, enum_var_type type);
1048
 
  SHOW_TYPE show_type() { return SHOW_INT; }
1049
 
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
1050
 
};
1051
 
 
1052
 
 
1053
 
class sys_var_microseconds :public sys_var_thd
 
866
  bool update(Session *session, set_var *var);
 
867
  unsigned char *value_ptr(Session *session, enum_var_type type,
 
868
                           const LEX_STRING *base);
 
869
  virtual void set_default(Session *session, enum_var_type type);
 
870
};
 
871
 
 
872
 
 
873
class sys_var_microseconds :public sys_var_session
1054
874
{
1055
875
  uint64_t SV::*offset;
1056
876
public:
1057
877
  sys_var_microseconds(sys_var_chain *chain, const char *name_arg,
1058
878
                       uint64_t SV::*offset_arg):
1059
 
    sys_var_thd(name_arg), offset(offset_arg)
 
879
    sys_var_session(name_arg), offset(offset_arg)
1060
880
  { chain_sys_var(chain); }
1061
 
  bool check(THD *thd __attribute__((unused)),
1062
 
             set_var *var __attribute__((unused))) {return 0;}
1063
 
  bool update(THD *thd, set_var *var);
1064
 
  void set_default(THD *thd, enum_var_type type);
 
881
  bool check(Session *, set_var *) {return 0;}
 
882
  bool update(Session *session, set_var *var);
 
883
  void set_default(Session *session, enum_var_type type);
1065
884
  SHOW_TYPE show_type() { return SHOW_DOUBLE; }
1066
885
  bool check_update_type(Item_result type)
1067
886
  {
1068
887
    return (type != INT_RESULT && type != REAL_RESULT && type != DECIMAL_RESULT);
1069
888
  }
1070
 
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
1071
 
};
1072
 
 
1073
 
/**
1074
 
  Handler for setting the system variable --read-only.
1075
 
*/
1076
 
 
1077
 
class sys_var_opt_readonly :public sys_var_bool_ptr
1078
 
{
1079
 
public:
1080
 
  sys_var_opt_readonly(sys_var_chain *chain, const char *name_arg, 
1081
 
                       bool *value_arg) :
1082
 
    sys_var_bool_ptr(chain, name_arg, value_arg) {};
1083
 
  ~sys_var_opt_readonly() {};
1084
 
  bool update(THD *thd, set_var *var);
1085
 
};
1086
 
 
1087
 
 
1088
 
class sys_var_thd_lc_time_names :public sys_var_thd
1089
 
{
1090
 
public:
1091
 
  sys_var_thd_lc_time_names(sys_var_chain *chain, const char *name_arg,
 
889
  unsigned char *value_ptr(Session *session, enum_var_type type,
 
890
                           const LEX_STRING *base);
 
891
};
 
892
 
 
893
class sys_var_session_lc_time_names :public sys_var_session
 
894
{
 
895
public:
 
896
  sys_var_session_lc_time_names(sys_var_chain *chain, const char *name_arg,
1092
897
                            Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG)
1093
 
    : sys_var_thd(name_arg, NULL, binlog_status_arg)
 
898
    : sys_var_session(name_arg, NULL, binlog_status_arg)
1094
899
  {
1095
 
#if DRIZZLE_VERSION_ID < 50000
1096
 
    no_support_one_shot= 0;
1097
 
#endif
1098
900
    chain_sys_var(chain);
1099
901
  }
1100
 
  bool check(THD *thd, set_var *var);
 
902
  bool check(Session *session, set_var *var);
1101
903
  SHOW_TYPE show_type() { return SHOW_CHAR; }
1102
904
  bool check_update_type(Item_result type)
1103
905
  {
1104
906
    return ((type != STRING_RESULT) && (type != INT_RESULT));
1105
907
  }
1106
 
  bool check_default(enum_var_type type __attribute__((unused)))
 
908
  bool check_default(enum_var_type)
1107
909
  { return 0; }
1108
 
  bool update(THD *thd, set_var *var);
1109
 
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
1110
 
  virtual void set_default(THD *thd, enum_var_type type);
1111
 
};
1112
 
 
1113
 
 
1114
 
extern void fix_binlog_format_after_update(THD *thd, enum_var_type type);
1115
 
 
1116
 
class sys_var_thd_binlog_format :public sys_var_thd_enum
1117
 
{
1118
 
public:
1119
 
  sys_var_thd_binlog_format(sys_var_chain *chain, const char *name_arg, 
1120
 
                            ulong SV::*offset_arg)
1121
 
    :sys_var_thd_enum(chain, name_arg, offset_arg,
1122
 
                      &binlog_format_typelib,
1123
 
                      fix_binlog_format_after_update)
1124
 
  {};
1125
 
  bool is_readonly() const;
1126
 
};
 
910
  bool update(Session *session, set_var *var);
 
911
  unsigned char *value_ptr(Session *session, enum_var_type type,
 
912
                           const LEX_STRING *base);
 
913
  virtual void set_default(Session *session, enum_var_type type);
 
914
};
 
915
 
1127
916
 
1128
917
/****************************************************************************
1129
918
  Classes for parsing of the SET command
1134
923
public:
1135
924
  set_var_base() {}
1136
925
  virtual ~set_var_base() {}
1137
 
  virtual int check(THD *thd)=0;        /* To check privileges etc. */
1138
 
  virtual int update(THD *thd)=0;       /* To set the value */
 
926
  virtual int check(Session *session)=0;        /* To check privileges etc. */
 
927
  virtual int update(Session *session)=0;       /* To set the value */
1139
928
  /* light check for PS */
1140
 
  virtual bool no_support_one_shot() { return 1; }
1141
929
};
1142
930
 
1143
931
 
1152
940
  union
1153
941
  {
1154
942
    const CHARSET_INFO *charset;
1155
 
    ulong ulong_value;
 
943
    uint32_t uint32_t_value;
1156
944
    uint64_t uint64_t_value;
1157
 
    plugin_ref plugin;
1158
 
    DATE_TIME_FORMAT *date_time_format;
 
945
    size_t size_t_value;
 
946
    StorageEngine *storage_engine;
1159
947
    Time_zone *time_zone;
1160
948
    MY_LOCALE *locale_value;
1161
949
  } save_result;
1172
960
    if (value_arg && value_arg->type() == Item::FIELD_ITEM)
1173
961
    {
1174
962
      Item_field *item= (Item_field*) value_arg;
1175
 
      if (!(value=new Item_string(item->field_name, 
1176
 
                  (uint) strlen(item->field_name),
 
963
      if (!(value=new Item_string(item->field_name,
 
964
                  (uint32_t) strlen(item->field_name),
1177
965
                                  item->collation.collation)))
1178
966
        value=value_arg;                        /* Give error message later */
1179
967
    }
1180
968
    else
1181
969
      value=value_arg;
1182
970
  }
1183
 
  int check(THD *thd);
1184
 
  int update(THD *thd);
1185
 
  bool no_support_one_shot() { return var->no_support_one_shot; }
 
971
  int check(Session *session);
 
972
  int update(Session *session);
1186
973
};
1187
974
 
1188
975
 
1195
982
  set_var_user(Item_func_set_user_var *item)
1196
983
    :user_var_item(item)
1197
984
  {}
1198
 
  int check(THD *thd);
1199
 
  int update(THD *thd);
1200
 
};
1201
 
 
1202
 
/* For SET NAMES and SET CHARACTER SET */
1203
 
 
1204
 
class set_var_collation_client: public set_var_base
1205
 
{
1206
 
  const CHARSET_INFO *character_set_client;
1207
 
  const CHARSET_INFO *character_set_results;
1208
 
  const CHARSET_INFO *collation_connection;
1209
 
public:
1210
 
  set_var_collation_client(const CHARSET_INFO * const client_coll_arg,
1211
 
                           const CHARSET_INFO * const connection_coll_arg,
1212
 
                           const CHARSET_INFO * const result_coll_arg)
1213
 
    :character_set_client(client_coll_arg),
1214
 
     character_set_results(result_coll_arg),
1215
 
     collation_connection(connection_coll_arg)
1216
 
  {}
1217
 
  int check(THD *thd);
1218
 
  int update(THD *thd);
 
985
  int check(Session *session);
 
986
  int update(Session *session);
1219
987
};
1220
988
 
1221
989
 
1228
996
 
1229
997
class NAMED_LIST :public ilink
1230
998
{
1231
 
  const char *name;
1232
 
  uint name_length;
 
999
  std::string name;
1233
1000
public:
1234
 
  uchar* data;
 
1001
  unsigned char* data;
1235
1002
 
1236
1003
  NAMED_LIST(I_List<NAMED_LIST> *links, const char *name_arg,
1237
 
             uint name_length_arg, uchar* data_arg)
1238
 
    :name_length(name_length_arg), data(data_arg)
1239
 
  {
1240
 
    name= my_strndup(name_arg, name_length, MYF(MY_WME));
1241
 
    links->push_back(this);
1242
 
  }
1243
 
  inline bool cmp(const char *name_cmp, uint length)
1244
 
  {
1245
 
    return length == name_length && !memcmp(name, name_cmp, length);
1246
 
  }
1247
 
  ~NAMED_LIST()
1248
 
  {
1249
 
    my_free((uchar*) name, MYF(0));
1250
 
  }
 
1004
                   uint32_t name_length_arg, unsigned char* data_arg);
 
1005
  bool cmp(const char *name_cmp, uint32_t length);
1251
1006
  friend bool process_key_caches(process_key_cache_t func);
1252
1007
  friend void delete_elements(I_List<NAMED_LIST> *list,
1253
 
                              void (*free_element)(const char*, uchar*));
 
1008
                              void (*free_element)(const char*,
 
1009
                                                   unsigned char*));
1254
1010
};
1255
1011
 
1256
1012
/* updated in sql_acl.cc */
1257
1013
 
1258
 
extern sys_var_thd_bool sys_old_alter_table;
 
1014
extern sys_var_session_bool sys_old_alter_table;
1259
1015
extern LEX_STRING default_key_cache_base;
1260
1016
 
1261
1017
/* For sql_yacc */
1271
1027
 
1272
1028
int set_var_init();
1273
1029
void set_var_free();
1274
 
int mysql_append_static_vars(const SHOW_VAR *show_vars, uint count);
1275
 
SHOW_VAR* enumerate_sys_vars(THD *thd, bool sorted);
 
1030
int mysql_append_static_vars(const SHOW_VAR *show_vars, uint32_t count);
 
1031
SHOW_VAR* enumerate_sys_vars(Session *session, bool sorted);
1276
1032
int mysql_add_sys_var_chain(sys_var *chain, struct my_option *long_options);
1277
1033
int mysql_del_sys_var_chain(sys_var *chain);
1278
 
sys_var *find_sys_var(THD *thd, const char *str, uint length=0);
1279
 
int sql_set_variables(THD *thd, List<set_var_base> *var_list);
 
1034
sys_var *find_sys_var(Session *session, const char *str, uint32_t length=0);
 
1035
int sql_set_variables(Session *session, List<set_var_base> *var_list);
1280
1036
bool not_all_support_one_shot(List<set_var_base> *var_list);
1281
 
void fix_delay_key_write(THD *thd, enum_var_type type);
 
1037
void fix_delay_key_write(Session *session, enum_var_type type);
1282
1038
void fix_slave_exec_mode(enum_var_type type);
1283
 
extern sys_var_const_str sys_charset_system;
1284
 
extern sys_var_str sys_init_connect;
1285
 
extern sys_var_str sys_init_slave;
1286
 
extern sys_var_thd_time_zone sys_time_zone;
1287
 
extern sys_var_thd_bit sys_autocommit;
 
1039
extern sys_var_session_time_zone sys_time_zone;
 
1040
extern sys_var_session_bit sys_autocommit;
1288
1041
const CHARSET_INFO *get_old_charset_by_name(const char *old_name);
1289
 
uchar* find_named(I_List<NAMED_LIST> *list, const char *name, uint length,
 
1042
unsigned char* find_named(I_List<NAMED_LIST> *list, const char *name, uint32_t length,
1290
1043
                NAMED_LIST **found);
1291
1044
 
1292
1045
extern sys_var_str sys_var_general_log_path, sys_var_slow_log_path;
1293
1046
 
1294
1047
/* key_cache functions */
1295
 
KEY_CACHE *get_key_cache(LEX_STRING *cache_name);
1296
 
KEY_CACHE *get_or_create_key_cache(const char *name, uint length);
 
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);
1297
1050
void free_key_cache(const char *name, KEY_CACHE *key_cache);
1298
1051
bool process_key_caches(process_key_cache_t func);
1299
1052
void delete_elements(I_List<NAMED_LIST> *list,
1300
 
                     void (*free_element)(const char*, uchar*));
 
1053
                     void (*free_element)(const char*, unsigned char*));
 
1054
 
 
1055
#endif /* DRIZZLED_ITEM_SET_H */