~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to sql/set_var.h

  • Committer: Brian Aker
  • Date: 2008-07-07 16:58:11 UTC
  • mfrom: (77.1.25 codestyle)
  • Revision ID: brian@tangent.org-20080707165811-jfqxacc3436dut4n
Merge from Monty's tree

Show diffs side-by-side

added added

removed removed

Lines of Context:
95
95
      (binlog_status == SESSION_VARIABLE_IN_BINLOG);
96
96
  }
97
97
  virtual bool update(THD *thd, set_var *var)=0;
98
 
  virtual void set_default(THD *thd_arg, enum_var_type type) {}
 
98
  virtual void set_default(THD *thd_arg __attribute__((__unused__)),
 
99
                           enum_var_type type __attribute__((__unused__)))
 
100
  {}
99
101
  virtual SHOW_TYPE show_type() { return SHOW_UNDEF; }
100
 
  virtual uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
 
102
  virtual uchar *value_ptr(THD *thd __attribute__((__unused__)),
 
103
                           enum_var_type type __attribute__((__unused__)),
 
104
                           LEX_STRING *base __attribute__((__unused__)))
101
105
  { return 0; }
102
106
  virtual bool check_type(enum_var_type type)
103
107
  { return type != OPT_GLOBAL; }                /* Error if not GLOBAL */
104
108
  virtual bool check_update_type(Item_result type)
105
109
  { return type != INT_RESULT; }                /* Assume INT */
106
 
  virtual bool check_default(enum_var_type type)
 
110
  virtual bool check_default(enum_var_type type __attribute__((__unused__)))
107
111
  { return option_limits == 0; }
108
112
  Item *item(THD *thd, enum_var_type type, LEX_STRING *base);
109
113
  virtual bool is_struct() { return 0; }
159
163
  bool update(THD *thd, set_var *var);
160
164
  void set_default(THD *thd, enum_var_type type);
161
165
  SHOW_TYPE show_type() { return SHOW_LONG; }
162
 
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
 
166
  uchar *value_ptr(THD *thd __attribute__((__unused__)),
 
167
                   enum_var_type type __attribute__((__unused__)),
 
168
                   LEX_STRING *base __attribute__((__unused__)))
163
169
  { return (uchar*) value; }
164
170
};
165
171
 
190
196
  bool update(THD *thd, set_var *var);
191
197
  void set_default(THD *thd, enum_var_type type);
192
198
  SHOW_TYPE show_type() { return SHOW_LONGLONG; }
193
 
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
 
199
  uchar *value_ptr(THD *thd __attribute__((__unused__)),
 
200
                   enum_var_type type __attribute__((__unused__)),
 
201
                   LEX_STRING *base __attribute__((__unused__)))
194
202
  { return (uchar*) value; }
195
203
};
196
204
 
209
217
  bool update(THD *thd, set_var *var);
210
218
  void set_default(THD *thd, enum_var_type type);
211
219
  SHOW_TYPE show_type() { return SHOW_MY_BOOL; }
212
 
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
 
220
  uchar *value_ptr(THD *thd __attribute__((__unused__)),
 
221
                   enum_var_type type __attribute__((__unused__)),
 
222
                   LEX_STRING *base __attribute__((__unused__)))
213
223
  { return (uchar*) value; }
214
 
  bool check_update_type(Item_result type) { return 0; }
 
224
  bool check_update_type(Item_result type __attribute__((__unused__)))
 
225
  { return 0; }
215
226
};
216
227
 
217
228
 
252
263
    (*set_default_func)(thd, type);
253
264
  }
254
265
  SHOW_TYPE show_type() { return SHOW_CHAR; }
255
 
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
 
266
  uchar *value_ptr(THD *thd __attribute__((__unused__)),
 
267
                   enum_var_type type __attribute__((__unused__)),
 
268
                   LEX_STRING *base __attribute__((__unused__)))
256
269
  { return (uchar*) value; }
257
270
  bool check_update_type(Item_result type)
258
271
  {
259
272
    return type != STRING_RESULT;               /* Only accept strings */
260
273
  }
261
 
  bool check_default(enum_var_type type) { return 0; }
 
274
  bool check_default(enum_var_type type __attribute__((__unused__)))
 
275
  { return 0; }
262
276
};
263
277
 
264
278
 
274
288
  {
275
289
    value= new_value;
276
290
  }
277
 
  bool check(THD *thd, set_var *var)
 
291
  bool check(THD *thd __attribute__((__unused__)),
 
292
             set_var *var __attribute__((__unused__)))
278
293
  {
279
294
    return 1;
280
295
  }
281
 
  bool update(THD *thd, set_var *var)
 
296
  bool update(THD *thd __attribute__((__unused__)),
 
297
              set_var *var __attribute__((__unused__)))
282
298
  {
283
299
    return 1;
284
300
  }
285
301
  SHOW_TYPE show_type() { return SHOW_CHAR; }
286
 
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
 
302
  uchar *value_ptr(THD *thd __attribute__((__unused__)),
 
303
                   enum_var_type type __attribute__((__unused__)),
 
304
                   LEX_STRING *base __attribute__((__unused__)))
287
305
  {
288
306
    return (uchar*) value;
289
307
  }
290
 
  bool check_update_type(Item_result type)
 
308
  bool check_update_type(Item_result type __attribute__((__unused__)))
291
309
  {
292
310
    return 1;
293
311
  }
294
 
  bool check_default(enum_var_type type) { return 1; }
 
312
  bool check_default(enum_var_type type __attribute__((__unused__)))
 
313
  { return 1; }
295
314
  bool is_readonly() const { return 1; }
296
315
};
297
316
 
303
322
  sys_var_const_str_ptr(sys_var_chain *chain, const char *name_arg, char **value_arg)
304
323
    :sys_var(name_arg),value(value_arg)
305
324
  { chain_sys_var(chain); }
306
 
  bool check(THD *thd, set_var *var)
 
325
  bool check(THD *thd __attribute__((__unused__)),
 
326
             set_var *var __attribute__((__unused__)))
307
327
  {
308
328
    return 1;
309
329
  }
310
 
  bool update(THD *thd, set_var *var)
 
330
  bool update(THD *thd __attribute__((__unused__)),
 
331
              set_var *var __attribute__((__unused__)))
311
332
  {
312
333
    return 1;
313
334
  }
314
335
  SHOW_TYPE show_type() { return SHOW_CHAR; }
315
 
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
 
336
  uchar *value_ptr(THD *thd __attribute__((__unused__)),
 
337
                   enum_var_type type __attribute__((__unused__)),
 
338
                   LEX_STRING *base __attribute__((__unused__)))
316
339
  {
317
340
    return (uchar*) *value;
318
341
  }
319
 
  bool check_update_type(Item_result type)
 
342
  bool check_update_type(Item_result type __attribute__((__unused__)))
320
343
  {
321
344
    return 1;
322
345
  }
323
 
  bool check_default(enum_var_type type) { return 1; }
324
 
  bool is_readonly() const { return 1; }
 
346
  bool check_default(enum_var_type type __attribute__((__unused__)))
 
347
  { return 1; }
 
348
  bool is_readonly(void) const { return 1; }
325
349
};
326
350
 
327
351
 
341
365
  bool update(THD *thd, set_var *var);
342
366
  SHOW_TYPE show_type() { return SHOW_CHAR; }
343
367
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
344
 
  bool check_update_type(Item_result type) { return 0; }
 
368
  bool check_update_type(Item_result type __attribute__((__unused__)))
 
369
  { return 0; }
345
370
};
346
371
 
347
372
 
354
379
      TYPELIB *typelib, sys_after_update_func func)
355
380
    :sys_var(name_arg,func), offset(offset_arg), enum_names(typelib)
356
381
  { chain_sys_var(chain); }
357
 
  bool check(THD *thd, set_var *var) { return 1; }
358
 
  bool update(THD *thd, set_var *var) { return 1; }
 
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; }
359
388
  SHOW_TYPE show_type() { return SHOW_CHAR; }
360
 
  bool check_update_type(Item_result type) { return 1; }
 
389
  bool check_update_type(Item_result type __attribute__((__unused__)))
 
390
  { return 1; }
361
391
  bool is_readonly() const { return 1; }
362
392
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
363
393
};
371
401
              Binlog_status_enum binlog_status= NOT_IN_BINLOG)
372
402
    :sys_var(name_arg, func, binlog_status)
373
403
  {}
374
 
  bool check_type(enum_var_type type) { return 0; }
 
404
  bool check_type(enum_var_type type __attribute__((__unused__)))
 
405
  { return 0; }
375
406
  bool check_default(enum_var_type type)
376
407
  {
377
408
    return type == OPT_GLOBAL && !option_limits;
470
501
  {
471
502
    return check_enum(thd, var, &bool_typelib);
472
503
  }
473
 
  bool check_update_type(Item_result type) { return 0; }
 
504
  bool check_update_type(Item_result type __attribute__((__unused__)))
 
505
  { return 0; }
474
506
};
475
507
 
476
508
 
499
531
  void set_default(THD *thd, enum_var_type type);
500
532
  SHOW_TYPE show_type() { return SHOW_CHAR; }
501
533
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
502
 
  bool check_update_type(Item_result type) { return 0; }
 
534
  bool check_update_type(Item_result type __attribute__((__unused__)))
 
535
  { return 0; }
503
536
};
504
537
 
505
538
 
558
591
  { chain_sys_var(chain); }
559
592
  bool check(THD *thd, set_var *var);
560
593
  bool update(THD *thd, set_var *var);
561
 
  bool check_update_type(Item_result type) { return 0; }
 
594
  bool check_update_type(Item_result type __attribute__((__unused__)))
 
595
  { return 0; }
562
596
  bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
563
597
  SHOW_TYPE show_type() { return SHOW_MY_BOOL; }
564
598
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
573
607
  bool check_update_type(Item_result type) { return type != STRING_RESULT; }
574
608
  SHOW_TYPE show_type() { return SHOW_CHAR; }
575
609
  bool update(THD *thd, set_var *var);
576
 
  void set_default(THD *thd, enum_var_type type) { DBUG_POP(); }
 
610
  void set_default(THD *thd __attribute__((__unused__)),
 
611
                   enum_var_type type __attribute__((__unused__)))
 
612
  { DBUG_POP(); }
577
613
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *b);
578
614
};
579
615
 
591
627
  bool update(THD *thd, set_var *var);
592
628
  void set_default(THD *thd, enum_var_type type);
593
629
  bool check_type(enum_var_type type)    { return type == OPT_GLOBAL; }
594
 
  bool check_default(enum_var_type type) { return 0; }
595
 
  SHOW_TYPE show_type() { return SHOW_LONG; }
 
630
  bool check_default(enum_var_type type __attribute__((__unused__)))
 
631
  { return 0; }
 
632
  SHOW_TYPE show_type(void) { return SHOW_LONG; }
596
633
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
597
634
};
598
635
 
662
699
  {
663
700
    return ((type != STRING_RESULT) && (type != INT_RESULT));
664
701
  }
665
 
  bool check_default(enum_var_type type) { return 0; }
 
702
  bool check_default(enum_var_type type __attribute__((__unused__))) { return 0; }
666
703
  virtual void set_default(THD *thd, enum_var_type type)= 0;
667
704
};
668
705
 
686
723
  {
687
724
    return ((type != STRING_RESULT) && (type != INT_RESULT));
688
725
  }
689
 
  bool check_default(enum_var_type type) { return 0; }
 
726
  bool check_default(enum_var_type type __attribute__((__unused__)))
 
727
  { return 0; }
690
728
  bool update(THD *thd, set_var *var);
691
729
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
692
730
  virtual void set_default(THD *thd, enum_var_type type)= 0;
767
805
    :sys_var(name_arg), offset(offset_arg)
768
806
  { chain_sys_var(chain); }
769
807
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
770
 
  bool check_default(enum_var_type type) { return 1; }
 
808
  bool check_default(enum_var_type type __attribute__((__unused__)))
 
809
  { return 1; }
771
810
  bool is_struct() { return 1; }
772
811
};
773
812
 
811
850
  {
812
851
    return type != STRING_RESULT;               /* Only accept strings */
813
852
  }
814
 
  bool check_default(enum_var_type type) { return 0; }
 
853
  bool check_default(enum_var_type type __attribute__((__unused__)))
 
854
  { return 0; }
815
855
  bool check(THD *thd, set_var *var);
816
856
  bool update(THD *thd, set_var *var);
817
857
  void update2(THD *thd, enum_var_type type, DATE_TIME_FORMAT *new_value);
846
886
  {
847
887
    return check_set(thd, var, enum_names);
848
888
  }
849
 
  virtual void set_default(THD *thd, enum_var_type type)
850
 
  {  
 
889
  virtual void set_default(THD *thd __attribute__((__unused__)),
 
890
                           enum_var_type type __attribute__((__unused__)))
 
891
  {
851
892
    *value= 0;
852
893
  }
853
894
  bool update(THD *thd, set_var *var);
854
895
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
855
 
  bool check_update_type(Item_result type) { return 0; }
 
896
  bool check_update_type(Item_result type __attribute__((__unused__)))
 
897
  { return 0; }
856
898
  SHOW_TYPE show_type() { return SHOW_CHAR; }
857
899
};
858
900
 
886
928
  }
887
929
  bool update(THD *thd, set_var *var);
888
930
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
889
 
  bool check_update_type(Item_result type) { return 0; }
 
931
  bool check_update_type(Item_result type __attribute__((__unused__)))
 
932
  { return 0; }
890
933
  void set_default(THD *thd, enum_var_type type);
891
934
  SHOW_TYPE show_type() { return SHOW_CHAR; }
892
935
};
906
949
    :sys_var(name_arg), var_type(type), 
907
950
       show_type_value(show_type_arg), value_ptr_func(value_ptr_func_arg)
908
951
  { chain_sys_var(chain); }
909
 
  bool update(THD *thd, set_var *var) { return 1; }
910
 
  bool check_default(enum_var_type type) { return 1; }
 
952
  bool update(THD *thd __attribute__((__unused__)),
 
953
              set_var *var __attribute__((__unused__)))
 
954
  { return 1; }
 
955
  bool check_default(enum_var_type type __attribute__((__unused__)))
 
956
  { return 1; }
911
957
  bool check_type(enum_var_type type) { return type != var_type; }
912
 
  bool check_update_type(Item_result type) { return 1; }
913
 
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
 
958
  bool check_update_type(Item_result type __attribute__((__unused__)))
 
959
  { return 1; }
 
960
  uchar *value_ptr(THD *thd, enum_var_type type __attribute__((__unused__)),
 
961
                   LEX_STRING *base __attribute__((__unused__)))
914
962
  {
915
963
    return (*value_ptr_func)(thd);
916
964
  }
917
 
  SHOW_TYPE show_type() { return show_type_value; }
918
 
  bool is_readonly() const { return 1; }
 
965
  SHOW_TYPE show_type(void) { return show_type_value; }
 
966
  bool is_readonly(void) const { return 1; }
919
967
};
920
968
 
921
969
 
927
975
  sys_var_have_option(sys_var_chain *chain, const char *variable_name):
928
976
    sys_var(variable_name)
929
977
  { chain_sys_var(chain); }
930
 
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
 
978
  uchar *value_ptr(THD *thd __attribute__((__unused__)),
 
979
                   enum_var_type type __attribute__((__unused__)),
 
980
                   LEX_STRING *base __attribute__((__unused__)))
931
981
  {
932
982
    return (uchar*) show_comp_option_name[get_option()];
933
983
  }
934
 
  bool update(THD *thd, set_var *var) { return 1; }
935
 
  bool check_default(enum_var_type type) { return 1; }
 
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__)))
 
987
  { return 1; }
936
988
  bool check_type(enum_var_type type) { return type != OPT_GLOBAL; }
937
 
  bool check_update_type(Item_result type) { return 1; }
 
989
  bool check_update_type(Item_result type __attribute__((__unused__)))
 
990
  { return 1; }
938
991
  SHOW_TYPE show_type() { return SHOW_CHAR; }
939
992
  bool is_readonly() const { return 1; }
940
993
};
989
1042
  {
990
1043
    return type != STRING_RESULT;               /* Only accept strings */
991
1044
  }
992
 
  bool check_default(enum_var_type type) { return 0; }
 
1045
  bool check_default(enum_var_type type __attribute__((__unused__)))
 
1046
  { return 0; }
993
1047
  bool update(THD *thd, set_var *var);
994
1048
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
995
1049
  virtual void set_default(THD *thd, enum_var_type type);
1022
1076
                       ulonglong SV::*offset_arg):
1023
1077
    sys_var_thd(name_arg), offset(offset_arg)
1024
1078
  { chain_sys_var(chain); }
1025
 
  bool check(THD *thd, set_var *var) {return 0;}
 
1079
  bool check(THD *thd __attribute__((__unused__)),
 
1080
             set_var *var __attribute__((__unused__))) {return 0;}
1026
1081
  bool update(THD *thd, set_var *var);
1027
1082
  void set_default(THD *thd, enum_var_type type);
1028
1083
  SHOW_TYPE show_type() { return SHOW_DOUBLE; }
1079
1134
  {
1080
1135
    return ((type != STRING_RESULT) && (type != INT_RESULT));
1081
1136
  }
1082
 
  bool check_default(enum_var_type type) { return 0; }
 
1137
  bool check_default(enum_var_type type __attribute__((__unused__)))
 
1138
  { return 0; }
1083
1139
  bool update(THD *thd, set_var *var);
1084
1140
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
1085
1141
  virtual void set_default(THD *thd, enum_var_type type);