~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to sql/set_var.h

Removed DBUG symbols and fixed TRUE/FALSE

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
 */
 
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 */
19
15
 
20
16
/* Classes to support the SET command */
21
17
 
 
18
#ifdef USE_PRAGMA_INTERFACE
 
19
#pragma interface                       /* gcc class implementation */
 
20
#endif
22
21
 
23
22
/****************************************************************************
24
23
  Variables that are changable runtime are declared using the
38
37
typedef bool (*sys_update_func)(THD *, set_var *);
39
38
typedef void (*sys_after_update_func)(THD *,enum_var_type);
40
39
typedef void (*sys_set_default_func)(THD *, enum_var_type);
41
 
typedef unsigned char *(*sys_value_ptr_func)(THD *thd);
 
40
typedef uchar *(*sys_value_ptr_func)(THD *thd);
42
41
 
43
42
struct sys_var_chain
44
43
{
67
66
 
68
67
  sys_var *next;
69
68
  struct my_option *option_limits;      /* Updated by by set_var_init() */
70
 
  uint32_t name_length;                 /* Updated by by set_var_init() */
 
69
  uint name_length;                     /* Updated by by set_var_init() */
71
70
  const char *name;
72
71
 
73
72
  sys_after_update_func after_update;
76
75
          Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG)
77
76
    :name(name_arg), after_update(func), no_support_one_shot(1),
78
77
    binlog_status(binlog_status_arg),
79
 
    m_allow_empty_value(true)
 
78
    m_allow_empty_value(TRUE)
80
79
  {}
81
80
  virtual ~sys_var() {}
82
81
  void chain_sys_var(sys_var_chain *chain_arg)
96
95
      (binlog_status == SESSION_VARIABLE_IN_BINLOG);
97
96
  }
98
97
  virtual bool update(THD *thd, set_var *var)=0;
99
 
  virtual void set_default(THD *thd_arg __attribute__((unused)),
100
 
                           enum_var_type type __attribute__((unused)))
 
98
  virtual void set_default(THD *thd_arg __attribute__((__unused__)),
 
99
                           enum_var_type type __attribute__((__unused__)))
101
100
  {}
102
101
  virtual SHOW_TYPE show_type() { return SHOW_UNDEF; }
103
 
  virtual unsigned char *value_ptr(THD *thd __attribute__((unused)),
104
 
                           enum_var_type type __attribute__((unused)),
105
 
                           LEX_STRING *base __attribute__((unused)))
 
102
  virtual uchar *value_ptr(THD *thd __attribute__((__unused__)),
 
103
                           enum_var_type type __attribute__((__unused__)),
 
104
                           LEX_STRING *base __attribute__((__unused__)))
106
105
  { return 0; }
107
106
  virtual bool check_type(enum_var_type type)
108
107
  { return type != OPT_GLOBAL; }                /* Error if not GLOBAL */
109
108
  virtual bool check_update_type(Item_result type)
110
109
  { return type != INT_RESULT; }                /* Assume INT */
111
 
  virtual bool check_default(enum_var_type type __attribute__((unused)))
 
110
  virtual bool check_default(enum_var_type type __attribute__((__unused__)))
112
111
  { return option_limits == 0; }
113
112
  Item *item(THD *thd, enum_var_type type, LEX_STRING *base);
114
113
  virtual bool is_struct() { return 0; }
164
163
  bool update(THD *thd, set_var *var);
165
164
  void set_default(THD *thd, enum_var_type type);
166
165
  SHOW_TYPE show_type() { return SHOW_LONG; }
167
 
  unsigned char *value_ptr(THD *thd __attribute__((unused)),
168
 
                   enum_var_type type __attribute__((unused)),
169
 
                   LEX_STRING *base __attribute__((unused)))
170
 
  { return (unsigned char*) value; }
 
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; }
171
170
};
172
171
 
173
172
 
183
182
};
184
183
 
185
184
 
186
 
class sys_var_uint64_t_ptr :public sys_var
 
185
class sys_var_ulonglong_ptr :public sys_var
187
186
{
188
 
  uint64_t *value;
 
187
  ulonglong *value;
189
188
public:
190
 
  sys_var_uint64_t_ptr(sys_var_chain *chain, const char *name_arg, uint64_t *value_ptr_arg)
 
189
  sys_var_ulonglong_ptr(sys_var_chain *chain, const char *name_arg, ulonglong *value_ptr_arg)
191
190
    :sys_var(name_arg),value(value_ptr_arg)
192
191
  { chain_sys_var(chain); }
193
 
  sys_var_uint64_t_ptr(sys_var_chain *chain, const char *name_arg, uint64_t *value_ptr_arg,
 
192
  sys_var_ulonglong_ptr(sys_var_chain *chain, const char *name_arg, ulonglong *value_ptr_arg,
194
193
                       sys_after_update_func func)
195
194
    :sys_var(name_arg,func), value(value_ptr_arg)
196
195
  { chain_sys_var(chain); }
197
196
  bool update(THD *thd, set_var *var);
198
197
  void set_default(THD *thd, enum_var_type type);
199
198
  SHOW_TYPE show_type() { return SHOW_LONGLONG; }
200
 
  unsigned char *value_ptr(THD *thd __attribute__((unused)),
201
 
                   enum_var_type type __attribute__((unused)),
202
 
                   LEX_STRING *base __attribute__((unused)))
203
 
  { return (unsigned char*) value; }
 
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; }
204
203
};
205
204
 
206
205
 
207
206
class sys_var_bool_ptr :public sys_var
208
207
{
209
208
public:
210
 
  bool *value;
211
 
  sys_var_bool_ptr(sys_var_chain *chain, const char *name_arg, bool *value_arg)
 
209
  my_bool *value;
 
210
  sys_var_bool_ptr(sys_var_chain *chain, const char *name_arg, my_bool *value_arg)
212
211
    :sys_var(name_arg),value(value_arg)
213
212
  { chain_sys_var(chain); }
214
213
  bool check(THD *thd, set_var *var)
218
217
  bool update(THD *thd, set_var *var);
219
218
  void set_default(THD *thd, enum_var_type type);
220
219
  SHOW_TYPE show_type() { return SHOW_MY_BOOL; }
221
 
  unsigned char *value_ptr(THD *thd __attribute__((unused)),
222
 
                   enum_var_type type __attribute__((unused)),
223
 
                   LEX_STRING *base __attribute__((unused)))
224
 
  { return (unsigned char*) value; }
225
 
  bool check_update_type(Item_result type __attribute__((unused)))
 
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__)))
226
225
  { return 0; }
227
226
};
228
227
 
 
228
 
229
229
class sys_var_bool_ptr_readonly :public sys_var_bool_ptr
230
230
{
231
231
public:
232
232
  sys_var_bool_ptr_readonly(sys_var_chain *chain, const char *name_arg,
233
 
                            bool *value_arg)
 
233
                            my_bool *value_arg)
234
234
    :sys_var_bool_ptr(chain, name_arg, value_arg)
235
235
  {}
236
236
  bool is_readonly() const { return 1; }
241
241
{
242
242
public:
243
243
  char *value;                                  // Pointer to allocated string
244
 
  uint32_t value_length;
 
244
  uint value_length;
245
245
  sys_check_func check_func;
246
246
  sys_update_func update_func;
247
247
  sys_set_default_func set_default_func;
263
263
    (*set_default_func)(thd, type);
264
264
  }
265
265
  SHOW_TYPE show_type() { return SHOW_CHAR; }
266
 
  unsigned char *value_ptr(THD *thd __attribute__((unused)),
267
 
                   enum_var_type type __attribute__((unused)),
268
 
                   LEX_STRING *base __attribute__((unused)))
269
 
  { return (unsigned char*) value; }
 
266
  uchar *value_ptr(THD *thd __attribute__((__unused__)),
 
267
                   enum_var_type type __attribute__((__unused__)),
 
268
                   LEX_STRING *base __attribute__((__unused__)))
 
269
  { return (uchar*) value; }
270
270
  bool check_update_type(Item_result type)
271
271
  {
272
272
    return type != STRING_RESULT;               /* Only accept strings */
273
273
  }
274
 
  bool check_default(enum_var_type type __attribute__((unused)))
 
274
  bool check_default(enum_var_type type __attribute__((__unused__)))
275
275
  { return 0; }
276
276
};
277
277
 
288
288
  {
289
289
    value= new_value;
290
290
  }
291
 
  bool check(THD *thd __attribute__((unused)),
292
 
             set_var *var __attribute__((unused)))
 
291
  bool check(THD *thd __attribute__((__unused__)),
 
292
             set_var *var __attribute__((__unused__)))
293
293
  {
294
294
    return 1;
295
295
  }
296
 
  bool update(THD *thd __attribute__((unused)),
297
 
              set_var *var __attribute__((unused)))
 
296
  bool update(THD *thd __attribute__((__unused__)),
 
297
              set_var *var __attribute__((__unused__)))
298
298
  {
299
299
    return 1;
300
300
  }
301
301
  SHOW_TYPE show_type() { return SHOW_CHAR; }
302
 
  unsigned char *value_ptr(THD *thd __attribute__((unused)),
303
 
                   enum_var_type type __attribute__((unused)),
304
 
                   LEX_STRING *base __attribute__((unused)))
 
302
  uchar *value_ptr(THD *thd __attribute__((__unused__)),
 
303
                   enum_var_type type __attribute__((__unused__)),
 
304
                   LEX_STRING *base __attribute__((__unused__)))
305
305
  {
306
 
    return (unsigned char*) value;
 
306
    return (uchar*) value;
307
307
  }
308
 
  bool check_update_type(Item_result type __attribute__((unused)))
 
308
  bool check_update_type(Item_result type __attribute__((__unused__)))
309
309
  {
310
310
    return 1;
311
311
  }
312
 
  bool check_default(enum_var_type type __attribute__((unused)))
 
312
  bool check_default(enum_var_type type __attribute__((__unused__)))
313
313
  { return 1; }
314
314
  bool is_readonly() const { return 1; }
315
315
};
322
322
  sys_var_const_str_ptr(sys_var_chain *chain, const char *name_arg, char **value_arg)
323
323
    :sys_var(name_arg),value(value_arg)
324
324
  { chain_sys_var(chain); }
325
 
  bool check(THD *thd __attribute__((unused)),
326
 
             set_var *var __attribute__((unused)))
 
325
  bool check(THD *thd __attribute__((__unused__)),
 
326
             set_var *var __attribute__((__unused__)))
327
327
  {
328
328
    return 1;
329
329
  }
330
 
  bool update(THD *thd __attribute__((unused)),
331
 
              set_var *var __attribute__((unused)))
 
330
  bool update(THD *thd __attribute__((__unused__)),
 
331
              set_var *var __attribute__((__unused__)))
332
332
  {
333
333
    return 1;
334
334
  }
335
335
  SHOW_TYPE show_type() { return SHOW_CHAR; }
336
 
  unsigned char *value_ptr(THD *thd __attribute__((unused)),
337
 
                   enum_var_type type __attribute__((unused)),
338
 
                   LEX_STRING *base __attribute__((unused)))
 
336
  uchar *value_ptr(THD *thd __attribute__((__unused__)),
 
337
                   enum_var_type type __attribute__((__unused__)),
 
338
                   LEX_STRING *base __attribute__((__unused__)))
339
339
  {
340
 
    return (unsigned char*) *value;
 
340
    return (uchar*) *value;
341
341
  }
342
 
  bool check_update_type(Item_result type __attribute__((unused)))
 
342
  bool check_update_type(Item_result type __attribute__((__unused__)))
343
343
  {
344
344
    return 1;
345
345
  }
346
 
  bool check_default(enum_var_type type __attribute__((unused)))
 
346
  bool check_default(enum_var_type type __attribute__((__unused__)))
347
347
  { return 1; }
348
348
  bool is_readonly(void) const { return 1; }
349
349
};
351
351
 
352
352
class sys_var_enum :public sys_var
353
353
{
354
 
  uint32_t *value;
 
354
  uint *value;
355
355
  TYPELIB *enum_names;
356
356
public:
357
 
  sys_var_enum(sys_var_chain *chain, const char *name_arg, uint32_t *value_arg,
 
357
  sys_var_enum(sys_var_chain *chain, const char *name_arg, uint *value_arg,
358
358
               TYPELIB *typelib, sys_after_update_func func)
359
359
    :sys_var(name_arg,func), value(value_arg), enum_names(typelib)
360
360
  { chain_sys_var(chain); }
364
364
  }
365
365
  bool update(THD *thd, set_var *var);
366
366
  SHOW_TYPE show_type() { return SHOW_CHAR; }
367
 
  unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
368
 
  bool check_update_type(Item_result type __attribute__((unused)))
 
367
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
368
  bool check_update_type(Item_result type __attribute__((__unused__)))
369
369
  { return 0; }
370
370
};
371
371
 
379
379
      TYPELIB *typelib, sys_after_update_func func)
380
380
    :sys_var(name_arg,func), offset(offset_arg), enum_names(typelib)
381
381
  { chain_sys_var(chain); }
382
 
  bool check(THD *thd __attribute__((unused)),
383
 
             set_var *var __attribute__((unused)))
 
382
  bool check(THD *thd __attribute__((__unused__)),
 
383
             set_var *var __attribute__((__unused__)))
384
384
  { return 1; }
385
 
  bool update(THD *thd __attribute__((unused)),
386
 
              set_var *var __attribute__((unused)))
 
385
  bool update(THD *thd __attribute__((__unused__)),
 
386
              set_var *var __attribute__((__unused__)))
387
387
  { return 1; }
388
388
  SHOW_TYPE show_type() { return SHOW_CHAR; }
389
 
  bool check_update_type(Item_result type __attribute__((unused)))
 
389
  bool check_update_type(Item_result type __attribute__((__unused__)))
390
390
  { return 1; }
391
391
  bool is_readonly() const { return 1; }
392
 
  unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
392
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
393
393
};
394
394
 
395
395
 
401
401
              Binlog_status_enum binlog_status= NOT_IN_BINLOG)
402
402
    :sys_var(name_arg, func, binlog_status)
403
403
  {}
404
 
  bool check_type(enum_var_type type __attribute__((unused)))
 
404
  bool check_type(enum_var_type type __attribute__((__unused__)))
405
405
  { return 0; }
406
406
  bool check_default(enum_var_type type)
407
407
  {
427
427
  bool update(THD *thd, set_var *var);
428
428
  void set_default(THD *thd, enum_var_type type);
429
429
  SHOW_TYPE show_type() { return SHOW_LONG; }
430
 
  unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
430
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
431
431
};
432
432
 
433
433
 
447
447
  bool update(THD *thd, set_var *var);
448
448
  void set_default(THD *thd, enum_var_type type);
449
449
  SHOW_TYPE show_type() { return SHOW_HA_ROWS; }
450
 
  unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
450
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
451
451
};
452
452
 
453
453
 
454
 
class sys_var_thd_uint64_t :public sys_var_thd
 
454
class sys_var_thd_ulonglong :public sys_var_thd
455
455
{
456
456
public:
457
 
  uint64_t SV::*offset;
 
457
  ulonglong SV::*offset;
458
458
  bool only_global;
459
 
  sys_var_thd_uint64_t(sys_var_chain *chain, const char *name_arg, 
460
 
                        uint64_t SV::*offset_arg)
 
459
  sys_var_thd_ulonglong(sys_var_chain *chain, const char *name_arg, 
 
460
                        ulonglong SV::*offset_arg)
461
461
    :sys_var_thd(name_arg), offset(offset_arg)
462
462
  { chain_sys_var(chain); }
463
 
  sys_var_thd_uint64_t(sys_var_chain *chain, const char *name_arg, 
464
 
                        uint64_t SV::*offset_arg,
 
463
  sys_var_thd_ulonglong(sys_var_chain *chain, const char *name_arg, 
 
464
                        ulonglong SV::*offset_arg,
465
465
                        sys_after_update_func func, bool only_global_arg)
466
466
    :sys_var_thd(name_arg, func), offset(offset_arg),
467
467
    only_global(only_global_arg)
469
469
  bool update(THD *thd, set_var *var);
470
470
  void set_default(THD *thd, enum_var_type type);
471
471
  SHOW_TYPE show_type() { return SHOW_LONGLONG; }
472
 
  unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
472
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
473
473
  bool check(THD *thd, set_var *var);
474
474
  bool check_default(enum_var_type type)
475
475
  {
485
485
class sys_var_thd_bool :public sys_var_thd
486
486
{
487
487
public:
488
 
  bool SV::*offset;
489
 
  sys_var_thd_bool(sys_var_chain *chain, const char *name_arg, bool SV::*offset_arg)
 
488
  my_bool SV::*offset;
 
489
  sys_var_thd_bool(sys_var_chain *chain, const char *name_arg, my_bool SV::*offset_arg)
490
490
    :sys_var_thd(name_arg), offset(offset_arg)
491
491
  { chain_sys_var(chain); }
492
 
  sys_var_thd_bool(sys_var_chain *chain, const char *name_arg, bool SV::*offset_arg,
 
492
  sys_var_thd_bool(sys_var_chain *chain, const char *name_arg, my_bool SV::*offset_arg,
493
493
                   sys_after_update_func func)
494
494
    :sys_var_thd(name_arg,func), offset(offset_arg)
495
495
  { chain_sys_var(chain); }
496
496
  bool update(THD *thd, set_var *var);
497
497
  void set_default(THD *thd, enum_var_type type);
498
498
  SHOW_TYPE show_type() { return SHOW_MY_BOOL; }
499
 
  unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
499
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
500
500
  bool check(THD *thd, set_var *var)
501
501
  {
502
502
    return check_enum(thd, var, &bool_typelib);
503
503
  }
504
 
  bool check_update_type(Item_result type __attribute__((unused)))
 
504
  bool check_update_type(Item_result type __attribute__((__unused__)))
505
505
  { return 0; }
506
506
};
507
507
 
530
530
  bool update(THD *thd, set_var *var);
531
531
  void set_default(THD *thd, enum_var_type type);
532
532
  SHOW_TYPE show_type() { return SHOW_CHAR; }
533
 
  unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
534
 
  bool check_update_type(Item_result type __attribute__((unused)))
 
533
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
534
  bool check_update_type(Item_result type __attribute__((__unused__)))
535
535
  { return 0; }
536
536
};
537
537
 
549
549
    return check_set(thd, var, enum_names);
550
550
  }
551
551
  void set_default(THD *thd, enum_var_type type);
552
 
  unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
553
 
  static bool symbolic_mode_representation(THD *thd, uint64_t sql_mode,
 
552
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
553
  static bool symbolic_mode_representation(THD *thd, ulonglong sql_mode,
554
554
                                           LEX_STRING *rep);
555
555
};
556
556
 
572
572
  }
573
573
  void set_default(THD *thd, enum_var_type type);
574
574
  bool update(THD *thd, set_var *var);
575
 
  unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
575
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
576
576
};
577
577
 
578
578
class sys_var_thd_bit :public sys_var_thd
580
580
  sys_check_func check_func;
581
581
  sys_update_func update_func;
582
582
public:
583
 
  uint64_t bit_flag;
 
583
  ulonglong bit_flag;
584
584
  bool reverse;
585
585
  sys_var_thd_bit(sys_var_chain *chain, const char *name_arg,
586
586
                  sys_check_func c_func, sys_update_func u_func,
587
 
                  uint64_t bit, bool reverse_arg=0,
 
587
                  ulonglong bit, bool reverse_arg=0,
588
588
                  Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG)
589
589
    :sys_var_thd(name_arg, NULL, binlog_status_arg), check_func(c_func),
590
590
    update_func(u_func), bit_flag(bit), reverse(reverse_arg)
591
591
  { chain_sys_var(chain); }
592
592
  bool check(THD *thd, set_var *var);
593
593
  bool update(THD *thd, set_var *var);
594
 
  bool check_update_type(Item_result type __attribute__((unused)))
 
594
  bool check_update_type(Item_result type __attribute__((__unused__)))
595
595
  { return 0; }
596
596
  bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
597
597
  SHOW_TYPE show_type() { return SHOW_MY_BOOL; }
598
 
  unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
599
 
};
 
598
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
599
};
 
600
 
 
601
class sys_var_thd_dbug :public sys_var_thd
 
602
{
 
603
public:
 
604
  sys_var_thd_dbug(sys_var_chain *chain, const char *name_arg)
 
605
    :sys_var_thd(name_arg)
 
606
  { chain_sys_var(chain); }
 
607
  bool check_update_type(Item_result type) { return type != STRING_RESULT; }
 
608
  SHOW_TYPE show_type() { return SHOW_CHAR; }
 
609
  bool update(THD *thd, set_var *var);
 
610
  void set_default(THD *thd __attribute__((__unused__)),
 
611
                   enum_var_type type __attribute__((__unused__)))
 
612
  { DBUG_POP(); }
 
613
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *b);
 
614
};
 
615
 
 
616
 
600
617
 
601
618
/* some variables that require special handling */
602
619
 
610
627
  bool update(THD *thd, set_var *var);
611
628
  void set_default(THD *thd, enum_var_type type);
612
629
  bool check_type(enum_var_type type)    { return type == OPT_GLOBAL; }
613
 
  bool check_default(enum_var_type type __attribute__((unused)))
 
630
  bool check_default(enum_var_type type __attribute__((__unused__)))
614
631
  { return 0; }
615
632
  SHOW_TYPE show_type(void) { return SHOW_LONG; }
616
 
  unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
633
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
617
634
};
618
635
 
619
636
 
627
644
  bool update(THD *thd, set_var *var);
628
645
  bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
629
646
  SHOW_TYPE show_type() { return SHOW_LONGLONG; }
630
 
  unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
647
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
631
648
};
632
649
 
633
650
 
640
657
  bool update(THD *thd, set_var *var);
641
658
  bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
642
659
  SHOW_TYPE show_type() { return SHOW_LONGLONG; }
643
 
  unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
660
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
644
661
};
645
662
 
646
663
 
682
699
  {
683
700
    return ((type != STRING_RESULT) && (type != INT_RESULT));
684
701
  }
685
 
  bool check_default(enum_var_type type __attribute__((unused))) { return 0; }
 
702
  bool check_default(enum_var_type type __attribute__((__unused__))) { return 0; }
686
703
  virtual void set_default(THD *thd, enum_var_type type)= 0;
687
704
};
688
705
 
706
723
  {
707
724
    return ((type != STRING_RESULT) && (type != INT_RESULT));
708
725
  }
709
 
  bool check_default(enum_var_type type __attribute__((unused)))
 
726
  bool check_default(enum_var_type type __attribute__((__unused__)))
710
727
  { return 0; }
711
728
  bool update(THD *thd, set_var *var);
712
 
  unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
729
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
713
730
  virtual void set_default(THD *thd, enum_var_type type)= 0;
714
 
  virtual const CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type)= 0;
 
731
  virtual CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type)= 0;
 
732
};
 
733
 
 
734
class sys_var_character_set_sv :public sys_var_character_set
 
735
{
 
736
  CHARSET_INFO *SV::*offset;
 
737
  CHARSET_INFO **global_default;
 
738
public:
 
739
  sys_var_character_set_sv(sys_var_chain *chain, const char *name_arg,
 
740
                           CHARSET_INFO *SV::*offset_arg,
 
741
                           CHARSET_INFO **global_default_arg,
 
742
                           bool is_nullable= 0,
 
743
                           Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG)
 
744
    : sys_var_character_set(name_arg, is_nullable, binlog_status_arg),
 
745
    offset(offset_arg), global_default(global_default_arg)
 
746
  { chain_sys_var(chain); }
 
747
  void set_default(THD *thd, enum_var_type type);
 
748
  CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type);
 
749
};
 
750
 
 
751
 
 
752
class sys_var_character_set_client: public sys_var_character_set_sv
 
753
{
 
754
public:
 
755
  sys_var_character_set_client(sys_var_chain *chain, const char *name_arg,
 
756
                               CHARSET_INFO *SV::*offset_arg,
 
757
                               CHARSET_INFO **global_default_arg,
 
758
                               Binlog_status_enum binlog_status_arg)
 
759
    : sys_var_character_set_sv(chain, name_arg, offset_arg, global_default_arg,
 
760
                               0, binlog_status_arg)
 
761
  { }
 
762
  bool check(THD *thd, set_var *var);
 
763
};
 
764
 
 
765
 
 
766
class sys_var_character_set_database :public sys_var_character_set
 
767
{
 
768
public:
 
769
  sys_var_character_set_database(sys_var_chain *chain, const char *name_arg,
 
770
                                 Binlog_status_enum binlog_status_arg=
 
771
                                   NOT_IN_BINLOG)
 
772
    : sys_var_character_set(name_arg, 0, binlog_status_arg)
 
773
  { chain_sys_var(chain); }
 
774
  void set_default(THD *thd, enum_var_type type);
 
775
  CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type);
715
776
};
716
777
 
717
778
class sys_var_collation_sv :public sys_var_collation
718
779
{
719
 
  const CHARSET_INFO *SV::*offset;
720
 
  const CHARSET_INFO **global_default;
 
780
  CHARSET_INFO *SV::*offset;
 
781
  CHARSET_INFO **global_default;
721
782
public:
722
783
  sys_var_collation_sv(sys_var_chain *chain, const char *name_arg,
723
 
                       const CHARSET_INFO *SV::*offset_arg,
724
 
                       const CHARSET_INFO **global_default_arg,
 
784
                       CHARSET_INFO *SV::*offset_arg,
 
785
                       CHARSET_INFO **global_default_arg,
725
786
                       Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG)
726
787
    :sys_var_collation(name_arg, binlog_status_arg),
727
788
    offset(offset_arg), global_default(global_default_arg)
730
791
  }
731
792
  bool update(THD *thd, set_var *var);
732
793
  void set_default(THD *thd, enum_var_type type);
733
 
  unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
794
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
734
795
};
735
796
 
736
797
 
743
804
                          size_t offset_arg)
744
805
    :sys_var(name_arg), offset(offset_arg)
745
806
  { chain_sys_var(chain); }
746
 
  unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
747
 
  bool check_default(enum_var_type type __attribute__((unused)))
 
807
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
808
  bool check_default(enum_var_type type __attribute__((__unused__)))
748
809
  { return 1; }
749
810
  bool is_struct() { return 1; }
750
811
};
776
837
class sys_var_thd_date_time_format :public sys_var_thd
777
838
{
778
839
  DATE_TIME_FORMAT *SV::*offset;
779
 
  enum enum_drizzle_timestamp_type date_time_type;
 
840
  timestamp_type date_time_type;
780
841
public:
781
842
  sys_var_thd_date_time_format(sys_var_chain *chain, const char *name_arg,
782
843
                               DATE_TIME_FORMAT *SV::*offset_arg,
783
 
                               enum enum_drizzle_timestamp_type date_time_type_arg)
 
844
                               timestamp_type date_time_type_arg)
784
845
    :sys_var_thd(name_arg), offset(offset_arg),
785
846
    date_time_type(date_time_type_arg)
786
847
  { chain_sys_var(chain); }
789
850
  {
790
851
    return type != STRING_RESULT;               /* Only accept strings */
791
852
  }
792
 
  bool check_default(enum_var_type type __attribute__((unused)))
 
853
  bool check_default(enum_var_type type __attribute__((__unused__)))
793
854
  { return 0; }
794
855
  bool check(THD *thd, set_var *var);
795
856
  bool update(THD *thd, set_var *var);
796
857
  void update2(THD *thd, enum_var_type type, DATE_TIME_FORMAT *new_value);
797
 
  unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
858
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
798
859
  void set_default(THD *thd, enum_var_type type);
799
860
};
800
861
 
801
862
 
802
863
class sys_var_log_state :public sys_var_bool_ptr
803
864
{
804
 
  uint32_t log_type;
 
865
  uint log_type;
805
866
public:
806
 
  sys_var_log_state(sys_var_chain *chain, const char *name_arg, bool *value_arg, 
807
 
                    uint32_t log_type_arg)
 
867
  sys_var_log_state(sys_var_chain *chain, const char *name_arg, my_bool *value_arg, 
 
868
                    uint log_type_arg)
808
869
    :sys_var_bool_ptr(chain, name_arg, value_arg), log_type(log_type_arg) {}
809
870
  bool update(THD *thd, set_var *var);
810
871
  void set_default(THD *thd, enum_var_type type);
825
886
  {
826
887
    return check_set(thd, var, enum_names);
827
888
  }
828
 
  virtual void set_default(THD *thd __attribute__((unused)),
829
 
                           enum_var_type type __attribute__((unused)))
 
889
  virtual void set_default(THD *thd __attribute__((__unused__)),
 
890
                           enum_var_type type __attribute__((__unused__)))
830
891
  {
831
892
    *value= 0;
832
893
  }
833
894
  bool update(THD *thd, set_var *var);
834
 
  unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
835
 
  bool check_update_type(Item_result type __attribute__((unused)))
 
895
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
896
  bool check_update_type(Item_result type __attribute__((__unused__)))
836
897
  { return 0; }
837
898
  SHOW_TYPE show_type() { return SHOW_CHAR; }
838
899
};
859
920
    :sys_var(name_arg,func), value(value_arg), enum_names(typelib)
860
921
  {
861
922
    chain_sys_var(chain);
862
 
    set_allow_empty_value(false);
 
923
    set_allow_empty_value(FALSE);
863
924
  }
864
925
  virtual bool check(THD *thd, set_var *var)
865
926
  {
866
927
    return check_set(thd, var, enum_names);
867
928
  }
868
929
  bool update(THD *thd, set_var *var);
869
 
  unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
870
 
  bool check_update_type(Item_result type __attribute__((unused)))
 
930
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
931
  bool check_update_type(Item_result type __attribute__((__unused__)))
871
932
  { return 0; }
872
933
  void set_default(THD *thd, enum_var_type type);
873
934
  SHOW_TYPE show_type() { return SHOW_CHAR; }
888
949
    :sys_var(name_arg), var_type(type), 
889
950
       show_type_value(show_type_arg), value_ptr_func(value_ptr_func_arg)
890
951
  { chain_sys_var(chain); }
891
 
  bool update(THD *thd __attribute__((unused)),
892
 
              set_var *var __attribute__((unused)))
 
952
  bool update(THD *thd __attribute__((__unused__)),
 
953
              set_var *var __attribute__((__unused__)))
893
954
  { return 1; }
894
 
  bool check_default(enum_var_type type __attribute__((unused)))
 
955
  bool check_default(enum_var_type type __attribute__((__unused__)))
895
956
  { return 1; }
896
957
  bool check_type(enum_var_type type) { return type != var_type; }
897
 
  bool check_update_type(Item_result type __attribute__((unused)))
 
958
  bool check_update_type(Item_result type __attribute__((__unused__)))
898
959
  { return 1; }
899
 
  unsigned char *value_ptr(THD *thd, enum_var_type type __attribute__((unused)),
900
 
                   LEX_STRING *base __attribute__((unused)))
 
960
  uchar *value_ptr(THD *thd, enum_var_type type __attribute__((__unused__)),
 
961
                   LEX_STRING *base __attribute__((__unused__)))
901
962
  {
902
963
    return (*value_ptr_func)(thd);
903
964
  }
914
975
  sys_var_have_option(sys_var_chain *chain, const char *variable_name):
915
976
    sys_var(variable_name)
916
977
  { chain_sys_var(chain); }
917
 
  unsigned char *value_ptr(THD *thd __attribute__((unused)),
918
 
                   enum_var_type type __attribute__((unused)),
919
 
                   LEX_STRING *base __attribute__((unused)))
 
978
  uchar *value_ptr(THD *thd __attribute__((__unused__)),
 
979
                   enum_var_type type __attribute__((__unused__)),
 
980
                   LEX_STRING *base __attribute__((__unused__)))
920
981
  {
921
 
    return (unsigned char*) show_comp_option_name[get_option()];
 
982
    return (uchar*) show_comp_option_name[get_option()];
922
983
  }
923
 
  bool update(THD *thd __attribute__((unused)),
924
 
              set_var *var __attribute__((unused))) { return 1; }
925
 
  bool check_default(enum_var_type type __attribute__((unused)))
 
984
  bool update(THD *thd __attribute__((__unused__)),
 
985
              set_var *var __attribute__((__unused__))) { return 1; }
 
986
  bool check_default(enum_var_type type __attribute__((__unused__)))
926
987
  { return 1; }
927
988
  bool check_type(enum_var_type type) { return type != OPT_GLOBAL; }
928
 
  bool check_update_type(Item_result type __attribute__((unused)))
 
989
  bool check_update_type(Item_result type __attribute__((__unused__)))
929
990
  { return 1; }
930
991
  SHOW_TYPE show_type() { return SHOW_CHAR; }
931
992
  bool is_readonly() const { return 1; }
949
1010
class sys_var_have_plugin: public sys_var_have_option
950
1011
{
951
1012
  const char *plugin_name_str;
952
 
  const uint32_t plugin_name_len;
 
1013
  const uint plugin_name_len;
953
1014
  const int plugin_type;
954
1015
 
955
1016
public:
956
1017
  sys_var_have_plugin(sys_var_chain *chain, const char *variable_name,
957
 
                      const char *plugin_name_str_arg, uint32_t plugin_name_len_arg, 
 
1018
                      const char *plugin_name_str_arg, uint plugin_name_len_arg, 
958
1019
                      int plugin_type_arg):
959
1020
    sys_var_have_option(chain, variable_name), 
960
1021
    plugin_name_str(plugin_name_str_arg), plugin_name_len(plugin_name_len_arg),
981
1042
  {
982
1043
    return type != STRING_RESULT;               /* Only accept strings */
983
1044
  }
984
 
  bool check_default(enum_var_type type __attribute__((unused)))
 
1045
  bool check_default(enum_var_type type __attribute__((__unused__)))
985
1046
  { return 0; }
986
1047
  bool update(THD *thd, set_var *var);
987
 
  unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
1048
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
988
1049
  virtual void set_default(THD *thd, enum_var_type type);
989
1050
};
990
1051
 
1003
1064
  }
1004
1065
  void set_default(THD *thd, enum_var_type type);
1005
1066
  SHOW_TYPE show_type() { return SHOW_INT; }
1006
 
  unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
1067
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
1007
1068
};
1008
1069
 
1009
1070
 
1010
1071
class sys_var_microseconds :public sys_var_thd
1011
1072
{
1012
 
  uint64_t SV::*offset;
 
1073
  ulonglong SV::*offset;
1013
1074
public:
1014
1075
  sys_var_microseconds(sys_var_chain *chain, const char *name_arg,
1015
 
                       uint64_t SV::*offset_arg):
 
1076
                       ulonglong SV::*offset_arg):
1016
1077
    sys_var_thd(name_arg), offset(offset_arg)
1017
1078
  { chain_sys_var(chain); }
1018
 
  bool check(THD *thd __attribute__((unused)),
1019
 
             set_var *var __attribute__((unused))) {return 0;}
 
1079
  bool check(THD *thd __attribute__((__unused__)),
 
1080
             set_var *var __attribute__((__unused__))) {return 0;}
1020
1081
  bool update(THD *thd, set_var *var);
1021
1082
  void set_default(THD *thd, enum_var_type type);
1022
1083
  SHOW_TYPE show_type() { return SHOW_DOUBLE; }
1024
1085
  {
1025
1086
    return (type != INT_RESULT && type != REAL_RESULT && type != DECIMAL_RESULT);
1026
1087
  }
1027
 
  unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
1088
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
1089
};
 
1090
 
 
1091
 
 
1092
class sys_var_trust_routine_creators :public sys_var_bool_ptr
 
1093
{
 
1094
  /* We need a derived class only to have a warn_deprecated() */
 
1095
public:
 
1096
  sys_var_trust_routine_creators(sys_var_chain *chain,
 
1097
                                 const char *name_arg, my_bool *value_arg) :
 
1098
    sys_var_bool_ptr(chain, name_arg, value_arg) {};
 
1099
  void warn_deprecated(THD *thd);
 
1100
  void set_default(THD *thd, enum_var_type type);
 
1101
  bool update(THD *thd, set_var *var);
1028
1102
};
1029
1103
 
1030
1104
/**
1035
1109
{
1036
1110
public:
1037
1111
  sys_var_opt_readonly(sys_var_chain *chain, const char *name_arg, 
1038
 
                       bool *value_arg) :
 
1112
                       my_bool *value_arg) :
1039
1113
    sys_var_bool_ptr(chain, name_arg, value_arg) {};
1040
1114
  ~sys_var_opt_readonly() {};
1041
1115
  bool update(THD *thd, set_var *var);
1049
1123
                            Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG)
1050
1124
    : sys_var_thd(name_arg, NULL, binlog_status_arg)
1051
1125
  {
1052
 
#if DRIZZLE_VERSION_ID < 50000
 
1126
#if MYSQL_VERSION_ID < 50000
1053
1127
    no_support_one_shot= 0;
1054
1128
#endif
1055
1129
    chain_sys_var(chain);
1060
1134
  {
1061
1135
    return ((type != STRING_RESULT) && (type != INT_RESULT));
1062
1136
  }
1063
 
  bool check_default(enum_var_type type __attribute__((unused)))
 
1137
  bool check_default(enum_var_type type __attribute__((__unused__)))
1064
1138
  { return 0; }
1065
1139
  bool update(THD *thd, set_var *var);
1066
 
  unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
1140
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
1067
1141
  virtual void set_default(THD *thd, enum_var_type type);
1068
1142
};
1069
1143
 
1098
1172
};
1099
1173
 
1100
1174
 
1101
 
/* MySQL internal variables */
 
1175
/* MySQL internal variables, like query_cache_size */
1102
1176
 
1103
1177
class set_var :public set_var_base
1104
1178
{
1108
1182
  enum_var_type type;
1109
1183
  union
1110
1184
  {
1111
 
    const CHARSET_INFO *charset;
 
1185
    CHARSET_INFO *charset;
1112
1186
    ulong ulong_value;
1113
 
    uint64_t uint64_t_value;
 
1187
    ulonglong ulonglong_value;
1114
1188
    plugin_ref plugin;
1115
1189
    DATE_TIME_FORMAT *date_time_format;
1116
1190
    Time_zone *time_zone;
1160
1234
 
1161
1235
class set_var_collation_client: public set_var_base
1162
1236
{
1163
 
  const CHARSET_INFO *character_set_client;
1164
 
  const CHARSET_INFO *character_set_results;
1165
 
  const CHARSET_INFO *collation_connection;
 
1237
  CHARSET_INFO *character_set_client;
 
1238
  CHARSET_INFO *character_set_results;
 
1239
  CHARSET_INFO *collation_connection;
1166
1240
public:
1167
 
  set_var_collation_client(const CHARSET_INFO * const client_coll_arg,
1168
 
                           const CHARSET_INFO * const connection_coll_arg,
1169
 
                           const CHARSET_INFO * const result_coll_arg)
 
1241
  set_var_collation_client(CHARSET_INFO *client_coll_arg,
 
1242
                           CHARSET_INFO *connection_coll_arg,
 
1243
                           CHARSET_INFO *result_coll_arg)
1170
1244
    :character_set_client(client_coll_arg),
1171
1245
     character_set_results(result_coll_arg),
1172
1246
     collation_connection(connection_coll_arg)
1186
1260
class NAMED_LIST :public ilink
1187
1261
{
1188
1262
  const char *name;
1189
 
  uint32_t name_length;
 
1263
  uint name_length;
1190
1264
public:
1191
 
  unsigned char* data;
 
1265
  uchar* data;
1192
1266
 
1193
1267
  NAMED_LIST(I_List<NAMED_LIST> *links, const char *name_arg,
1194
 
             uint32_t name_length_arg, unsigned char* data_arg)
 
1268
             uint name_length_arg, uchar* data_arg)
1195
1269
    :name_length(name_length_arg), data(data_arg)
1196
1270
  {
1197
1271
    name= my_strndup(name_arg, name_length, MYF(MY_WME));
1198
1272
    links->push_back(this);
1199
1273
  }
1200
 
  inline bool cmp(const char *name_cmp, uint32_t length)
 
1274
  inline bool cmp(const char *name_cmp, uint length)
1201
1275
  {
1202
1276
    return length == name_length && !memcmp(name, name_cmp, length);
1203
1277
  }
1204
1278
  ~NAMED_LIST()
1205
1279
  {
1206
 
    free((unsigned char*) name);
 
1280
    my_free((uchar*) name, MYF(0));
1207
1281
  }
1208
1282
  friend bool process_key_caches(process_key_cache_t func);
1209
1283
  friend void delete_elements(I_List<NAMED_LIST> *list,
1210
 
                              void (*free_element)(const char*, unsigned char*));
 
1284
                              void (*free_element)(const char*, uchar*));
1211
1285
};
1212
1286
 
1213
1287
/* updated in sql_acl.cc */
1214
1288
 
1215
1289
extern sys_var_thd_bool sys_old_alter_table;
 
1290
extern sys_var_thd_bool sys_old_passwords;
1216
1291
extern LEX_STRING default_key_cache_base;
1217
1292
 
1218
1293
/* For sql_yacc */
1228
1303
 
1229
1304
int set_var_init();
1230
1305
void set_var_free();
1231
 
int mysql_append_static_vars(const SHOW_VAR *show_vars, uint32_t count);
 
1306
int mysql_append_static_vars(const SHOW_VAR *show_vars, uint count);
1232
1307
SHOW_VAR* enumerate_sys_vars(THD *thd, bool sorted);
1233
1308
int mysql_add_sys_var_chain(sys_var *chain, struct my_option *long_options);
1234
1309
int mysql_del_sys_var_chain(sys_var *chain);
1235
 
sys_var *find_sys_var(THD *thd, const char *str, uint32_t length=0);
 
1310
sys_var *find_sys_var(THD *thd, const char *str, uint length=0);
1236
1311
int sql_set_variables(THD *thd, List<set_var_base> *var_list);
1237
1312
bool not_all_support_one_shot(List<set_var_base> *var_list);
1238
1313
void fix_delay_key_write(THD *thd, enum_var_type type);
1239
1314
void fix_slave_exec_mode(enum_var_type type);
 
1315
ulong fix_sql_mode(ulong sql_mode);
 
1316
extern sys_var_const_str sys_charset_system;
1240
1317
extern sys_var_str sys_init_connect;
1241
1318
extern sys_var_str sys_init_slave;
1242
1319
extern sys_var_thd_time_zone sys_time_zone;
1243
1320
extern sys_var_thd_bit sys_autocommit;
1244
 
const CHARSET_INFO *get_old_charset_by_name(const char *old_name);
1245
 
unsigned char* find_named(I_List<NAMED_LIST> *list, const char *name, uint32_t length,
 
1321
CHARSET_INFO *get_old_charset_by_name(const char *old_name);
 
1322
uchar* find_named(I_List<NAMED_LIST> *list, const char *name, uint length,
1246
1323
                NAMED_LIST **found);
1247
1324
 
1248
1325
extern sys_var_str sys_var_general_log_path, sys_var_slow_log_path;
1249
1326
 
1250
1327
/* key_cache functions */
1251
1328
KEY_CACHE *get_key_cache(LEX_STRING *cache_name);
1252
 
KEY_CACHE *get_or_create_key_cache(const char *name, uint32_t length);
 
1329
KEY_CACHE *get_or_create_key_cache(const char *name, uint length);
1253
1330
void free_key_cache(const char *name, KEY_CACHE *key_cache);
1254
1331
bool process_key_caches(process_key_cache_t func);
1255
1332
void delete_elements(I_List<NAMED_LIST> *list,
1256
 
                     void (*free_element)(const char*, unsigned char*));
 
1333
                     void (*free_element)(const char*, uchar*));