~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to server/set_var.h

  • Committer: Brian Aker
  • Date: 2008-07-26 18:39:33 UTC
  • mfrom: (212.1.3 codestyle)
  • Revision ID: brian@tangent.org-20080726183933-hueup0fcy2zs1hug
Merge Monty

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 __attribute__((__unused__)),
99
 
                           enum_var_type type __attribute__((__unused__)))
 
98
  virtual void set_default(THD *thd_arg __attribute__((unused)),
 
99
                           enum_var_type type __attribute__((unused)))
100
100
  {}
101
101
  virtual SHOW_TYPE show_type() { return SHOW_UNDEF; }
102
 
  virtual uchar *value_ptr(THD *thd __attribute__((__unused__)),
103
 
                           enum_var_type type __attribute__((__unused__)),
104
 
                           LEX_STRING *base __attribute__((__unused__)))
 
102
  virtual uchar *value_ptr(THD *thd __attribute__((unused)),
 
103
                           enum_var_type type __attribute__((unused)),
 
104
                           LEX_STRING *base __attribute__((unused)))
105
105
  { return 0; }
106
106
  virtual bool check_type(enum_var_type type)
107
107
  { return type != OPT_GLOBAL; }                /* Error if not GLOBAL */
108
108
  virtual bool check_update_type(Item_result type)
109
109
  { return type != INT_RESULT; }                /* Assume INT */
110
 
  virtual bool check_default(enum_var_type type __attribute__((__unused__)))
 
110
  virtual bool check_default(enum_var_type type __attribute__((unused)))
111
111
  { return option_limits == 0; }
112
112
  Item *item(THD *thd, enum_var_type type, LEX_STRING *base);
113
113
  virtual bool is_struct() { return 0; }
163
163
  bool update(THD *thd, set_var *var);
164
164
  void set_default(THD *thd, enum_var_type type);
165
165
  SHOW_TYPE show_type() { return SHOW_LONG; }
166
 
  uchar *value_ptr(THD *thd __attribute__((__unused__)),
167
 
                   enum_var_type type __attribute__((__unused__)),
168
 
                   LEX_STRING *base __attribute__((__unused__)))
 
166
  uchar *value_ptr(THD *thd __attribute__((unused)),
 
167
                   enum_var_type type __attribute__((unused)),
 
168
                   LEX_STRING *base __attribute__((unused)))
169
169
  { return (uchar*) value; }
170
170
};
171
171
 
196
196
  bool update(THD *thd, set_var *var);
197
197
  void set_default(THD *thd, enum_var_type type);
198
198
  SHOW_TYPE show_type() { return SHOW_LONGLONG; }
199
 
  uchar *value_ptr(THD *thd __attribute__((__unused__)),
200
 
                   enum_var_type type __attribute__((__unused__)),
201
 
                   LEX_STRING *base __attribute__((__unused__)))
 
199
  uchar *value_ptr(THD *thd __attribute__((unused)),
 
200
                   enum_var_type type __attribute__((unused)),
 
201
                   LEX_STRING *base __attribute__((unused)))
202
202
  { return (uchar*) value; }
203
203
};
204
204
 
217
217
  bool update(THD *thd, set_var *var);
218
218
  void set_default(THD *thd, enum_var_type type);
219
219
  SHOW_TYPE show_type() { return SHOW_MY_BOOL; }
220
 
  uchar *value_ptr(THD *thd __attribute__((__unused__)),
221
 
                   enum_var_type type __attribute__((__unused__)),
222
 
                   LEX_STRING *base __attribute__((__unused__)))
 
220
  uchar *value_ptr(THD *thd __attribute__((unused)),
 
221
                   enum_var_type type __attribute__((unused)),
 
222
                   LEX_STRING *base __attribute__((unused)))
223
223
  { return (uchar*) value; }
224
 
  bool check_update_type(Item_result type __attribute__((__unused__)))
 
224
  bool check_update_type(Item_result type __attribute__((unused)))
225
225
  { return 0; }
226
226
};
227
227
 
262
262
    (*set_default_func)(thd, type);
263
263
  }
264
264
  SHOW_TYPE show_type() { return SHOW_CHAR; }
265
 
  uchar *value_ptr(THD *thd __attribute__((__unused__)),
266
 
                   enum_var_type type __attribute__((__unused__)),
267
 
                   LEX_STRING *base __attribute__((__unused__)))
 
265
  uchar *value_ptr(THD *thd __attribute__((unused)),
 
266
                   enum_var_type type __attribute__((unused)),
 
267
                   LEX_STRING *base __attribute__((unused)))
268
268
  { return (uchar*) value; }
269
269
  bool check_update_type(Item_result type)
270
270
  {
271
271
    return type != STRING_RESULT;               /* Only accept strings */
272
272
  }
273
 
  bool check_default(enum_var_type type __attribute__((__unused__)))
 
273
  bool check_default(enum_var_type type __attribute__((unused)))
274
274
  { return 0; }
275
275
};
276
276
 
287
287
  {
288
288
    value= new_value;
289
289
  }
290
 
  bool check(THD *thd __attribute__((__unused__)),
291
 
             set_var *var __attribute__((__unused__)))
 
290
  bool check(THD *thd __attribute__((unused)),
 
291
             set_var *var __attribute__((unused)))
292
292
  {
293
293
    return 1;
294
294
  }
295
 
  bool update(THD *thd __attribute__((__unused__)),
296
 
              set_var *var __attribute__((__unused__)))
 
295
  bool update(THD *thd __attribute__((unused)),
 
296
              set_var *var __attribute__((unused)))
297
297
  {
298
298
    return 1;
299
299
  }
300
300
  SHOW_TYPE show_type() { return SHOW_CHAR; }
301
 
  uchar *value_ptr(THD *thd __attribute__((__unused__)),
302
 
                   enum_var_type type __attribute__((__unused__)),
303
 
                   LEX_STRING *base __attribute__((__unused__)))
 
301
  uchar *value_ptr(THD *thd __attribute__((unused)),
 
302
                   enum_var_type type __attribute__((unused)),
 
303
                   LEX_STRING *base __attribute__((unused)))
304
304
  {
305
305
    return (uchar*) value;
306
306
  }
307
 
  bool check_update_type(Item_result type __attribute__((__unused__)))
 
307
  bool check_update_type(Item_result type __attribute__((unused)))
308
308
  {
309
309
    return 1;
310
310
  }
311
 
  bool check_default(enum_var_type type __attribute__((__unused__)))
 
311
  bool check_default(enum_var_type type __attribute__((unused)))
312
312
  { return 1; }
313
313
  bool is_readonly() const { return 1; }
314
314
};
321
321
  sys_var_const_str_ptr(sys_var_chain *chain, const char *name_arg, char **value_arg)
322
322
    :sys_var(name_arg),value(value_arg)
323
323
  { chain_sys_var(chain); }
324
 
  bool check(THD *thd __attribute__((__unused__)),
325
 
             set_var *var __attribute__((__unused__)))
 
324
  bool check(THD *thd __attribute__((unused)),
 
325
             set_var *var __attribute__((unused)))
326
326
  {
327
327
    return 1;
328
328
  }
329
 
  bool update(THD *thd __attribute__((__unused__)),
330
 
              set_var *var __attribute__((__unused__)))
 
329
  bool update(THD *thd __attribute__((unused)),
 
330
              set_var *var __attribute__((unused)))
331
331
  {
332
332
    return 1;
333
333
  }
334
334
  SHOW_TYPE show_type() { return SHOW_CHAR; }
335
 
  uchar *value_ptr(THD *thd __attribute__((__unused__)),
336
 
                   enum_var_type type __attribute__((__unused__)),
337
 
                   LEX_STRING *base __attribute__((__unused__)))
 
335
  uchar *value_ptr(THD *thd __attribute__((unused)),
 
336
                   enum_var_type type __attribute__((unused)),
 
337
                   LEX_STRING *base __attribute__((unused)))
338
338
  {
339
339
    return (uchar*) *value;
340
340
  }
341
 
  bool check_update_type(Item_result type __attribute__((__unused__)))
 
341
  bool check_update_type(Item_result type __attribute__((unused)))
342
342
  {
343
343
    return 1;
344
344
  }
345
 
  bool check_default(enum_var_type type __attribute__((__unused__)))
 
345
  bool check_default(enum_var_type type __attribute__((unused)))
346
346
  { return 1; }
347
347
  bool is_readonly(void) const { return 1; }
348
348
};
364
364
  bool update(THD *thd, set_var *var);
365
365
  SHOW_TYPE show_type() { return SHOW_CHAR; }
366
366
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
367
 
  bool check_update_type(Item_result type __attribute__((__unused__)))
 
367
  bool check_update_type(Item_result type __attribute__((unused)))
368
368
  { return 0; }
369
369
};
370
370
 
378
378
      TYPELIB *typelib, sys_after_update_func func)
379
379
    :sys_var(name_arg,func), offset(offset_arg), enum_names(typelib)
380
380
  { chain_sys_var(chain); }
381
 
  bool check(THD *thd __attribute__((__unused__)),
382
 
             set_var *var __attribute__((__unused__)))
 
381
  bool check(THD *thd __attribute__((unused)),
 
382
             set_var *var __attribute__((unused)))
383
383
  { return 1; }
384
 
  bool update(THD *thd __attribute__((__unused__)),
385
 
              set_var *var __attribute__((__unused__)))
 
384
  bool update(THD *thd __attribute__((unused)),
 
385
              set_var *var __attribute__((unused)))
386
386
  { return 1; }
387
387
  SHOW_TYPE show_type() { return SHOW_CHAR; }
388
 
  bool check_update_type(Item_result type __attribute__((__unused__)))
 
388
  bool check_update_type(Item_result type __attribute__((unused)))
389
389
  { return 1; }
390
390
  bool is_readonly() const { return 1; }
391
391
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
400
400
              Binlog_status_enum binlog_status= NOT_IN_BINLOG)
401
401
    :sys_var(name_arg, func, binlog_status)
402
402
  {}
403
 
  bool check_type(enum_var_type type __attribute__((__unused__)))
 
403
  bool check_type(enum_var_type type __attribute__((unused)))
404
404
  { return 0; }
405
405
  bool check_default(enum_var_type type)
406
406
  {
500
500
  {
501
501
    return check_enum(thd, var, &bool_typelib);
502
502
  }
503
 
  bool check_update_type(Item_result type __attribute__((__unused__)))
 
503
  bool check_update_type(Item_result type __attribute__((unused)))
504
504
  { return 0; }
505
505
};
506
506
 
530
530
  void set_default(THD *thd, enum_var_type type);
531
531
  SHOW_TYPE show_type() { return SHOW_CHAR; }
532
532
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
533
 
  bool check_update_type(Item_result type __attribute__((__unused__)))
 
533
  bool check_update_type(Item_result type __attribute__((unused)))
534
534
  { return 0; }
535
535
};
536
536
 
590
590
  { chain_sys_var(chain); }
591
591
  bool check(THD *thd, set_var *var);
592
592
  bool update(THD *thd, set_var *var);
593
 
  bool check_update_type(Item_result type __attribute__((__unused__)))
 
593
  bool check_update_type(Item_result type __attribute__((unused)))
594
594
  { return 0; }
595
595
  bool check_type(enum_var_type type) { return type == OPT_GLOBAL; }
596
596
  SHOW_TYPE show_type() { return SHOW_MY_BOOL; }
609
609
  bool update(THD *thd, set_var *var);
610
610
  void set_default(THD *thd, enum_var_type type);
611
611
  bool check_type(enum_var_type type)    { return type == OPT_GLOBAL; }
612
 
  bool check_default(enum_var_type type __attribute__((__unused__)))
 
612
  bool check_default(enum_var_type type __attribute__((unused)))
613
613
  { return 0; }
614
614
  SHOW_TYPE show_type(void) { return SHOW_LONG; }
615
615
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
681
681
  {
682
682
    return ((type != STRING_RESULT) && (type != INT_RESULT));
683
683
  }
684
 
  bool check_default(enum_var_type type __attribute__((__unused__))) { return 0; }
 
684
  bool check_default(enum_var_type type __attribute__((unused))) { return 0; }
685
685
  virtual void set_default(THD *thd, enum_var_type type)= 0;
686
686
};
687
687
 
705
705
  {
706
706
    return ((type != STRING_RESULT) && (type != INT_RESULT));
707
707
  }
708
 
  bool check_default(enum_var_type type __attribute__((__unused__)))
 
708
  bool check_default(enum_var_type type __attribute__((unused)))
709
709
  { return 0; }
710
710
  bool update(THD *thd, set_var *var);
711
711
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
787
787
    :sys_var(name_arg), offset(offset_arg)
788
788
  { chain_sys_var(chain); }
789
789
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
790
 
  bool check_default(enum_var_type type __attribute__((__unused__)))
 
790
  bool check_default(enum_var_type type __attribute__((unused)))
791
791
  { return 1; }
792
792
  bool is_struct() { return 1; }
793
793
};
832
832
  {
833
833
    return type != STRING_RESULT;               /* Only accept strings */
834
834
  }
835
 
  bool check_default(enum_var_type type __attribute__((__unused__)))
 
835
  bool check_default(enum_var_type type __attribute__((unused)))
836
836
  { return 0; }
837
837
  bool check(THD *thd, set_var *var);
838
838
  bool update(THD *thd, set_var *var);
868
868
  {
869
869
    return check_set(thd, var, enum_names);
870
870
  }
871
 
  virtual void set_default(THD *thd __attribute__((__unused__)),
872
 
                           enum_var_type type __attribute__((__unused__)))
 
871
  virtual void set_default(THD *thd __attribute__((unused)),
 
872
                           enum_var_type type __attribute__((unused)))
873
873
  {
874
874
    *value= 0;
875
875
  }
876
876
  bool update(THD *thd, set_var *var);
877
877
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
878
 
  bool check_update_type(Item_result type __attribute__((__unused__)))
 
878
  bool check_update_type(Item_result type __attribute__((unused)))
879
879
  { return 0; }
880
880
  SHOW_TYPE show_type() { return SHOW_CHAR; }
881
881
};
910
910
  }
911
911
  bool update(THD *thd, set_var *var);
912
912
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
913
 
  bool check_update_type(Item_result type __attribute__((__unused__)))
 
913
  bool check_update_type(Item_result type __attribute__((unused)))
914
914
  { return 0; }
915
915
  void set_default(THD *thd, enum_var_type type);
916
916
  SHOW_TYPE show_type() { return SHOW_CHAR; }
931
931
    :sys_var(name_arg), var_type(type), 
932
932
       show_type_value(show_type_arg), value_ptr_func(value_ptr_func_arg)
933
933
  { chain_sys_var(chain); }
934
 
  bool update(THD *thd __attribute__((__unused__)),
935
 
              set_var *var __attribute__((__unused__)))
 
934
  bool update(THD *thd __attribute__((unused)),
 
935
              set_var *var __attribute__((unused)))
936
936
  { return 1; }
937
 
  bool check_default(enum_var_type type __attribute__((__unused__)))
 
937
  bool check_default(enum_var_type type __attribute__((unused)))
938
938
  { return 1; }
939
939
  bool check_type(enum_var_type type) { return type != var_type; }
940
 
  bool check_update_type(Item_result type __attribute__((__unused__)))
 
940
  bool check_update_type(Item_result type __attribute__((unused)))
941
941
  { return 1; }
942
 
  uchar *value_ptr(THD *thd, enum_var_type type __attribute__((__unused__)),
943
 
                   LEX_STRING *base __attribute__((__unused__)))
 
942
  uchar *value_ptr(THD *thd, enum_var_type type __attribute__((unused)),
 
943
                   LEX_STRING *base __attribute__((unused)))
944
944
  {
945
945
    return (*value_ptr_func)(thd);
946
946
  }
957
957
  sys_var_have_option(sys_var_chain *chain, const char *variable_name):
958
958
    sys_var(variable_name)
959
959
  { chain_sys_var(chain); }
960
 
  uchar *value_ptr(THD *thd __attribute__((__unused__)),
961
 
                   enum_var_type type __attribute__((__unused__)),
962
 
                   LEX_STRING *base __attribute__((__unused__)))
 
960
  uchar *value_ptr(THD *thd __attribute__((unused)),
 
961
                   enum_var_type type __attribute__((unused)),
 
962
                   LEX_STRING *base __attribute__((unused)))
963
963
  {
964
964
    return (uchar*) show_comp_option_name[get_option()];
965
965
  }
966
 
  bool update(THD *thd __attribute__((__unused__)),
967
 
              set_var *var __attribute__((__unused__))) { return 1; }
968
 
  bool check_default(enum_var_type type __attribute__((__unused__)))
 
966
  bool update(THD *thd __attribute__((unused)),
 
967
              set_var *var __attribute__((unused))) { return 1; }
 
968
  bool check_default(enum_var_type type __attribute__((unused)))
969
969
  { return 1; }
970
970
  bool check_type(enum_var_type type) { return type != OPT_GLOBAL; }
971
 
  bool check_update_type(Item_result type __attribute__((__unused__)))
 
971
  bool check_update_type(Item_result type __attribute__((unused)))
972
972
  { return 1; }
973
973
  SHOW_TYPE show_type() { return SHOW_CHAR; }
974
974
  bool is_readonly() const { return 1; }
1024
1024
  {
1025
1025
    return type != STRING_RESULT;               /* Only accept strings */
1026
1026
  }
1027
 
  bool check_default(enum_var_type type __attribute__((__unused__)))
 
1027
  bool check_default(enum_var_type type __attribute__((unused)))
1028
1028
  { return 0; }
1029
1029
  bool update(THD *thd, set_var *var);
1030
1030
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
1058
1058
                       uint64_t SV::*offset_arg):
1059
1059
    sys_var_thd(name_arg), offset(offset_arg)
1060
1060
  { chain_sys_var(chain); }
1061
 
  bool check(THD *thd __attribute__((__unused__)),
1062
 
             set_var *var __attribute__((__unused__))) {return 0;}
 
1061
  bool check(THD *thd __attribute__((unused)),
 
1062
             set_var *var __attribute__((unused))) {return 0;}
1063
1063
  bool update(THD *thd, set_var *var);
1064
1064
  void set_default(THD *thd, enum_var_type type);
1065
1065
  SHOW_TYPE show_type() { return SHOW_DOUBLE; }
1103
1103
  {
1104
1104
    return ((type != STRING_RESULT) && (type != INT_RESULT));
1105
1105
  }
1106
 
  bool check_default(enum_var_type type __attribute__((__unused__)))
 
1106
  bool check_default(enum_var_type type __attribute__((unused)))
1107
1107
  { return 0; }
1108
1108
  bool update(THD *thd, set_var *var);
1109
1109
  uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);