~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item_func.h

break out item_func_bit, item_func_char_length, item_func_coercibility, item_func_locate, item_func_units into functions directory

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
#include <drizzled/functions/decimal_typecast.h>
37
37
#include <drizzled/functions/divide.h>
38
38
#include <drizzled/functions/int.h>
 
39
#include <drizzled/functions/bit.h>
39
40
#include <drizzled/functions/bit_count.h>
40
41
#include <drizzled/functions/bit_length.h>
41
42
#include <drizzled/functions/find_in_set.h>
58
59
#include <drizzled/functions/ascii.h>
59
60
#include <drizzled/functions/asin.h>
60
61
#include <drizzled/functions/atan.h>
 
62
#include <drizzled/functions/char_length.h>
61
63
#include <drizzled/functions/ceiling.h>
62
64
#include <drizzled/functions/cos.h>
63
65
#include <drizzled/functions/exp.h>
64
66
#include <drizzled/functions/floor.h>
65
67
#include <drizzled/functions/ln.h>
66
68
#include <drizzled/functions/log.h>
 
69
#include <drizzled/functions/units.h>
67
70
#include <drizzled/functions/ord.h>
68
71
#include <drizzled/functions/pow.h>
69
72
#include <drizzled/functions/rand.h>
82
85
  void fix_length_and_dec();
83
86
};
84
87
 
85
 
class Item_func_units :public Item_real_func
86
 
{
87
 
  char *name;
88
 
  double mul,add;
89
 
public:
90
 
  Item_func_units(char *name_arg,Item *a,double mul_arg,double add_arg)
91
 
    :Item_real_func(a),name(name_arg),mul(mul_arg),add(add_arg) {}
92
 
  double val_real();
93
 
  const char *func_name() const { return name; }
94
 
  void fix_length_and_dec()
95
 
  { decimals= NOT_FIXED_DEC; max_length= float_length(decimals); }
96
 
};
97
 
 
98
 
 
99
88
/* 
100
89
  Objects of this class are used for ROLLUP queries to wrap up 
101
90
  each constant item referred to in GROUP BY list. 
126
115
  }
127
116
};
128
117
 
129
 
class Item_func_char_length :public Item_int_func
130
 
{
131
 
  String value;
132
 
public:
133
 
  Item_func_char_length(Item *a) :Item_int_func(a) {}
134
 
  int64_t val_int();
135
 
  const char *func_name() const { return "char_length"; }
136
 
  void fix_length_and_dec() { max_length=10; }
137
 
};
138
 
 
139
 
class Item_func_coercibility :public Item_int_func
140
 
{
141
 
public:
142
 
  Item_func_coercibility(Item *a) :Item_int_func(a) {}
143
 
  int64_t val_int();
144
 
  const char *func_name() const { return "coercibility"; }
145
 
  void fix_length_and_dec() { max_length=10; maybe_null= 0; }
146
 
  table_map not_null_tables() const { return 0; }
147
 
};
148
 
 
149
 
class Item_func_locate :public Item_int_func
150
 
{
151
 
  String value1,value2;
152
 
  DTCollation cmp_collation;
153
 
public:
154
 
  Item_func_locate(Item *a,Item *b) :Item_int_func(a,b) {}
155
 
  Item_func_locate(Item *a,Item *b,Item *c) :Item_int_func(a,b,c) {}
156
 
  const char *func_name() const { return "locate"; }
157
 
  int64_t val_int();
158
 
  void fix_length_and_dec();
159
 
  virtual void print(String *str, enum_query_type query_type);
160
 
};
161
 
 
162
 
 
163
118
class Item_func_field :public Item_int_func
164
119
{
165
120
  String value,tmp;
172
127
  void fix_length_and_dec();
173
128
};
174
129
 
175
 
 
176
 
/* Base class for all bit functions: '~', '|', '^', '&', '>>', '<<' */
177
 
 
178
 
class Item_func_bit: public Item_int_func
179
 
{
180
 
public:
181
 
  Item_func_bit(Item *a, Item *b) :Item_int_func(a, b) {}
182
 
  Item_func_bit(Item *a) :Item_int_func(a) {}
183
 
  void fix_length_and_dec() { unsigned_flag= 1; }
184
 
 
185
 
  virtual inline void print(String *str, enum_query_type query_type)
186
 
  {
187
 
    print_op(str, query_type);
188
 
  }
189
 
};
190
 
 
191
 
class Item_func_bit_or :public Item_func_bit
192
 
{
193
 
public:
194
 
  Item_func_bit_or(Item *a, Item *b) :Item_func_bit(a, b) {}
195
 
  int64_t val_int();
196
 
  const char *func_name() const { return "|"; }
197
 
};
198
 
 
199
 
class Item_func_bit_and :public Item_func_bit
200
 
{
201
 
public:
202
 
  Item_func_bit_and(Item *a, Item *b) :Item_func_bit(a, b) {}
203
 
  int64_t val_int();
204
 
  const char *func_name() const { return "&"; }
205
 
};
206
 
 
207
 
class Item_func_shift_left :public Item_func_bit
208
 
{
209
 
public:
210
 
  Item_func_shift_left(Item *a, Item *b) :Item_func_bit(a, b) {}
211
 
  int64_t val_int();
212
 
  const char *func_name() const { return "<<"; }
213
 
};
214
 
 
215
 
class Item_func_shift_right :public Item_func_bit
216
 
{
217
 
public:
218
 
  Item_func_shift_right(Item *a, Item *b) :Item_func_bit(a, b) {}
219
 
  int64_t val_int();
220
 
  const char *func_name() const { return ">>"; }
221
 
};
222
 
 
223
 
class Item_func_bit_neg :public Item_func_bit
224
 
{
225
 
public:
226
 
  Item_func_bit_neg(Item *a) :Item_func_bit(a) {}
227
 
  int64_t val_int();
228
 
  const char *func_name() const { return "~"; }
229
 
 
230
 
  virtual inline void print(String *str, enum_query_type query_type)
231
 
  {
232
 
    Item_func::print(str, query_type);
233
 
  }
234
 
};
235
 
 
236
 
 
237
130
class Item_func_last_insert_id :public Item_int_func
238
131
{
239
132
public:
432
325
  bool is_written_to_binlog();
433
326
};
434
327
 
435
 
class Item_func_bit_xor : public Item_func_bit
436
 
{
437
 
public:
438
 
  Item_func_bit_xor(Item *a, Item *b) :Item_func_bit(a, b) {}
439
 
  int64_t val_int();
440
 
  const char *func_name() const { return "^"; }
441
 
};
442
 
 
443
328
class Item_func_is_free_lock :public Item_int_func
444
329
{
445
330
  String value;