~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item_func.h

MergedĀ fromĀ Lee.

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
#include <drizzled/functions/bit.h>
41
41
#include <drizzled/functions/bit_count.h>
42
42
#include <drizzled/functions/bit_length.h>
 
43
#include <drizzled/functions/field.h>
43
44
#include <drizzled/functions/find_in_set.h>
 
45
#include <drizzled/functions/found_rows.h>
 
46
#include <drizzled/functions/get_user_var.h>
 
47
#include <drizzled/functions/get_variable.h>
 
48
#include <drizzled/functions/integer.h>
44
49
#include <drizzled/functions/int_divide.h>
45
50
#include <drizzled/functions/length.h>
 
51
#include <drizzled/functions/lock.h>
 
52
#include <drizzled/functions/master_pos_wait.h>
46
53
#include <drizzled/functions/min_max.h>
47
54
#include <drizzled/functions/minus.h>
48
55
#include <drizzled/functions/mod.h>
55
62
#include <drizzled/functions/plus.h>
56
63
#include <drizzled/functions/real.h>
57
64
#include <drizzled/functions/rollup_const.h>
 
65
#include <drizzled/functions/row_count.h>
58
66
#include <drizzled/functions/dec.h>
59
67
#include <drizzled/functions/int_val.h>
60
68
#include <drizzled/functions/acos.h>
82
90
#include <drizzled/functions/tan.h>
83
91
#include <drizzled/functions/unsigned.h>
84
92
 
85
 
class Item_func_integer :public Item_int_func
86
 
{
87
 
public:
88
 
  inline Item_func_integer(Item *a) :Item_int_func(a) {}
89
 
  void fix_length_and_dec();
90
 
};
91
 
 
92
 
class Item_func_field :public Item_int_func
93
 
{
94
 
  String value,tmp;
95
 
  Item_result cmp_type;
96
 
  DTCollation cmp_collation;
97
 
public:
98
 
  Item_func_field(List<Item> &list) :Item_int_func(list) {}
99
 
  int64_t val_int();
100
 
  const char *func_name() const { return "field"; }
101
 
  void fix_length_and_dec();
102
 
};
103
 
 
104
 
/* replication functions */
105
 
 
106
 
class Item_master_pos_wait :public Item_int_func
107
 
{
108
 
  String value;
109
 
public:
110
 
  Item_master_pos_wait(Item *a,Item *b) :Item_int_func(a,b) {}
111
 
  Item_master_pos_wait(Item *a,Item *b,Item *c) :Item_int_func(a,b,c) {}
112
 
  int64_t val_int();
113
 
  const char *func_name() const { return "master_pos_wait"; }
114
 
  void fix_length_and_dec() { max_length=21; maybe_null=1;}
115
 
  bool check_vcol_func_processor(unsigned char *int_arg __attribute__((unused)))
116
 
  { return true; }
117
 
};
118
 
 
119
 
 
120
93
/* Handling of user definable variables */
121
94
 
122
95
class user_var_entry;
175
148
};
176
149
 
177
150
 
178
 
class Item_func_get_user_var :public Item_func
179
 
{
180
 
  user_var_entry *var_entry;
181
 
  Item_result m_cached_result_type;
182
 
 
183
 
public:
184
 
  LEX_STRING name; // keep it public
185
 
  Item_func_get_user_var(LEX_STRING a):
186
 
    Item_func(), m_cached_result_type(STRING_RESULT), name(a) {}
187
 
  enum Functype functype() const { return GUSERVAR_FUNC; }
188
 
  LEX_STRING get_name() { return name; }
189
 
  double val_real();
190
 
  int64_t val_int();
191
 
  my_decimal *val_decimal(my_decimal*);
192
 
  String *val_str(String* str);
193
 
  void fix_length_and_dec();
194
 
  virtual void print(String *str, enum_query_type query_type);
195
 
  enum Item_result result_type() const;
196
 
  /*
197
 
    We must always return variables as strings to guard against selects of type
198
 
    select @t1:=1,@t1,@t:="hello",@t from foo where (@t1:= t2.b)
199
 
  */
200
 
  const char *func_name() const { return "get_user_var"; }
201
 
  bool const_item() const;
202
 
  table_map used_tables() const
203
 
  { return const_item() ? 0 : RAND_TABLE_BIT; }
204
 
  bool eq(const Item *item, bool binary_cmp) const;
205
 
};
206
 
 
207
 
 
208
151
/*
209
152
  This item represents user variable used as out parameter (e.g in LOAD DATA),
210
153
  and it is supposed to be used only for this purprose. So it is simplified
234
177
};
235
178
 
236
179
 
237
 
class Item_func_is_free_lock :public Item_int_func
238
 
{
239
 
  String value;
240
 
public:
241
 
  Item_func_is_free_lock(Item *a) :Item_int_func(a) {}
242
 
  int64_t val_int();
243
 
  const char *func_name() const { return "is_free_lock"; }
244
 
  void fix_length_and_dec() { decimals=0; max_length=1; maybe_null=1;}
245
 
  bool check_vcol_func_processor(unsigned char *int_arg __attribute__((unused)))
246
 
  { return true; }
247
 
};
248
 
 
249
 
class Item_func_is_used_lock :public Item_int_func
250
 
{
251
 
  String value;
252
 
public:
253
 
  Item_func_is_used_lock(Item *a) :Item_int_func(a) {}
254
 
  int64_t val_int();
255
 
  const char *func_name() const { return "is_used_lock"; }
256
 
  void fix_length_and_dec() { decimals=0; max_length=10; maybe_null=1;}
257
 
  bool check_vcol_func_processor(unsigned char *int_arg __attribute__((unused)))
258
 
  { return true; }
259
 
};
260
 
 
261
180
/* For type casts */
262
181
 
263
182
enum Cast_target
267
186
  ITEM_CAST_DECIMAL
268
187
};
269
188
 
270
 
 
271
 
class Item_func_row_count :public Item_int_func
272
 
{
273
 
public:
274
 
  Item_func_row_count() :Item_int_func() {}
275
 
  int64_t val_int();
276
 
  const char *func_name() const { return "row_count"; }
277
 
  void fix_length_and_dec() { decimals= 0; maybe_null=0; }
278
 
  bool check_vcol_func_processor(unsigned char *int_arg __attribute__((unused)))
279
 
  { return true; }
280
 
};
281
 
 
282
 
 
283
 
/*
284
 
 *
285
 
 * Stored FUNCTIONs
286
 
 *
287
 
 */
288
 
 
289
 
struct st_sp_security_context;
290
 
 
291
 
class Item_func_found_rows :public Item_int_func
292
 
{
293
 
public:
294
 
  Item_func_found_rows() :Item_int_func() {}
295
 
  int64_t val_int();
296
 
  const char *func_name() const { return "found_rows"; }
297
 
  void fix_length_and_dec() { decimals= 0; maybe_null=0; }
298
 
  bool check_vcol_func_processor(unsigned char *int_arg __attribute__((unused)))
299
 
  { return true; }
300
 
};
301
 
 
302
189
#endif /* DRIZZLE_SERVER_ITEM_FUNC_H */