~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to sql/set_var.h

  • Committer: Monty Taylor
  • Date: 2008-07-01 14:33:36 UTC
  • mto: (28.1.12 backport_patch)
  • mto: This revision was merged to the branch mainline in revision 34.
  • Revision ID: monty@inaugust.com-20080701143336-8uihm7dhpu92rt0q
Somehow missed moving password.c. Duh.

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)))
101
 
  {}
 
98
  virtual void set_default(THD *thd_arg, enum_var_type type) {}
102
99
  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)))
 
100
  virtual uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
106
101
  { return 0; }
107
102
  virtual bool check_type(enum_var_type type)
108
103
  { return type != OPT_GLOBAL; }                /* Error if not GLOBAL */
109
104
  virtual bool check_update_type(Item_result type)
110
105
  { return type != INT_RESULT; }                /* Assume INT */
111
 
  virtual bool check_default(enum_var_type type __attribute__((unused)))
 
106
  virtual bool check_default(enum_var_type type)
112
107
  { return option_limits == 0; }
113
108
  Item *item(THD *thd, enum_var_type type, LEX_STRING *base);
114
109
  virtual bool is_struct() { return 0; }
164
159
  bool update(THD *thd, set_var *var);
165
160
  void set_default(THD *thd, enum_var_type type);
166
161
  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; }
 
162
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
 
163
  { return (uchar*) value; }
171
164
};
172
165
 
173
166
 
183
176
};
184
177
 
185
178
 
186
 
class sys_var_uint64_t_ptr :public sys_var
 
179
class sys_var_ulonglong_ptr :public sys_var
187
180
{
188
 
  uint64_t *value;
 
181
  ulonglong *value;
189
182
public:
190
 
  sys_var_uint64_t_ptr(sys_var_chain *chain, const char *name_arg, uint64_t *value_ptr_arg)
 
183
  sys_var_ulonglong_ptr(sys_var_chain *chain, const char *name_arg, ulonglong *value_ptr_arg)
191
184
    :sys_var(name_arg),value(value_ptr_arg)
192
185
  { chain_sys_var(chain); }
193
 
  sys_var_uint64_t_ptr(sys_var_chain *chain, const char *name_arg, uint64_t *value_ptr_arg,
 
186
  sys_var_ulonglong_ptr(sys_var_chain *chain, const char *name_arg, ulonglong *value_ptr_arg,
194
187
                       sys_after_update_func func)
195
188
    :sys_var(name_arg,func), value(value_ptr_arg)
196
189
  { chain_sys_var(chain); }
197
190
  bool update(THD *thd, set_var *var);
198
191
  void set_default(THD *thd, enum_var_type type);
199
192
  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; }
 
193
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
 
194
  { return (uchar*) value; }
204
195
};
205
196
 
206
197
 
207
198
class sys_var_bool_ptr :public sys_var
208
199
{
209
200
public:
210
 
  bool *value;
211
 
  sys_var_bool_ptr(sys_var_chain *chain, const char *name_arg, bool *value_arg)
 
201
  my_bool *value;
 
202
  sys_var_bool_ptr(sys_var_chain *chain, const char *name_arg, my_bool *value_arg)
212
203
    :sys_var(name_arg),value(value_arg)
213
204
  { chain_sys_var(chain); }
214
205
  bool check(THD *thd, set_var *var)
218
209
  bool update(THD *thd, set_var *var);
219
210
  void set_default(THD *thd, enum_var_type type);
220
211
  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)))
226
 
  { return 0; }
 
212
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
 
213
  { return (uchar*) value; }
 
214
  bool check_update_type(Item_result type) { return 0; }
227
215
};
228
216
 
 
217
 
229
218
class sys_var_bool_ptr_readonly :public sys_var_bool_ptr
230
219
{
231
220
public:
232
221
  sys_var_bool_ptr_readonly(sys_var_chain *chain, const char *name_arg,
233
 
                            bool *value_arg)
 
222
                            my_bool *value_arg)
234
223
    :sys_var_bool_ptr(chain, name_arg, value_arg)
235
224
  {}
236
225
  bool is_readonly() const { return 1; }
241
230
{
242
231
public:
243
232
  char *value;                                  // Pointer to allocated string
244
 
  uint32_t value_length;
 
233
  uint value_length;
245
234
  sys_check_func check_func;
246
235
  sys_update_func update_func;
247
236
  sys_set_default_func set_default_func;
263
252
    (*set_default_func)(thd, type);
264
253
  }
265
254
  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; }
 
255
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
 
256
  { return (uchar*) value; }
270
257
  bool check_update_type(Item_result type)
271
258
  {
272
259
    return type != STRING_RESULT;               /* Only accept strings */
273
260
  }
274
 
  bool check_default(enum_var_type type __attribute__((unused)))
275
 
  { return 0; }
 
261
  bool check_default(enum_var_type type) { return 0; }
276
262
};
277
263
 
278
264
 
288
274
  {
289
275
    value= new_value;
290
276
  }
291
 
  bool check(THD *thd __attribute__((unused)),
292
 
             set_var *var __attribute__((unused)))
 
277
  bool check(THD *thd, set_var *var)
293
278
  {
294
279
    return 1;
295
280
  }
296
 
  bool update(THD *thd __attribute__((unused)),
297
 
              set_var *var __attribute__((unused)))
 
281
  bool update(THD *thd, set_var *var)
298
282
  {
299
283
    return 1;
300
284
  }
301
285
  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)))
 
286
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
305
287
  {
306
 
    return (unsigned char*) value;
 
288
    return (uchar*) value;
307
289
  }
308
 
  bool check_update_type(Item_result type __attribute__((unused)))
 
290
  bool check_update_type(Item_result type)
309
291
  {
310
292
    return 1;
311
293
  }
312
 
  bool check_default(enum_var_type type __attribute__((unused)))
313
 
  { return 1; }
 
294
  bool check_default(enum_var_type type) { return 1; }
314
295
  bool is_readonly() const { return 1; }
315
296
};
316
297
 
322
303
  sys_var_const_str_ptr(sys_var_chain *chain, const char *name_arg, char **value_arg)
323
304
    :sys_var(name_arg),value(value_arg)
324
305
  { chain_sys_var(chain); }
325
 
  bool check(THD *thd __attribute__((unused)),
326
 
             set_var *var __attribute__((unused)))
 
306
  bool check(THD *thd, set_var *var)
327
307
  {
328
308
    return 1;
329
309
  }
330
 
  bool update(THD *thd __attribute__((unused)),
331
 
              set_var *var __attribute__((unused)))
 
310
  bool update(THD *thd, set_var *var)
332
311
  {
333
312
    return 1;
334
313
  }
335
314
  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)))
 
315
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
339
316
  {
340
 
    return (unsigned char*) *value;
 
317
    return (uchar*) *value;
341
318
  }
342
 
  bool check_update_type(Item_result type __attribute__((unused)))
 
319
  bool check_update_type(Item_result type)
343
320
  {
344
321
    return 1;
345
322
  }
346
 
  bool check_default(enum_var_type type __attribute__((unused)))
347
 
  { return 1; }
348
 
  bool is_readonly(void) const { return 1; }
 
323
  bool check_default(enum_var_type type) { return 1; }
 
324
  bool is_readonly() const { return 1; }
349
325
};
350
326
 
351
327
 
352
328
class sys_var_enum :public sys_var
353
329
{
354
 
  uint32_t *value;
 
330
  uint *value;
355
331
  TYPELIB *enum_names;
356
332
public:
357
 
  sys_var_enum(sys_var_chain *chain, const char *name_arg, uint32_t *value_arg,
 
333
  sys_var_enum(sys_var_chain *chain, const char *name_arg, uint *value_arg,
358
334
               TYPELIB *typelib, sys_after_update_func func)
359
335
    :sys_var(name_arg,func), value(value_arg), enum_names(typelib)
360
336
  { chain_sys_var(chain); }
364
340
  }
365
341
  bool update(THD *thd, set_var *var);
366
342
  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)))
369
 
  { return 0; }
 
343
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
344
  bool check_update_type(Item_result type) { return 0; }
370
345
};
371
346
 
372
347
 
379
354
      TYPELIB *typelib, sys_after_update_func func)
380
355
    :sys_var(name_arg,func), offset(offset_arg), enum_names(typelib)
381
356
  { chain_sys_var(chain); }
382
 
  bool check(THD *thd __attribute__((unused)),
383
 
             set_var *var __attribute__((unused)))
384
 
  { return 1; }
385
 
  bool update(THD *thd __attribute__((unused)),
386
 
              set_var *var __attribute__((unused)))
387
 
  { return 1; }
 
357
  bool check(THD *thd, set_var *var) { return 1; }
 
358
  bool update(THD *thd, set_var *var) { return 1; }
388
359
  SHOW_TYPE show_type() { return SHOW_CHAR; }
389
 
  bool check_update_type(Item_result type __attribute__((unused)))
390
 
  { return 1; }
 
360
  bool check_update_type(Item_result type) { return 1; }
391
361
  bool is_readonly() const { return 1; }
392
 
  unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
362
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
393
363
};
394
364
 
395
365
 
401
371
              Binlog_status_enum binlog_status= NOT_IN_BINLOG)
402
372
    :sys_var(name_arg, func, binlog_status)
403
373
  {}
404
 
  bool check_type(enum_var_type type __attribute__((unused)))
405
 
  { return 0; }
 
374
  bool check_type(enum_var_type type) { return 0; }
406
375
  bool check_default(enum_var_type type)
407
376
  {
408
377
    return type == OPT_GLOBAL && !option_limits;
427
396
  bool update(THD *thd, set_var *var);
428
397
  void set_default(THD *thd, enum_var_type type);
429
398
  SHOW_TYPE show_type() { return SHOW_LONG; }
430
 
  unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
399
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
431
400
};
432
401
 
433
402
 
447
416
  bool update(THD *thd, set_var *var);
448
417
  void set_default(THD *thd, enum_var_type type);
449
418
  SHOW_TYPE show_type() { return SHOW_HA_ROWS; }
450
 
  unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
419
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
451
420
};
452
421
 
453
422
 
454
 
class sys_var_thd_uint64_t :public sys_var_thd
 
423
class sys_var_thd_ulonglong :public sys_var_thd
455
424
{
456
425
public:
457
 
  uint64_t SV::*offset;
 
426
  ulonglong SV::*offset;
458
427
  bool only_global;
459
 
  sys_var_thd_uint64_t(sys_var_chain *chain, const char *name_arg, 
460
 
                        uint64_t SV::*offset_arg)
 
428
  sys_var_thd_ulonglong(sys_var_chain *chain, const char *name_arg, 
 
429
                        ulonglong SV::*offset_arg)
461
430
    :sys_var_thd(name_arg), offset(offset_arg)
462
431
  { chain_sys_var(chain); }
463
 
  sys_var_thd_uint64_t(sys_var_chain *chain, const char *name_arg, 
464
 
                        uint64_t SV::*offset_arg,
 
432
  sys_var_thd_ulonglong(sys_var_chain *chain, const char *name_arg, 
 
433
                        ulonglong SV::*offset_arg,
465
434
                        sys_after_update_func func, bool only_global_arg)
466
435
    :sys_var_thd(name_arg, func), offset(offset_arg),
467
436
    only_global(only_global_arg)
469
438
  bool update(THD *thd, set_var *var);
470
439
  void set_default(THD *thd, enum_var_type type);
471
440
  SHOW_TYPE show_type() { return SHOW_LONGLONG; }
472
 
  unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
441
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
473
442
  bool check(THD *thd, set_var *var);
474
443
  bool check_default(enum_var_type type)
475
444
  {
485
454
class sys_var_thd_bool :public sys_var_thd
486
455
{
487
456
public:
488
 
  bool SV::*offset;
489
 
  sys_var_thd_bool(sys_var_chain *chain, const char *name_arg, bool SV::*offset_arg)
 
457
  my_bool SV::*offset;
 
458
  sys_var_thd_bool(sys_var_chain *chain, const char *name_arg, my_bool SV::*offset_arg)
490
459
    :sys_var_thd(name_arg), offset(offset_arg)
491
460
  { chain_sys_var(chain); }
492
 
  sys_var_thd_bool(sys_var_chain *chain, const char *name_arg, bool SV::*offset_arg,
 
461
  sys_var_thd_bool(sys_var_chain *chain, const char *name_arg, my_bool SV::*offset_arg,
493
462
                   sys_after_update_func func)
494
463
    :sys_var_thd(name_arg,func), offset(offset_arg)
495
464
  { chain_sys_var(chain); }
496
465
  bool update(THD *thd, set_var *var);
497
466
  void set_default(THD *thd, enum_var_type type);
498
467
  SHOW_TYPE show_type() { return SHOW_MY_BOOL; }
499
 
  unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
468
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
500
469
  bool check(THD *thd, set_var *var)
501
470
  {
502
471
    return check_enum(thd, var, &bool_typelib);
503
472
  }
504
 
  bool check_update_type(Item_result type __attribute__((unused)))
505
 
  { return 0; }
 
473
  bool check_update_type(Item_result type) { return 0; }
506
474
};
507
475
 
508
476
 
530
498
  bool update(THD *thd, set_var *var);
531
499
  void set_default(THD *thd, enum_var_type type);
532
500
  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)))
535
 
  { return 0; }
 
501
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
502
  bool check_update_type(Item_result type) { return 0; }
536
503
};
537
504
 
538
505
 
549
516
    return check_set(thd, var, enum_names);
550
517
  }
551
518
  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,
 
519
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
520
  static bool symbolic_mode_representation(THD *thd, ulonglong sql_mode,
554
521
                                           LEX_STRING *rep);
555
522
};
556
523
 
572
539
  }
573
540
  void set_default(THD *thd, enum_var_type type);
574
541
  bool update(THD *thd, set_var *var);
575
 
  unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
542
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
576
543
};
577
544
 
578
545
class sys_var_thd_bit :public sys_var_thd
580
547
  sys_check_func check_func;
581
548
  sys_update_func update_func;
582
549
public:
583
 
  uint64_t bit_flag;
 
550
  ulonglong bit_flag;
584
551
  bool reverse;
585
552
  sys_var_thd_bit(sys_var_chain *chain, const char *name_arg,
586
553
                  sys_check_func c_func, sys_update_func u_func,
587
 
                  uint64_t bit, bool reverse_arg=0,
 
554
                  ulonglong bit, bool reverse_arg=0,
588
555
                  Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG)
589
556
    :sys_var_thd(name_arg, NULL, binlog_status_arg), check_func(c_func),
590
557
    update_func(u_func), bit_flag(bit), reverse(reverse_arg)
591
558
  { chain_sys_var(chain); }
592
559
  bool check(THD *thd, set_var *var);
593
560
  bool update(THD *thd, set_var *var);
594
 
  bool check_update_type(Item_result type __attribute__((unused)))
595
 
  { return 0; }
 
561
  bool check_update_type(Item_result type) { return 0; }
596
562
  bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
597
563
  SHOW_TYPE show_type() { return SHOW_MY_BOOL; }
598
 
  unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
599
 
};
 
564
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
565
};
 
566
 
 
567
class sys_var_thd_dbug :public sys_var_thd
 
568
{
 
569
public:
 
570
  sys_var_thd_dbug(sys_var_chain *chain, const char *name_arg)
 
571
    :sys_var_thd(name_arg)
 
572
  { chain_sys_var(chain); }
 
573
  bool check_update_type(Item_result type) { return type != STRING_RESULT; }
 
574
  SHOW_TYPE show_type() { return SHOW_CHAR; }
 
575
  bool update(THD *thd, set_var *var);
 
576
  void set_default(THD *thd, enum_var_type type) { DBUG_POP(); }
 
577
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *b);
 
578
};
 
579
 
 
580
 
600
581
 
601
582
/* some variables that require special handling */
602
583
 
610
591
  bool update(THD *thd, set_var *var);
611
592
  void set_default(THD *thd, enum_var_type type);
612
593
  bool check_type(enum_var_type type)    { return type == OPT_GLOBAL; }
613
 
  bool check_default(enum_var_type type __attribute__((unused)))
614
 
  { return 0; }
615
 
  SHOW_TYPE show_type(void) { return SHOW_LONG; }
616
 
  unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
594
  bool check_default(enum_var_type type) { return 0; }
 
595
  SHOW_TYPE show_type() { return SHOW_LONG; }
 
596
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
617
597
};
618
598
 
619
599
 
627
607
  bool update(THD *thd, set_var *var);
628
608
  bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
629
609
  SHOW_TYPE show_type() { return SHOW_LONGLONG; }
630
 
  unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
610
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
631
611
};
632
612
 
633
613
 
640
620
  bool update(THD *thd, set_var *var);
641
621
  bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
642
622
  SHOW_TYPE show_type() { return SHOW_LONGLONG; }
643
 
  unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
623
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
644
624
};
645
625
 
646
626
 
682
662
  {
683
663
    return ((type != STRING_RESULT) && (type != INT_RESULT));
684
664
  }
685
 
  bool check_default(enum_var_type type __attribute__((unused))) { return 0; }
 
665
  bool check_default(enum_var_type type) { return 0; }
686
666
  virtual void set_default(THD *thd, enum_var_type type)= 0;
687
667
};
688
668
 
706
686
  {
707
687
    return ((type != STRING_RESULT) && (type != INT_RESULT));
708
688
  }
709
 
  bool check_default(enum_var_type type __attribute__((unused)))
710
 
  { return 0; }
 
689
  bool check_default(enum_var_type type) { return 0; }
711
690
  bool update(THD *thd, set_var *var);
712
 
  unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
691
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
713
692
  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;
 
693
  virtual CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type)= 0;
 
694
};
 
695
 
 
696
class sys_var_character_set_sv :public sys_var_character_set
 
697
{
 
698
  CHARSET_INFO *SV::*offset;
 
699
  CHARSET_INFO **global_default;
 
700
public:
 
701
  sys_var_character_set_sv(sys_var_chain *chain, const char *name_arg,
 
702
                           CHARSET_INFO *SV::*offset_arg,
 
703
                           CHARSET_INFO **global_default_arg,
 
704
                           bool is_nullable= 0,
 
705
                           Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG)
 
706
    : sys_var_character_set(name_arg, is_nullable, binlog_status_arg),
 
707
    offset(offset_arg), global_default(global_default_arg)
 
708
  { chain_sys_var(chain); }
 
709
  void set_default(THD *thd, enum_var_type type);
 
710
  CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type);
 
711
};
 
712
 
 
713
 
 
714
class sys_var_character_set_client: public sys_var_character_set_sv
 
715
{
 
716
public:
 
717
  sys_var_character_set_client(sys_var_chain *chain, const char *name_arg,
 
718
                               CHARSET_INFO *SV::*offset_arg,
 
719
                               CHARSET_INFO **global_default_arg,
 
720
                               Binlog_status_enum binlog_status_arg)
 
721
    : sys_var_character_set_sv(chain, name_arg, offset_arg, global_default_arg,
 
722
                               0, binlog_status_arg)
 
723
  { }
 
724
  bool check(THD *thd, set_var *var);
 
725
};
 
726
 
 
727
 
 
728
class sys_var_character_set_database :public sys_var_character_set
 
729
{
 
730
public:
 
731
  sys_var_character_set_database(sys_var_chain *chain, const char *name_arg,
 
732
                                 Binlog_status_enum binlog_status_arg=
 
733
                                   NOT_IN_BINLOG)
 
734
    : sys_var_character_set(name_arg, 0, binlog_status_arg)
 
735
  { chain_sys_var(chain); }
 
736
  void set_default(THD *thd, enum_var_type type);
 
737
  CHARSET_INFO **ci_ptr(THD *thd, enum_var_type type);
715
738
};
716
739
 
717
740
class sys_var_collation_sv :public sys_var_collation
718
741
{
719
 
  const CHARSET_INFO *SV::*offset;
720
 
  const CHARSET_INFO **global_default;
 
742
  CHARSET_INFO *SV::*offset;
 
743
  CHARSET_INFO **global_default;
721
744
public:
722
745
  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,
 
746
                       CHARSET_INFO *SV::*offset_arg,
 
747
                       CHARSET_INFO **global_default_arg,
725
748
                       Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG)
726
749
    :sys_var_collation(name_arg, binlog_status_arg),
727
750
    offset(offset_arg), global_default(global_default_arg)
730
753
  }
731
754
  bool update(THD *thd, set_var *var);
732
755
  void set_default(THD *thd, enum_var_type type);
733
 
  unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
756
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
734
757
};
735
758
 
736
759
 
743
766
                          size_t offset_arg)
744
767
    :sys_var(name_arg), offset(offset_arg)
745
768
  { 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)))
748
 
  { return 1; }
 
769
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
770
  bool check_default(enum_var_type type) { return 1; }
749
771
  bool is_struct() { return 1; }
750
772
};
751
773
 
776
798
class sys_var_thd_date_time_format :public sys_var_thd
777
799
{
778
800
  DATE_TIME_FORMAT *SV::*offset;
779
 
  enum enum_drizzle_timestamp_type date_time_type;
 
801
  timestamp_type date_time_type;
780
802
public:
781
803
  sys_var_thd_date_time_format(sys_var_chain *chain, const char *name_arg,
782
804
                               DATE_TIME_FORMAT *SV::*offset_arg,
783
 
                               enum enum_drizzle_timestamp_type date_time_type_arg)
 
805
                               timestamp_type date_time_type_arg)
784
806
    :sys_var_thd(name_arg), offset(offset_arg),
785
807
    date_time_type(date_time_type_arg)
786
808
  { chain_sys_var(chain); }
789
811
  {
790
812
    return type != STRING_RESULT;               /* Only accept strings */
791
813
  }
792
 
  bool check_default(enum_var_type type __attribute__((unused)))
793
 
  { return 0; }
 
814
  bool check_default(enum_var_type type) { return 0; }
794
815
  bool check(THD *thd, set_var *var);
795
816
  bool update(THD *thd, set_var *var);
796
817
  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);
 
818
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
798
819
  void set_default(THD *thd, enum_var_type type);
799
820
};
800
821
 
801
822
 
802
823
class sys_var_log_state :public sys_var_bool_ptr
803
824
{
804
 
  uint32_t log_type;
 
825
  uint log_type;
805
826
public:
806
 
  sys_var_log_state(sys_var_chain *chain, const char *name_arg, bool *value_arg, 
807
 
                    uint32_t log_type_arg)
 
827
  sys_var_log_state(sys_var_chain *chain, const char *name_arg, my_bool *value_arg, 
 
828
                    uint log_type_arg)
808
829
    :sys_var_bool_ptr(chain, name_arg, value_arg), log_type(log_type_arg) {}
809
830
  bool update(THD *thd, set_var *var);
810
831
  void set_default(THD *thd, enum_var_type type);
825
846
  {
826
847
    return check_set(thd, var, enum_names);
827
848
  }
828
 
  virtual void set_default(THD *thd __attribute__((unused)),
829
 
                           enum_var_type type __attribute__((unused)))
830
 
  {
 
849
  virtual void set_default(THD *thd, enum_var_type type)
 
850
  {  
831
851
    *value= 0;
832
852
  }
833
853
  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)))
836
 
  { return 0; }
 
854
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
855
  bool check_update_type(Item_result type) { return 0; }
837
856
  SHOW_TYPE show_type() { return SHOW_CHAR; }
838
857
};
839
858
 
859
878
    :sys_var(name_arg,func), value(value_arg), enum_names(typelib)
860
879
  {
861
880
    chain_sys_var(chain);
862
 
    set_allow_empty_value(false);
 
881
    set_allow_empty_value(FALSE);
863
882
  }
864
883
  virtual bool check(THD *thd, set_var *var)
865
884
  {
866
885
    return check_set(thd, var, enum_names);
867
886
  }
868
887
  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)))
871
 
  { return 0; }
 
888
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
889
  bool check_update_type(Item_result type) { return 0; }
872
890
  void set_default(THD *thd, enum_var_type type);
873
891
  SHOW_TYPE show_type() { return SHOW_CHAR; }
874
892
};
888
906
    :sys_var(name_arg), var_type(type), 
889
907
       show_type_value(show_type_arg), value_ptr_func(value_ptr_func_arg)
890
908
  { chain_sys_var(chain); }
891
 
  bool update(THD *thd __attribute__((unused)),
892
 
              set_var *var __attribute__((unused)))
893
 
  { return 1; }
894
 
  bool check_default(enum_var_type type __attribute__((unused)))
895
 
  { return 1; }
 
909
  bool update(THD *thd, set_var *var) { return 1; }
 
910
  bool check_default(enum_var_type type) { return 1; }
896
911
  bool check_type(enum_var_type type) { return type != var_type; }
897
 
  bool check_update_type(Item_result type __attribute__((unused)))
898
 
  { return 1; }
899
 
  unsigned char *value_ptr(THD *thd, enum_var_type type __attribute__((unused)),
900
 
                   LEX_STRING *base __attribute__((unused)))
 
912
  bool check_update_type(Item_result type) { return 1; }
 
913
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
901
914
  {
902
915
    return (*value_ptr_func)(thd);
903
916
  }
904
 
  SHOW_TYPE show_type(void) { return show_type_value; }
905
 
  bool is_readonly(void) const { return 1; }
 
917
  SHOW_TYPE show_type() { return show_type_value; }
 
918
  bool is_readonly() const { return 1; }
906
919
};
907
920
 
908
921
 
914
927
  sys_var_have_option(sys_var_chain *chain, const char *variable_name):
915
928
    sys_var(variable_name)
916
929
  { 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)))
 
930
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
920
931
  {
921
 
    return (unsigned char*) show_comp_option_name[get_option()];
 
932
    return (uchar*) show_comp_option_name[get_option()];
922
933
  }
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)))
926
 
  { return 1; }
 
934
  bool update(THD *thd, set_var *var) { return 1; }
 
935
  bool check_default(enum_var_type type) { return 1; }
927
936
  bool check_type(enum_var_type type) { return type != OPT_GLOBAL; }
928
 
  bool check_update_type(Item_result type __attribute__((unused)))
929
 
  { return 1; }
 
937
  bool check_update_type(Item_result type) { return 1; }
930
938
  SHOW_TYPE show_type() { return SHOW_CHAR; }
931
939
  bool is_readonly() const { return 1; }
932
940
};
949
957
class sys_var_have_plugin: public sys_var_have_option
950
958
{
951
959
  const char *plugin_name_str;
952
 
  const uint32_t plugin_name_len;
 
960
  const uint plugin_name_len;
953
961
  const int plugin_type;
954
962
 
955
963
public:
956
964
  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, 
 
965
                      const char *plugin_name_str_arg, uint plugin_name_len_arg, 
958
966
                      int plugin_type_arg):
959
967
    sys_var_have_option(chain, variable_name), 
960
968
    plugin_name_str(plugin_name_str_arg), plugin_name_len(plugin_name_len_arg),
981
989
  {
982
990
    return type != STRING_RESULT;               /* Only accept strings */
983
991
  }
984
 
  bool check_default(enum_var_type type __attribute__((unused)))
985
 
  { return 0; }
 
992
  bool check_default(enum_var_type type) { return 0; }
986
993
  bool update(THD *thd, set_var *var);
987
 
  unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
994
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
988
995
  virtual void set_default(THD *thd, enum_var_type type);
989
996
};
990
997
 
1003
1010
  }
1004
1011
  void set_default(THD *thd, enum_var_type type);
1005
1012
  SHOW_TYPE show_type() { return SHOW_INT; }
1006
 
  unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
1013
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
1007
1014
};
1008
1015
 
1009
1016
 
1010
1017
class sys_var_microseconds :public sys_var_thd
1011
1018
{
1012
 
  uint64_t SV::*offset;
 
1019
  ulonglong SV::*offset;
1013
1020
public:
1014
1021
  sys_var_microseconds(sys_var_chain *chain, const char *name_arg,
1015
 
                       uint64_t SV::*offset_arg):
 
1022
                       ulonglong SV::*offset_arg):
1016
1023
    sys_var_thd(name_arg), offset(offset_arg)
1017
1024
  { chain_sys_var(chain); }
1018
 
  bool check(THD *thd __attribute__((unused)),
1019
 
             set_var *var __attribute__((unused))) {return 0;}
 
1025
  bool check(THD *thd, set_var *var) {return 0;}
1020
1026
  bool update(THD *thd, set_var *var);
1021
1027
  void set_default(THD *thd, enum_var_type type);
1022
1028
  SHOW_TYPE show_type() { return SHOW_DOUBLE; }
1024
1030
  {
1025
1031
    return (type != INT_RESULT && type != REAL_RESULT && type != DECIMAL_RESULT);
1026
1032
  }
1027
 
  unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
1033
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
1034
};
 
1035
 
 
1036
 
 
1037
class sys_var_trust_routine_creators :public sys_var_bool_ptr
 
1038
{
 
1039
  /* We need a derived class only to have a warn_deprecated() */
 
1040
public:
 
1041
  sys_var_trust_routine_creators(sys_var_chain *chain,
 
1042
                                 const char *name_arg, my_bool *value_arg) :
 
1043
    sys_var_bool_ptr(chain, name_arg, value_arg) {};
 
1044
  void warn_deprecated(THD *thd);
 
1045
  void set_default(THD *thd, enum_var_type type);
 
1046
  bool update(THD *thd, set_var *var);
1028
1047
};
1029
1048
 
1030
1049
/**
1035
1054
{
1036
1055
public:
1037
1056
  sys_var_opt_readonly(sys_var_chain *chain, const char *name_arg, 
1038
 
                       bool *value_arg) :
 
1057
                       my_bool *value_arg) :
1039
1058
    sys_var_bool_ptr(chain, name_arg, value_arg) {};
1040
1059
  ~sys_var_opt_readonly() {};
1041
1060
  bool update(THD *thd, set_var *var);
1049
1068
                            Binlog_status_enum binlog_status_arg= NOT_IN_BINLOG)
1050
1069
    : sys_var_thd(name_arg, NULL, binlog_status_arg)
1051
1070
  {
1052
 
#if DRIZZLE_VERSION_ID < 50000
 
1071
#if MYSQL_VERSION_ID < 50000
1053
1072
    no_support_one_shot= 0;
1054
1073
#endif
1055
1074
    chain_sys_var(chain);
1060
1079
  {
1061
1080
    return ((type != STRING_RESULT) && (type != INT_RESULT));
1062
1081
  }
1063
 
  bool check_default(enum_var_type type __attribute__((unused)))
1064
 
  { return 0; }
 
1082
  bool check_default(enum_var_type type) { return 0; }
1065
1083
  bool update(THD *thd, set_var *var);
1066
 
  unsigned char *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
 
1084
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
1067
1085
  virtual void set_default(THD *thd, enum_var_type type);
1068
1086
};
1069
1087
 
1098
1116
};
1099
1117
 
1100
1118
 
1101
 
/* MySQL internal variables */
 
1119
/* MySQL internal variables, like query_cache_size */
1102
1120
 
1103
1121
class set_var :public set_var_base
1104
1122
{
1108
1126
  enum_var_type type;
1109
1127
  union
1110
1128
  {
1111
 
    const CHARSET_INFO *charset;
 
1129
    CHARSET_INFO *charset;
1112
1130
    ulong ulong_value;
1113
 
    uint64_t uint64_t_value;
 
1131
    ulonglong ulonglong_value;
1114
1132
    plugin_ref plugin;
1115
1133
    DATE_TIME_FORMAT *date_time_format;
1116
1134
    Time_zone *time_zone;
1160
1178
 
1161
1179
class set_var_collation_client: public set_var_base
1162
1180
{
1163
 
  const CHARSET_INFO *character_set_client;
1164
 
  const CHARSET_INFO *character_set_results;
1165
 
  const CHARSET_INFO *collation_connection;
 
1181
  CHARSET_INFO *character_set_client;
 
1182
  CHARSET_INFO *character_set_results;
 
1183
  CHARSET_INFO *collation_connection;
1166
1184
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)
 
1185
  set_var_collation_client(CHARSET_INFO *client_coll_arg,
 
1186
                           CHARSET_INFO *connection_coll_arg,
 
1187
                           CHARSET_INFO *result_coll_arg)
1170
1188
    :character_set_client(client_coll_arg),
1171
1189
     character_set_results(result_coll_arg),
1172
1190
     collation_connection(connection_coll_arg)
1186
1204
class NAMED_LIST :public ilink
1187
1205
{
1188
1206
  const char *name;
1189
 
  uint32_t name_length;
 
1207
  uint name_length;
1190
1208
public:
1191
 
  unsigned char* data;
 
1209
  uchar* data;
1192
1210
 
1193
1211
  NAMED_LIST(I_List<NAMED_LIST> *links, const char *name_arg,
1194
 
             uint32_t name_length_arg, unsigned char* data_arg)
 
1212
             uint name_length_arg, uchar* data_arg)
1195
1213
    :name_length(name_length_arg), data(data_arg)
1196
1214
  {
1197
1215
    name= my_strndup(name_arg, name_length, MYF(MY_WME));
1198
1216
    links->push_back(this);
1199
1217
  }
1200
 
  inline bool cmp(const char *name_cmp, uint32_t length)
 
1218
  inline bool cmp(const char *name_cmp, uint length)
1201
1219
  {
1202
1220
    return length == name_length && !memcmp(name, name_cmp, length);
1203
1221
  }
1204
1222
  ~NAMED_LIST()
1205
1223
  {
1206
 
    free((unsigned char*) name);
 
1224
    my_free((uchar*) name, MYF(0));
1207
1225
  }
1208
1226
  friend bool process_key_caches(process_key_cache_t func);
1209
1227
  friend void delete_elements(I_List<NAMED_LIST> *list,
1210
 
                              void (*free_element)(const char*, unsigned char*));
 
1228
                              void (*free_element)(const char*, uchar*));
1211
1229
};
1212
1230
 
1213
1231
/* updated in sql_acl.cc */
1214
1232
 
1215
1233
extern sys_var_thd_bool sys_old_alter_table;
 
1234
extern sys_var_thd_bool sys_old_passwords;
1216
1235
extern LEX_STRING default_key_cache_base;
1217
1236
 
1218
1237
/* For sql_yacc */
1228
1247
 
1229
1248
int set_var_init();
1230
1249
void set_var_free();
1231
 
int mysql_append_static_vars(const SHOW_VAR *show_vars, uint32_t count);
 
1250
int mysql_append_static_vars(const SHOW_VAR *show_vars, uint count);
1232
1251
SHOW_VAR* enumerate_sys_vars(THD *thd, bool sorted);
1233
1252
int mysql_add_sys_var_chain(sys_var *chain, struct my_option *long_options);
1234
1253
int mysql_del_sys_var_chain(sys_var *chain);
1235
 
sys_var *find_sys_var(THD *thd, const char *str, uint32_t length=0);
 
1254
sys_var *find_sys_var(THD *thd, const char *str, uint length=0);
1236
1255
int sql_set_variables(THD *thd, List<set_var_base> *var_list);
1237
1256
bool not_all_support_one_shot(List<set_var_base> *var_list);
1238
1257
void fix_delay_key_write(THD *thd, enum_var_type type);
1239
1258
void fix_slave_exec_mode(enum_var_type type);
 
1259
ulong fix_sql_mode(ulong sql_mode);
 
1260
extern sys_var_const_str sys_charset_system;
1240
1261
extern sys_var_str sys_init_connect;
1241
1262
extern sys_var_str sys_init_slave;
1242
1263
extern sys_var_thd_time_zone sys_time_zone;
1243
1264
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,
 
1265
CHARSET_INFO *get_old_charset_by_name(const char *old_name);
 
1266
uchar* find_named(I_List<NAMED_LIST> *list, const char *name, uint length,
1246
1267
                NAMED_LIST **found);
1247
1268
 
1248
1269
extern sys_var_str sys_var_general_log_path, sys_var_slow_log_path;
1249
1270
 
1250
1271
/* key_cache functions */
1251
1272
KEY_CACHE *get_key_cache(LEX_STRING *cache_name);
1252
 
KEY_CACHE *get_or_create_key_cache(const char *name, uint32_t length);
 
1273
KEY_CACHE *get_or_create_key_cache(const char *name, uint length);
1253
1274
void free_key_cache(const char *name, KEY_CACHE *key_cache);
1254
1275
bool process_key_caches(process_key_cache_t func);
1255
1276
void delete_elements(I_List<NAMED_LIST> *list,
1256
 
                     void (*free_element)(const char*, unsigned char*));
 
1277
                     void (*free_element)(const char*, uchar*));