~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item/func.h

MergedĀ inĀ trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
#ifndef DRIZZLED_SERVER_ITEM_FUNC_H
21
21
#define DRIZZLED_SERVER_ITEM_FUNC_H
22
22
 
23
 
/* Function items used by mysql */
24
 
 
25
 
#ifdef USE_PRAGMA_INTERFACE
26
 
#pragma interface                       /* gcc class implementation */
27
 
#endif
28
 
 
29
 
#ifdef HAVE_IEEEFP_H
30
 
extern "C"                              /* Bug in BSDI include file */
31
 
{
32
 
#include <ieeefp.h>
33
 
}
34
 
#endif
35
 
 
36
 
class Item_func :public Item_result_field
37
 
{
38
 
protected:
39
 
  Item **args, *tmp_arg[2];
40
 
  /*
41
 
    Allowed numbers of columns in result (usually 1, which means scalar value)
42
 
    0 means get this number from first argument
43
 
  */
44
 
  uint32_t allowed_arg_cols;
45
 
public:
46
 
  uint32_t arg_count;
47
 
  table_map used_tables_cache, not_null_tables_cache;
48
 
  bool const_item_cache;
49
 
  enum Functype { UNKNOWN_FUNC,EQ_FUNC,EQUAL_FUNC,NE_FUNC,LT_FUNC,LE_FUNC,
50
 
                  GE_FUNC,GT_FUNC,
51
 
                  LIKE_FUNC,ISNULL_FUNC,ISNOTNULL_FUNC,
52
 
                  COND_AND_FUNC, COND_OR_FUNC, COND_XOR_FUNC,
53
 
                  BETWEEN, IN_FUNC, MULT_EQUAL_FUNC,
54
 
                  INTERVAL_FUNC, ISNOTNULLTEST_FUNC,
55
 
                  NOT_FUNC, NOT_ALL_FUNC,
56
 
                  NOW_FUNC, TRIG_COND_FUNC,
57
 
                  SUSERVAR_FUNC, GUSERVAR_FUNC, COLLATE_FUNC,
58
 
                  EXTRACT_FUNC, CHAR_TYPECAST_FUNC, FUNC_SP,
59
 
                  NEG_FUNC };
60
 
  enum optimize_type { OPTIMIZE_NONE,OPTIMIZE_KEY,OPTIMIZE_OP, OPTIMIZE_NULL,
61
 
                       OPTIMIZE_EQUAL };
62
 
  enum Type type() const { return FUNC_ITEM; }
63
 
  virtual enum Functype functype() const   { return UNKNOWN_FUNC; }
64
 
  Item_func(void):
65
 
    allowed_arg_cols(1), arg_count(0)
66
 
  {
67
 
    with_sum_func= 0;
68
 
  }
69
 
  Item_func(Item *a):
70
 
    allowed_arg_cols(1), arg_count(1)
71
 
  {
72
 
    args= tmp_arg;
73
 
    args[0]= a;
74
 
    with_sum_func= a->with_sum_func;
75
 
  }
76
 
  Item_func(Item *a,Item *b):
77
 
    allowed_arg_cols(1), arg_count(2)
78
 
  {
79
 
    args= tmp_arg;
80
 
    args[0]= a; args[1]= b;
81
 
    with_sum_func= a->with_sum_func || b->with_sum_func;
82
 
  }
83
 
  Item_func(Item *a,Item *b,Item *c):
84
 
    allowed_arg_cols(1)
85
 
  {
86
 
    arg_count= 0;
87
 
    if ((args= (Item**) sql_alloc(sizeof(Item*)*3)))
88
 
    {
89
 
      arg_count= 3;
90
 
      args[0]= a; args[1]= b; args[2]= c;
91
 
      with_sum_func= a->with_sum_func || b->with_sum_func || c->with_sum_func;
92
 
    }
93
 
  }
94
 
  Item_func(Item *a,Item *b,Item *c,Item *d):
95
 
    allowed_arg_cols(1)
96
 
  {
97
 
    arg_count= 0;
98
 
    if ((args= (Item**) sql_alloc(sizeof(Item*)*4)))
99
 
    {
100
 
      arg_count= 4;
101
 
      args[0]= a; args[1]= b; args[2]= c; args[3]= d;
102
 
      with_sum_func= a->with_sum_func || b->with_sum_func ||
103
 
        c->with_sum_func || d->with_sum_func;
104
 
    }
105
 
  }
106
 
  Item_func(Item *a,Item *b,Item *c,Item *d,Item* e):
107
 
    allowed_arg_cols(1)
108
 
  {
109
 
    arg_count= 5;
110
 
    if ((args= (Item**) sql_alloc(sizeof(Item*)*5)))
111
 
    {
112
 
      args[0]= a; args[1]= b; args[2]= c; args[3]= d; args[4]= e;
113
 
      with_sum_func= a->with_sum_func || b->with_sum_func ||
114
 
        c->with_sum_func || d->with_sum_func || e->with_sum_func ;
115
 
    }
116
 
  }
117
 
  Item_func(List<Item> &list);
118
 
  // Constructor used for Item_cond_and/or (see Item comment)
119
 
  Item_func(THD *thd, Item_func *item);
120
 
  bool fix_fields(THD *, Item **ref);
121
 
  void fix_after_pullout(st_select_lex *new_parent, Item **ref);
122
 
  table_map used_tables() const;
123
 
  table_map not_null_tables() const;
124
 
  void update_used_tables();
125
 
  bool eq(const Item *item, bool binary_cmp) const;
126
 
  virtual optimize_type select_optimize() const { return OPTIMIZE_NONE; }
127
 
  virtual bool have_rev_func() const { return 0; }
128
 
  virtual Item *key_item() const { return args[0]; }
129
 
  /*
130
 
    This method is used for debug purposes to print the name of an
131
 
    item to the debug log. The second use of this method is as
132
 
    a helper function of print(), where it is applicable.
133
 
    To suit both goals it should return a meaningful,
134
 
    distinguishable and sintactically correct string.  This method
135
 
    should not be used for runtime type identification, use enum
136
 
    {Sum}Functype and Item_func::functype()/Item_sum::sum_func()
137
 
    instead.
138
 
  */
139
 
  virtual const char *func_name() const { return NULL; };
140
 
  virtual bool const_item() const { return const_item_cache; }
141
 
  inline Item **arguments() const { return args; }
142
 
  void set_arguments(List<Item> &list);
143
 
  inline uint32_t argument_count() const { return arg_count; }
144
 
  inline void remove_arguments() { arg_count=0; }
145
 
  void split_sum_func(THD *thd, Item **ref_pointer_array, List<Item> &fields);
146
 
  virtual void print(String *str, enum_query_type query_type);
147
 
  void print_op(String *str, enum_query_type query_type);
148
 
  void print_args(String *str, uint32_t from, enum_query_type query_type);
149
 
  virtual void fix_num_length_and_dec();
150
 
  void count_only_length();
151
 
  void count_real_length();
152
 
  void count_decimal_length();
153
 
  inline bool get_arg0_date(DRIZZLE_TIME *ltime, uint32_t fuzzy_date)
154
 
  {
155
 
    return (null_value=args[0]->get_date(ltime, fuzzy_date));
156
 
  }
157
 
  inline bool get_arg0_time(DRIZZLE_TIME *ltime)
158
 
  {
159
 
    return (null_value=args[0]->get_time(ltime));
160
 
  }
161
 
  bool is_null() { 
162
 
    update_null_value();
163
 
    return null_value; 
164
 
  }
165
 
  void signal_divide_by_null();
166
 
 
167
 
  Field *tmp_table_field() { return result_field; }
168
 
  Field *tmp_table_field(Table *t_arg);
169
 
  Item *get_tmp_table_item(THD *thd);
170
 
 
171
 
  my_decimal *val_decimal(my_decimal *);
172
 
 
173
 
  bool agg_arg_collations(DTCollation &c, Item **items, uint32_t nitems,
174
 
                          uint32_t flags)
175
 
  {
176
 
    return agg_item_collations(c, func_name(), items, nitems, flags, 1);
177
 
  }
178
 
  bool agg_arg_collations_for_comparison(DTCollation &c,
179
 
                                         Item **items, uint32_t nitems,
180
 
                                         uint32_t flags)
181
 
  {
182
 
    return agg_item_collations_for_comparison(c, func_name(),
183
 
                                              items, nitems, flags);
184
 
  }
185
 
  bool agg_arg_charsets(DTCollation &c, Item **items, uint32_t nitems,
186
 
                        uint32_t flags, int item_sep)
187
 
  {
188
 
    return agg_item_charsets(c, func_name(), items, nitems, flags, item_sep);
189
 
  }
190
 
  bool walk(Item_processor processor, bool walk_subquery, unsigned char *arg);
191
 
  Item *transform(Item_transformer transformer, unsigned char *arg);
192
 
  Item* compile(Item_analyzer analyzer, unsigned char **arg_p,
193
 
                Item_transformer transformer, unsigned char *arg_t);
194
 
  void traverse_cond(Cond_traverser traverser,
195
 
                     void * arg, traverse_order order);
196
 
  inline double fix_result(double value)
197
 
  {
198
 
    if (isfinite(value))
199
 
      return value;
200
 
    null_value=1;
201
 
    return 0.0;
202
 
  }
203
 
};
204
 
 
205
 
 
206
 
class Item_real_func :public Item_func
207
 
{
208
 
public:
209
 
  Item_real_func() :Item_func() {}
210
 
  Item_real_func(Item *a) :Item_func(a) {}
211
 
  Item_real_func(Item *a,Item *b) :Item_func(a,b) {}
212
 
  Item_real_func(List<Item> &list) :Item_func(list) {}
213
 
  String *val_str(String*str);
214
 
  my_decimal *val_decimal(my_decimal *decimal_value);
215
 
  int64_t val_int()
216
 
    { assert(fixed == 1); return (int64_t) rint(val_real()); }
217
 
  enum Item_result result_type () const { return REAL_RESULT; }
218
 
  void fix_length_and_dec()
219
 
  { decimals= NOT_FIXED_DEC; max_length= float_length(decimals); }
220
 
};
221
 
 
222
 
 
223
 
class Item_func_numhybrid: public Item_func
224
 
{
225
 
protected:
226
 
  Item_result hybrid_type;
227
 
public:
228
 
  Item_func_numhybrid(Item *a) :Item_func(a), hybrid_type(REAL_RESULT)
229
 
  {}
230
 
  Item_func_numhybrid(Item *a,Item *b)
231
 
    :Item_func(a,b), hybrid_type(REAL_RESULT)
232
 
  {}
233
 
  Item_func_numhybrid(List<Item> &list)
234
 
    :Item_func(list), hybrid_type(REAL_RESULT)
235
 
  {}
236
 
 
237
 
  enum Item_result result_type () const { return hybrid_type; }
238
 
  void fix_length_and_dec();
239
 
  void fix_num_length_and_dec();
240
 
  virtual void find_num_type()= 0; /* To be called from fix_length_and_dec */
241
 
 
242
 
  double val_real();
243
 
  int64_t val_int();
244
 
  my_decimal *val_decimal(my_decimal *);
245
 
  String *val_str(String*str);
246
 
 
247
 
  /**
248
 
     @brief Performs the operation that this functions implements when the
249
 
     result type is INT.
250
 
 
251
 
     @return The result of the operation.
252
 
  */
253
 
  virtual int64_t int_op()= 0;
254
 
 
255
 
  /**
256
 
     @brief Performs the operation that this functions implements when the
257
 
     result type is REAL.
258
 
 
259
 
     @return The result of the operation.
260
 
  */
261
 
  virtual double real_op()= 0;
262
 
 
263
 
  /**
264
 
     @brief Performs the operation that this functions implements when the
265
 
     result type is DECIMAL.
266
 
 
267
 
     @param A pointer where the DECIMAL value will be allocated.
268
 
     @return 
269
 
       - 0 If the result is NULL
270
 
       - The same pointer it was given, with the area initialized to the
271
 
         result of the operation.
272
 
  */
273
 
  virtual my_decimal *decimal_op(my_decimal *)= 0;
274
 
 
275
 
  /**
276
 
     @brief Performs the operation that this functions implements when the
277
 
     result type is a string type.
278
 
 
279
 
     @return The result of the operation.
280
 
  */
281
 
  virtual String *str_op(String *)= 0;
282
 
  bool is_null() { update_null_value(); return null_value; }
283
 
};
284
 
 
285
 
/* function where type of result detected by first argument */
286
 
class Item_func_num1: public Item_func_numhybrid
287
 
{
288
 
public:
289
 
  Item_func_num1(Item *a) :Item_func_numhybrid(a) {}
290
 
  Item_func_num1(Item *a, Item *b) :Item_func_numhybrid(a, b) {}
291
 
 
292
 
  void fix_num_length_and_dec();
293
 
  void find_num_type();
294
 
  String *str_op(String *str __attribute__((unused)))
295
 
  { assert(0); return 0; }
296
 
};
297
 
 
298
 
 
299
 
/* Base class for operations like '+', '-', '*' */
300
 
class Item_num_op :public Item_func_numhybrid
301
 
{
302
 
 public:
303
 
  Item_num_op(Item *a,Item *b) :Item_func_numhybrid(a, b) {}
304
 
  virtual void result_precision()= 0;
305
 
 
306
 
  virtual inline void print(String *str, enum_query_type query_type)
307
 
  {
308
 
    print_op(str, query_type);
309
 
  }
310
 
 
311
 
  void find_num_type();
312
 
  String *str_op(String *str __attribute__((unused)))
313
 
  { assert(0); return 0; }
314
 
};
315
 
 
316
 
 
317
 
class Item_int_func :public Item_func
318
 
{
319
 
public:
320
 
  Item_int_func() :Item_func() { max_length= 21; }
321
 
  Item_int_func(Item *a) :Item_func(a) { max_length= 21; }
322
 
  Item_int_func(Item *a,Item *b) :Item_func(a,b) { max_length= 21; }
323
 
  Item_int_func(Item *a,Item *b,Item *c) :Item_func(a,b,c)
324
 
  { max_length= 21; }
325
 
  Item_int_func(List<Item> &list) :Item_func(list) { max_length= 21; }
326
 
  Item_int_func(THD *thd, Item_int_func *item) :Item_func(thd, item) {}
327
 
  double val_real();
328
 
  String *val_str(String*str);
329
 
  enum Item_result result_type () const { return INT_RESULT; }
330
 
  void fix_length_and_dec() {}
331
 
};
332
 
 
333
 
 
334
 
class Item_func_connection_id :public Item_int_func
335
 
{
336
 
  int64_t value;
337
 
 
338
 
public:
339
 
  Item_func_connection_id() {}
340
 
  const char *func_name() const { return "connection_id"; }
341
 
  void fix_length_and_dec();
342
 
  bool fix_fields(THD *thd, Item **ref);
343
 
  int64_t val_int() { assert(fixed == 1); return value; }
344
 
};
345
 
 
346
 
 
347
 
class Item_func_signed :public Item_int_func
348
 
{
349
 
public:
350
 
  Item_func_signed(Item *a) :Item_int_func(a) {}
351
 
  const char *func_name() const { return "cast_as_signed"; }
352
 
  int64_t val_int();
353
 
  int64_t val_int_from_str(int *error);
354
 
  void fix_length_and_dec()
355
 
  { max_length=args[0]->max_length; unsigned_flag=0; }
356
 
  virtual void print(String *str, enum_query_type query_type);
357
 
  uint32_t decimal_precision() const { return args[0]->decimal_precision(); }
358
 
};
359
 
 
360
 
 
361
 
class Item_func_unsigned :public Item_func_signed
362
 
{
363
 
public:
364
 
  Item_func_unsigned(Item *a) :Item_func_signed(a) {}
365
 
  const char *func_name() const { return "cast_as_unsigned"; }
366
 
  void fix_length_and_dec()
367
 
  { max_length=args[0]->max_length; unsigned_flag=1; }
368
 
  int64_t val_int();
369
 
  virtual void print(String *str, enum_query_type query_type);
370
 
};
371
 
 
372
 
 
373
 
class Item_decimal_typecast :public Item_func
374
 
{
375
 
  my_decimal decimal_value;
376
 
public:
377
 
  Item_decimal_typecast(Item *a, int len, int dec) :Item_func(a)
378
 
  {
379
 
    decimals= dec;
380
 
    max_length= my_decimal_precision_to_length(len, dec, unsigned_flag);
381
 
  }
382
 
  String *val_str(String *str);
383
 
  double val_real();
384
 
  int64_t val_int();
385
 
  my_decimal *val_decimal(my_decimal*);
386
 
  enum Item_result result_type () const { return DECIMAL_RESULT; }
387
 
  enum_field_types field_type() const { return DRIZZLE_TYPE_NEWDECIMAL; }
388
 
  void fix_length_and_dec() {};
389
 
  const char *func_name() const { return "decimal_typecast"; }
390
 
  virtual void print(String *str, enum_query_type query_type);
391
 
};
392
 
 
393
 
 
394
 
class Item_func_additive_op :public Item_num_op
395
 
{
396
 
public:
397
 
  Item_func_additive_op(Item *a,Item *b) :Item_num_op(a,b) {}
398
 
  void result_precision();
399
 
};
400
 
 
401
 
 
402
 
class Item_func_plus :public Item_func_additive_op
403
 
{
404
 
public:
405
 
  Item_func_plus(Item *a,Item *b) :Item_func_additive_op(a,b) {}
406
 
  const char *func_name() const { return "+"; }
407
 
  int64_t int_op();
408
 
  double real_op();
409
 
  my_decimal *decimal_op(my_decimal *);
410
 
};
411
 
 
412
 
class Item_func_minus :public Item_func_additive_op
413
 
{
414
 
public:
415
 
  Item_func_minus(Item *a,Item *b) :Item_func_additive_op(a,b) {}
416
 
  const char *func_name() const { return "-"; }
417
 
  int64_t int_op();
418
 
  double real_op();
419
 
  my_decimal *decimal_op(my_decimal *);
420
 
  void fix_length_and_dec();
421
 
};
422
 
 
423
 
 
424
 
class Item_func_mul :public Item_num_op
425
 
{
426
 
public:
427
 
  Item_func_mul(Item *a,Item *b) :Item_num_op(a,b) {}
428
 
  const char *func_name() const { return "*"; }
429
 
  int64_t int_op();
430
 
  double real_op();
431
 
  my_decimal *decimal_op(my_decimal *);
432
 
  void result_precision();
433
 
};
434
 
 
435
 
 
436
 
class Item_func_div :public Item_num_op
437
 
{
438
 
public:
439
 
  uint32_t prec_increment;
440
 
  Item_func_div(Item *a,Item *b) :Item_num_op(a,b) {}
441
 
  int64_t int_op() { assert(0); return 0; }
442
 
  double real_op();
443
 
  my_decimal *decimal_op(my_decimal *);
444
 
  const char *func_name() const { return "/"; }
445
 
  void fix_length_and_dec();
446
 
  void result_precision();
447
 
};
448
 
 
449
 
 
450
 
class Item_func_int_div :public Item_int_func
451
 
{
452
 
public:
453
 
  Item_func_int_div(Item *a,Item *b) :Item_int_func(a,b)
454
 
  {}
455
 
  int64_t val_int();
456
 
  const char *func_name() const { return "DIV"; }
457
 
  void fix_length_and_dec();
458
 
 
459
 
  virtual inline void print(String *str, enum_query_type query_type)
460
 
  {
461
 
    print_op(str, query_type);
462
 
  }
463
 
 
464
 
};
465
 
 
466
 
 
467
 
class Item_func_mod :public Item_num_op
468
 
{
469
 
public:
470
 
  Item_func_mod(Item *a,Item *b) :Item_num_op(a,b) {}
471
 
  int64_t int_op();
472
 
  double real_op();
473
 
  my_decimal *decimal_op(my_decimal *);
474
 
  const char *func_name() const { return "%"; }
475
 
  void result_precision();
476
 
  void fix_length_and_dec();
477
 
};
478
 
 
479
 
 
480
 
class Item_func_neg :public Item_func_num1
481
 
{
482
 
public:
483
 
  Item_func_neg(Item *a) :Item_func_num1(a) {}
484
 
  double real_op();
485
 
  int64_t int_op();
486
 
  my_decimal *decimal_op(my_decimal *);
487
 
  const char *func_name() const { return "-"; }
488
 
  enum Functype functype() const   { return NEG_FUNC; }
489
 
  void fix_length_and_dec();
490
 
  void fix_num_length_and_dec();
491
 
  uint32_t decimal_precision() const { return args[0]->decimal_precision(); }
492
 
};
493
 
 
494
 
 
495
 
class Item_func_abs :public Item_func_num1
496
 
{
497
 
public:
498
 
  Item_func_abs(Item *a) :Item_func_num1(a) {}
499
 
  double real_op();
500
 
  int64_t int_op();
501
 
  my_decimal *decimal_op(my_decimal *);
502
 
  const char *func_name() const { return "abs"; }
503
 
  void fix_length_and_dec();
504
 
};
505
 
 
506
 
// A class to handle logarithmic and trigonometric functions
507
 
 
508
 
class Item_dec_func :public Item_real_func
509
 
{
510
 
 public:
511
 
  Item_dec_func(Item *a) :Item_real_func(a) {}
512
 
  Item_dec_func(Item *a,Item *b) :Item_real_func(a,b) {}
513
 
  void fix_length_and_dec()
514
 
  {
515
 
    decimals=NOT_FIXED_DEC; max_length=float_length(decimals);
516
 
    maybe_null=1;
517
 
  }
518
 
};
519
 
 
520
 
class Item_func_exp :public Item_dec_func
521
 
{
522
 
public:
523
 
  Item_func_exp(Item *a) :Item_dec_func(a) {}
524
 
  double val_real();
525
 
  const char *func_name() const { return "exp"; }
526
 
};
527
 
 
528
 
 
529
 
class Item_func_ln :public Item_dec_func
530
 
{
531
 
public:
532
 
  Item_func_ln(Item *a) :Item_dec_func(a) {}
533
 
  double val_real();
534
 
  const char *func_name() const { return "ln"; }
535
 
};
536
 
 
537
 
 
538
 
class Item_func_log :public Item_dec_func
539
 
{
540
 
public:
541
 
  Item_func_log(Item *a) :Item_dec_func(a) {}
542
 
  Item_func_log(Item *a,Item *b) :Item_dec_func(a,b) {}
543
 
  double val_real();
544
 
  const char *func_name() const { return "log"; }
545
 
};
546
 
 
547
 
 
548
 
class Item_func_log2 :public Item_dec_func
549
 
{
550
 
public:
551
 
  Item_func_log2(Item *a) :Item_dec_func(a) {}
552
 
  double val_real();
553
 
  const char *func_name() const { return "log2"; }
554
 
};
555
 
 
556
 
 
557
 
class Item_func_log10 :public Item_dec_func
558
 
{
559
 
public:
560
 
  Item_func_log10(Item *a) :Item_dec_func(a) {}
561
 
  double val_real();
562
 
  const char *func_name() const { return "log10"; }
563
 
};
564
 
 
565
 
 
566
 
class Item_func_sqrt :public Item_dec_func
567
 
{
568
 
public:
569
 
  Item_func_sqrt(Item *a) :Item_dec_func(a) {}
570
 
  double val_real();
571
 
  const char *func_name() const { return "sqrt"; }
572
 
};
573
 
 
574
 
 
575
 
class Item_func_pow :public Item_dec_func
576
 
{
577
 
public:
578
 
  Item_func_pow(Item *a,Item *b) :Item_dec_func(a,b) {}
579
 
  double val_real();
580
 
  const char *func_name() const { return "pow"; }
581
 
};
582
 
 
583
 
 
584
 
class Item_func_acos :public Item_dec_func
585
 
{
586
 
public:
587
 
  Item_func_acos(Item *a) :Item_dec_func(a) {}
588
 
  double val_real();
589
 
  const char *func_name() const { return "acos"; }
590
 
};
591
 
 
592
 
class Item_func_asin :public Item_dec_func
593
 
{
594
 
public:
595
 
  Item_func_asin(Item *a) :Item_dec_func(a) {}
596
 
  double val_real();
597
 
  const char *func_name() const { return "asin"; }
598
 
};
599
 
 
600
 
class Item_func_atan :public Item_dec_func
601
 
{
602
 
public:
603
 
  Item_func_atan(Item *a) :Item_dec_func(a) {}
604
 
  Item_func_atan(Item *a,Item *b) :Item_dec_func(a,b) {}
605
 
  double val_real();
606
 
  const char *func_name() const { return "atan"; }
607
 
};
608
 
 
609
 
class Item_func_cos :public Item_dec_func
610
 
{
611
 
public:
612
 
  Item_func_cos(Item *a) :Item_dec_func(a) {}
613
 
  double val_real();
614
 
  const char *func_name() const { return "cos"; }
615
 
};
616
 
 
617
 
class Item_func_sin :public Item_dec_func
618
 
{
619
 
public:
620
 
  Item_func_sin(Item *a) :Item_dec_func(a) {}
621
 
  double val_real();
622
 
  const char *func_name() const { return "sin"; }
623
 
};
624
 
 
625
 
class Item_func_tan :public Item_dec_func
626
 
{
627
 
public:
628
 
  Item_func_tan(Item *a) :Item_dec_func(a) {}
629
 
  double val_real();
630
 
  const char *func_name() const { return "tan"; }
631
 
};
632
 
 
633
 
class Item_func_integer :public Item_int_func
634
 
{
635
 
public:
636
 
  inline Item_func_integer(Item *a) :Item_int_func(a) {}
637
 
  void fix_length_and_dec();
638
 
};
639
 
 
640
 
 
641
 
class Item_func_int_val :public Item_func_num1
642
 
{
643
 
public:
644
 
  Item_func_int_val(Item *a) :Item_func_num1(a) {}
645
 
  void fix_num_length_and_dec();
646
 
  void find_num_type();
647
 
};
648
 
 
649
 
 
650
 
class Item_func_ceiling :public Item_func_int_val
651
 
{
652
 
public:
653
 
  Item_func_ceiling(Item *a) :Item_func_int_val(a) {}
654
 
  const char *func_name() const { return "ceiling"; }
655
 
  int64_t int_op();
656
 
  double real_op();
657
 
  my_decimal *decimal_op(my_decimal *);
658
 
};
659
 
 
660
 
 
661
 
class Item_func_floor :public Item_func_int_val
662
 
{
663
 
public:
664
 
  Item_func_floor(Item *a) :Item_func_int_val(a) {}
665
 
  const char *func_name() const { return "floor"; }
666
 
  int64_t int_op();
667
 
  double real_op();
668
 
  my_decimal *decimal_op(my_decimal *);
669
 
};
670
 
 
671
 
/* This handles round and truncate */
672
 
 
673
 
class Item_func_round :public Item_func_num1
674
 
{
675
 
  bool truncate;
676
 
public:
677
 
  Item_func_round(Item *a, Item *b, bool trunc_arg)
678
 
    :Item_func_num1(a,b), truncate(trunc_arg) {}
679
 
  const char *func_name() const { return truncate ? "truncate" : "round"; }
680
 
  double real_op();
681
 
  int64_t int_op();
682
 
  my_decimal *decimal_op(my_decimal *);
683
 
  void fix_length_and_dec();
684
 
};
685
 
 
686
 
 
687
 
class Item_func_rand :public Item_real_func
688
 
{
689
 
  struct rand_struct *rand;
690
 
public:
691
 
  Item_func_rand(Item *a) :Item_real_func(a), rand(0) {}
692
 
  Item_func_rand()        :Item_real_func() {}
693
 
  double val_real();
694
 
  const char *func_name() const { return "rand"; }
695
 
  bool const_item() const { return 0; }
696
 
  void update_used_tables();
697
 
  bool fix_fields(THD *thd, Item **ref);
698
 
private:
699
 
  void seed_random (Item * val);  
700
 
};
701
 
 
702
 
 
703
 
class Item_func_sign :public Item_int_func
704
 
{
705
 
public:
706
 
  Item_func_sign(Item *a) :Item_int_func(a) {}
707
 
  const char *func_name() const { return "sign"; }
708
 
  int64_t val_int();
709
 
};
710
 
 
711
 
 
712
 
class Item_func_units :public Item_real_func
713
 
{
714
 
  char *name;
715
 
  double mul,add;
716
 
public:
717
 
  Item_func_units(char *name_arg,Item *a,double mul_arg,double add_arg)
718
 
    :Item_real_func(a),name(name_arg),mul(mul_arg),add(add_arg) {}
719
 
  double val_real();
720
 
  const char *func_name() const { return name; }
721
 
  void fix_length_and_dec()
722
 
  { decimals= NOT_FIXED_DEC; max_length= float_length(decimals); }
723
 
};
724
 
 
725
 
 
726
 
class Item_func_min_max :public Item_func
727
 
{
728
 
  Item_result cmp_type;
729
 
  String tmp_value;
730
 
  int cmp_sign;
731
 
  /* TRUE <=> arguments should be compared in the DATETIME context. */
732
 
  bool compare_as_dates;
733
 
  /* An item used for issuing warnings while string to DATETIME conversion. */
734
 
  Item *datetime_item;
735
 
  THD *thd;
736
 
protected:
737
 
  enum_field_types cached_field_type;
738
 
public:
739
 
  Item_func_min_max(List<Item> &list,int cmp_sign_arg) :Item_func(list),
740
 
    cmp_type(INT_RESULT), cmp_sign(cmp_sign_arg), compare_as_dates(false),
741
 
    datetime_item(0) {}
742
 
  double val_real();
743
 
  int64_t val_int();
744
 
  String *val_str(String *);
745
 
  my_decimal *val_decimal(my_decimal *);
746
 
  void fix_length_and_dec();
747
 
  enum Item_result result_type () const { return cmp_type; }
748
 
  bool result_as_int64_t() { return compare_as_dates; };
749
 
  uint32_t cmp_datetimes(uint64_t *value);
750
 
  enum_field_types field_type() const { return cached_field_type; }
751
 
};
752
 
 
753
 
class Item_func_min :public Item_func_min_max
754
 
{
755
 
public:
756
 
  Item_func_min(List<Item> &list) :Item_func_min_max(list,1) {}
757
 
  const char *func_name() const { return "least"; }
758
 
};
759
 
 
760
 
class Item_func_max :public Item_func_min_max
761
 
{
762
 
public:
763
 
  Item_func_max(List<Item> &list) :Item_func_min_max(list,-1) {}
764
 
  const char *func_name() const { return "greatest"; }
765
 
};
766
 
 
767
 
 
768
 
/* 
769
 
  Objects of this class are used for ROLLUP queries to wrap up 
770
 
  each constant item referred to in GROUP BY list. 
771
 
*/
772
 
 
773
 
class Item_func_rollup_const :public Item_func
774
 
{
775
 
public:
776
 
  Item_func_rollup_const(Item *a) :Item_func(a)
777
 
  {
778
 
    name= a->name;
779
 
    name_length= a->name_length;
780
 
  }
781
 
  double val_real() { return args[0]->val_real(); }
782
 
  int64_t val_int() { return args[0]->val_int(); }
783
 
  String *val_str(String *str) { return args[0]->val_str(str); }
784
 
  my_decimal *val_decimal(my_decimal *dec) { return args[0]->val_decimal(dec); }
785
 
  const char *func_name() const { return "rollup_const"; }
786
 
  bool const_item() const { return 0; }
787
 
  Item_result result_type() const { return args[0]->result_type(); }
788
 
  void fix_length_and_dec()
789
 
  {
790
 
    collation= args[0]->collation;
791
 
    max_length= args[0]->max_length;
792
 
    decimals=args[0]->decimals; 
793
 
    /* The item could be a NULL constant. */
794
 
    null_value= args[0]->is_null();
795
 
  }
796
 
};
797
 
 
798
 
 
799
 
class Item_func_length :public Item_int_func
800
 
{
801
 
  String value;
802
 
public:
803
 
  Item_func_length(Item *a) :Item_int_func(a) {}
804
 
  int64_t val_int();
805
 
  const char *func_name() const { return "length"; }
806
 
  void fix_length_and_dec() { max_length=10; }
807
 
};
808
 
 
809
 
class Item_func_bit_length :public Item_func_length
810
 
{
811
 
public:
812
 
  Item_func_bit_length(Item *a) :Item_func_length(a) {}
813
 
  int64_t val_int()
814
 
    { assert(fixed == 1); return Item_func_length::val_int()*8; }
815
 
  const char *func_name() const { return "bit_length"; }
816
 
};
817
 
 
818
 
class Item_func_char_length :public Item_int_func
819
 
{
820
 
  String value;
821
 
public:
822
 
  Item_func_char_length(Item *a) :Item_int_func(a) {}
823
 
  int64_t val_int();
824
 
  const char *func_name() const { return "char_length"; }
825
 
  void fix_length_and_dec() { max_length=10; }
826
 
};
827
 
 
828
 
class Item_func_coercibility :public Item_int_func
829
 
{
830
 
public:
831
 
  Item_func_coercibility(Item *a) :Item_int_func(a) {}
832
 
  int64_t val_int();
833
 
  const char *func_name() const { return "coercibility"; }
834
 
  void fix_length_and_dec() { max_length=10; maybe_null= 0; }
835
 
  table_map not_null_tables() const { return 0; }
836
 
};
837
 
 
838
 
class Item_func_locate :public Item_int_func
839
 
{
840
 
  String value1,value2;
841
 
  DTCollation cmp_collation;
842
 
public:
843
 
  Item_func_locate(Item *a,Item *b) :Item_int_func(a,b) {}
844
 
  Item_func_locate(Item *a,Item *b,Item *c) :Item_int_func(a,b,c) {}
845
 
  const char *func_name() const { return "locate"; }
846
 
  int64_t val_int();
847
 
  void fix_length_and_dec();
848
 
  virtual void print(String *str, enum_query_type query_type);
849
 
};
850
 
 
851
 
 
852
 
class Item_func_field :public Item_int_func
853
 
{
854
 
  String value,tmp;
855
 
  Item_result cmp_type;
856
 
  DTCollation cmp_collation;
857
 
public:
858
 
  Item_func_field(List<Item> &list) :Item_int_func(list) {}
859
 
  int64_t val_int();
860
 
  const char *func_name() const { return "field"; }
861
 
  void fix_length_and_dec();
862
 
};
863
 
 
864
 
 
865
 
class Item_func_ascii :public Item_int_func
866
 
{
867
 
  String value;
868
 
public:
869
 
  Item_func_ascii(Item *a) :Item_int_func(a) {}
870
 
  int64_t val_int();
871
 
  const char *func_name() const { return "ascii"; }
872
 
  void fix_length_and_dec() { max_length=3; }
873
 
};
874
 
 
875
 
class Item_func_ord :public Item_int_func
876
 
{
877
 
  String value;
878
 
public:
879
 
  Item_func_ord(Item *a) :Item_int_func(a) {}
880
 
  int64_t val_int();
881
 
  const char *func_name() const { return "ord"; }
882
 
};
883
 
 
884
 
class Item_func_find_in_set :public Item_int_func
885
 
{
886
 
  String value,value2;
887
 
  uint32_t enum_value;
888
 
  uint64_t enum_bit;
889
 
  DTCollation cmp_collation;
890
 
public:
891
 
  Item_func_find_in_set(Item *a,Item *b) :Item_int_func(a,b),enum_value(0) {}
892
 
  int64_t val_int();
893
 
  const char *func_name() const { return "find_in_set"; }
894
 
  void fix_length_and_dec();
895
 
};
896
 
 
897
 
/* Base class for all bit functions: '~', '|', '^', '&', '>>', '<<' */
898
 
 
899
 
class Item_func_bit: public Item_int_func
900
 
{
901
 
public:
902
 
  Item_func_bit(Item *a, Item *b) :Item_int_func(a, b) {}
903
 
  Item_func_bit(Item *a) :Item_int_func(a) {}
904
 
  void fix_length_and_dec() { unsigned_flag= 1; }
905
 
 
906
 
  virtual inline void print(String *str, enum_query_type query_type)
907
 
  {
908
 
    print_op(str, query_type);
909
 
  }
910
 
};
911
 
 
912
 
class Item_func_bit_or :public Item_func_bit
913
 
{
914
 
public:
915
 
  Item_func_bit_or(Item *a, Item *b) :Item_func_bit(a, b) {}
916
 
  int64_t val_int();
917
 
  const char *func_name() const { return "|"; }
918
 
};
919
 
 
920
 
class Item_func_bit_and :public Item_func_bit
921
 
{
922
 
public:
923
 
  Item_func_bit_and(Item *a, Item *b) :Item_func_bit(a, b) {}
924
 
  int64_t val_int();
925
 
  const char *func_name() const { return "&"; }
926
 
};
927
 
 
928
 
class Item_func_bit_count :public Item_int_func
929
 
{
930
 
public:
931
 
  Item_func_bit_count(Item *a) :Item_int_func(a) {}
932
 
  int64_t val_int();
933
 
  const char *func_name() const { return "bit_count"; }
934
 
  void fix_length_and_dec() { max_length=2; }
935
 
};
936
 
 
937
 
class Item_func_shift_left :public Item_func_bit
938
 
{
939
 
public:
940
 
  Item_func_shift_left(Item *a, Item *b) :Item_func_bit(a, b) {}
941
 
  int64_t val_int();
942
 
  const char *func_name() const { return "<<"; }
943
 
};
944
 
 
945
 
class Item_func_shift_right :public Item_func_bit
946
 
{
947
 
public:
948
 
  Item_func_shift_right(Item *a, Item *b) :Item_func_bit(a, b) {}
949
 
  int64_t val_int();
950
 
  const char *func_name() const { return ">>"; }
951
 
};
952
 
 
953
 
class Item_func_bit_neg :public Item_func_bit
954
 
{
955
 
public:
956
 
  Item_func_bit_neg(Item *a) :Item_func_bit(a) {}
957
 
  int64_t val_int();
958
 
  const char *func_name() const { return "~"; }
959
 
 
960
 
  virtual inline void print(String *str, enum_query_type query_type)
961
 
  {
962
 
    Item_func::print(str, query_type);
963
 
  }
964
 
};
965
 
 
966
 
 
967
 
class Item_func_last_insert_id :public Item_int_func
968
 
{
969
 
public:
970
 
  Item_func_last_insert_id() :Item_int_func() {}
971
 
  Item_func_last_insert_id(Item *a) :Item_int_func(a) {}
972
 
  int64_t val_int();
973
 
  const char *func_name() const { return "last_insert_id"; }
974
 
  void fix_length_and_dec()
975
 
  {
976
 
    if (arg_count)
977
 
      max_length= args[0]->max_length;
978
 
  }
979
 
  bool fix_fields(THD *thd, Item **ref);
980
 
};
981
 
 
982
 
 
983
 
class Item_func_benchmark :public Item_int_func
984
 
{
985
 
public:
986
 
  Item_func_benchmark(Item *count_expr, Item *expr)
987
 
    :Item_int_func(count_expr, expr)
988
 
  {}
989
 
  int64_t val_int();
990
 
  const char *func_name() const { return "benchmark"; }
991
 
  void fix_length_and_dec() { max_length=1; maybe_null=0; }
992
 
  virtual void print(String *str, enum_query_type query_type);
993
 
};
994
 
 
995
 
/* replication functions */
996
 
 
997
 
class Item_master_pos_wait :public Item_int_func
998
 
{
999
 
  String value;
1000
 
public:
1001
 
  Item_master_pos_wait(Item *a,Item *b) :Item_int_func(a,b) {}
1002
 
  Item_master_pos_wait(Item *a,Item *b,Item *c) :Item_int_func(a,b,c) {}
1003
 
  int64_t val_int();
1004
 
  const char *func_name() const { return "master_pos_wait"; }
1005
 
  void fix_length_and_dec() { max_length=21; maybe_null=1;}
1006
 
};
1007
 
 
1008
 
 
1009
 
/* Handling of user definable variables */
1010
 
 
1011
 
class user_var_entry;
1012
 
 
1013
 
class Item_func_set_user_var :public Item_func
1014
 
{
1015
 
  enum Item_result cached_result_type;
1016
 
  user_var_entry *entry;
1017
 
  char buffer[MAX_FIELD_WIDTH];
1018
 
  String value;
1019
 
  my_decimal decimal_buff;
1020
 
  bool null_item;
1021
 
  union
1022
 
  {
1023
 
    int64_t vint;
1024
 
    double vreal;
1025
 
    String *vstr;
1026
 
    my_decimal *vdec;
1027
 
  } save_result;
1028
 
 
1029
 
public:
1030
 
  LEX_STRING name; // keep it public
1031
 
  Item_func_set_user_var(LEX_STRING a,Item *b)
1032
 
    :Item_func(b), cached_result_type(INT_RESULT), name(a)
1033
 
  {}
1034
 
  enum Functype functype() const { return SUSERVAR_FUNC; }
1035
 
  double val_real();
1036
 
  int64_t val_int();
1037
 
  String *val_str(String *str);
1038
 
  my_decimal *val_decimal(my_decimal *);
1039
 
  double val_result();
1040
 
  int64_t val_int_result();
1041
 
  String *str_result(String *str);
1042
 
  my_decimal *val_decimal_result(my_decimal *);
1043
 
  bool update_hash(void *ptr, uint32_t length, enum Item_result type,
1044
 
                   const CHARSET_INFO * const cs, Derivation dv, bool unsigned_arg);
1045
 
  bool send(Protocol *protocol, String *str_arg);
1046
 
  void make_field(Send_field *tmp_field);
1047
 
  bool check(bool use_result_field);
1048
 
  bool update();
1049
 
  enum Item_result result_type () const { return cached_result_type; }
1050
 
  bool fix_fields(THD *thd, Item **ref);
1051
 
  void fix_length_and_dec();
1052
 
  virtual void print(String *str, enum_query_type query_type);
1053
 
  void print_as_stmt(String *str, enum_query_type query_type);
1054
 
  const char *func_name() const { return "set_user_var"; }
1055
 
  int save_in_field(Field *field, bool no_conversions,
1056
 
                    bool can_use_result_field);
1057
 
  int save_in_field(Field *field, bool no_conversions)
1058
 
  {
1059
 
    return save_in_field(field, no_conversions, 1);
1060
 
  }
1061
 
  void save_org_in_field(Field *field) { (void)save_in_field(field, 1, 0); }
1062
 
  bool register_field_in_read_map(unsigned char *arg);
1063
 
};
1064
 
 
1065
 
 
1066
 
class Item_func_get_user_var :public Item_func
1067
 
{
1068
 
  user_var_entry *var_entry;
1069
 
  Item_result m_cached_result_type;
1070
 
 
1071
 
public:
1072
 
  LEX_STRING name; // keep it public
1073
 
  Item_func_get_user_var(LEX_STRING a):
1074
 
    Item_func(), m_cached_result_type(STRING_RESULT), name(a) {}
1075
 
  enum Functype functype() const { return GUSERVAR_FUNC; }
1076
 
  LEX_STRING get_name() { return name; }
1077
 
  double val_real();
1078
 
  int64_t val_int();
1079
 
  my_decimal *val_decimal(my_decimal*);
1080
 
  String *val_str(String* str);
1081
 
  void fix_length_and_dec();
1082
 
  virtual void print(String *str, enum_query_type query_type);
1083
 
  enum Item_result result_type() const;
1084
 
  /*
1085
 
    We must always return variables as strings to guard against selects of type
1086
 
    select @t1:=1,@t1,@t:="hello",@t from foo where (@t1:= t2.b)
1087
 
  */
1088
 
  const char *func_name() const { return "get_user_var"; }
1089
 
  bool const_item() const;
1090
 
  table_map used_tables() const
1091
 
  { return const_item() ? 0 : RAND_TABLE_BIT; }
1092
 
  bool eq(const Item *item, bool binary_cmp) const;
1093
 
};
1094
 
 
1095
 
 
1096
 
/*
1097
 
  This item represents user variable used as out parameter (e.g in LOAD DATA),
1098
 
  and it is supposed to be used only for this purprose. So it is simplified
1099
 
  a lot. Actually you should never obtain its value.
1100
 
 
1101
 
  The only two reasons for this thing being an Item is possibility to store it
1102
 
  in List<Item> and desire to place this code somewhere near other functions
1103
 
  working with user variables.
1104
 
*/
1105
 
class Item_user_var_as_out_param :public Item
1106
 
{
1107
 
  LEX_STRING name;
1108
 
  user_var_entry *entry;
1109
 
public:
1110
 
  Item_user_var_as_out_param(LEX_STRING a) : name(a) {}
1111
 
  /* We should return something different from FIELD_ITEM here */
1112
 
  enum Type type() const { return STRING_ITEM;}
1113
 
  double val_real();
1114
 
  int64_t val_int();
1115
 
  String *val_str(String *str);
1116
 
  my_decimal *val_decimal(my_decimal *decimal_buffer);
1117
 
  /* fix_fields() binds variable name with its entry structure */
1118
 
  bool fix_fields(THD *thd, Item **ref);
1119
 
  virtual void print(String *str, enum_query_type query_type);
1120
 
  void set_null_value(const CHARSET_INFO * const cs);
1121
 
  void set_value(const char *str, uint32_t length, const CHARSET_INFO * const cs);
1122
 
};
1123
 
 
1124
 
 
1125
 
/* A system variable */
1126
 
 
1127
 
class Item_func_get_system_var :public Item_func
1128
 
{
1129
 
  sys_var *var;
1130
 
  enum_var_type var_type;
1131
 
  LEX_STRING component;
1132
 
public:
1133
 
  Item_func_get_system_var(sys_var *var_arg, enum_var_type var_type_arg,
1134
 
                           LEX_STRING *component_arg, const char *name_arg,
1135
 
                           size_t name_len_arg);
1136
 
  bool fix_fields(THD *thd, Item **ref);
1137
 
  /*
1138
 
    Stubs for pure virtual methods. Should never be called: this
1139
 
    item is always substituted with a constant in fix_fields().
1140
 
  */
1141
 
  double val_real()         { assert(0); return 0.0; }
1142
 
  int64_t val_int()        { assert(0); return 0; }
1143
 
  String* val_str(String*)  { assert(0); return 0; }
1144
 
  void fix_length_and_dec() { assert(0); }
1145
 
  /* TODO: fix to support views */
1146
 
  const char *func_name() const { return "get_system_var"; }
1147
 
  /**
1148
 
    Indicates whether this system variable is written to the binlog or not.
1149
 
 
1150
 
    Variables are written to the binlog as part of "status_vars" in
1151
 
    Query_log_event, as an Intvar_log_event, or a Rand_log_event.
1152
 
 
1153
 
    @return true if the variable is written to the binlog, false otherwise.
1154
 
  */
1155
 
  bool is_written_to_binlog();
1156
 
};
1157
 
 
1158
 
class Item_func_bit_xor : public Item_func_bit
1159
 
{
1160
 
public:
1161
 
  Item_func_bit_xor(Item *a, Item *b) :Item_func_bit(a, b) {}
1162
 
  int64_t val_int();
1163
 
  const char *func_name() const { return "^"; }
1164
 
};
1165
 
 
1166
 
class Item_func_is_free_lock :public Item_int_func
1167
 
{
1168
 
  String value;
1169
 
public:
1170
 
  Item_func_is_free_lock(Item *a) :Item_int_func(a) {}
1171
 
  int64_t val_int();
1172
 
  const char *func_name() const { return "is_free_lock"; }
1173
 
  void fix_length_and_dec() { decimals=0; max_length=1; maybe_null=1;}
1174
 
};
1175
 
 
1176
 
class Item_func_is_used_lock :public Item_int_func
1177
 
{
1178
 
  String value;
1179
 
public:
1180
 
  Item_func_is_used_lock(Item *a) :Item_int_func(a) {}
1181
 
  int64_t val_int();
1182
 
  const char *func_name() const { return "is_used_lock"; }
1183
 
  void fix_length_and_dec() { decimals=0; max_length=10; maybe_null=1;}
1184
 
};
 
23
 
 
24
/* If you fix the parser to no longer create functions these can be moved to create.cc */
 
25
#include <drizzled/function/math/divide.h>
 
26
#include <drizzled/function/get_user_var.h>
 
27
#include <drizzled/function/math/int.h>
 
28
#include <drizzled/function/math/int_divide.h>
 
29
#include <drizzled/function/math/minus.h>
 
30
#include <drizzled/function/math/mod.h>
 
31
#include <drizzled/function/math/multiply.h>
 
32
#include <drizzled/function/math/neg.h>
 
33
#include <drizzled/function/math/plus.h>
 
34
#include <drizzled/function/rollup_const.h>
 
35
#include <drizzled/function/math/round.h>
 
36
#include <drizzled/function/user_var_as_out_param.h>
1185
37
 
1186
38
/* For type casts */
1187
39
 
1192
44
  ITEM_CAST_DECIMAL
1193
45
};
1194
46
 
1195
 
 
1196
 
class Item_func_row_count :public Item_int_func
1197
 
{
1198
 
public:
1199
 
  Item_func_row_count() :Item_int_func() {}
1200
 
  int64_t val_int();
1201
 
  const char *func_name() const { return "row_count"; }
1202
 
  void fix_length_and_dec() { decimals= 0; maybe_null=0; }
1203
 
};
1204
 
 
1205
 
 
1206
 
/*
1207
 
 *
1208
 
 * Stored FUNCTIONs
1209
 
 *
1210
 
 */
1211
 
 
1212
 
struct st_sp_security_context;
1213
 
 
1214
 
class Item_func_found_rows :public Item_int_func
1215
 
{
1216
 
public:
1217
 
  Item_func_found_rows() :Item_int_func() {}
1218
 
  int64_t val_int();
1219
 
  const char *func_name() const { return "found_rows"; }
1220
 
  void fix_length_and_dec() { decimals= 0; maybe_null=0; }
1221
 
};
1222
 
 
1223
47
#endif /* DRIZZLE_SERVER_ITEM_FUNC_H */