~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/functions/func.h

code clean move Item_func_abs, Item_func_int_exp, Item_func_ln, Item_func_log to functions directory

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#ifndef DRIZZLED_FUNCTION_FUNC_H
21
 
#define DRIZZLED_FUNCTION_FUNC_H
 
20
#ifndef drizzled_functions_func_h
 
21
#define drizzled_functions_func_h
22
22
 
23
23
/// TODO: Rename this file - func.h is stupid.
24
24
 
25
25
#include <drizzled/item.h>
 
26
#include <drizzled/item_func.h>
26
27
#include <drizzled/sql_list.h>
27
 
#include <drizzled/item/bin_string.h>
28
 
 
29
 
namespace drizzled
 
28
 
 
29
 
 
30
#ifdef HAVE_IEEEFP_H
 
31
extern "C"        /* Bug in BSDI include file */
30
32
{
 
33
#include <ieeefp.h>
 
34
}
 
35
#endif
31
36
 
32
37
class Item_func :public Item_result_field
33
38
{
39
44
  */
40
45
  uint32_t allowed_arg_cols;
41
46
public:
42
 
 
43
 
  using Item::split_sum_func;
44
 
 
45
47
  uint32_t arg_count;
46
48
  table_map used_tables_cache, not_null_tables_cache;
47
49
  bool const_item_cache;
60
62
                       OPTIMIZE_EQUAL };
61
63
  enum Type type() const { return FUNC_ITEM; }
62
64
  virtual enum Functype functype() const   { return UNKNOWN_FUNC; }
63
 
  virtual ~Item_func() {}
64
65
  Item_func(void):
65
66
    allowed_arg_cols(1), arg_count(0)
66
67
  {
84
85
    allowed_arg_cols(1)
85
86
  {
86
87
    arg_count= 0;
87
 
    if ((args= (Item**) memory::sql_alloc(sizeof(Item*)*3)))
 
88
    if ((args= (Item**) sql_alloc(sizeof(Item*)*3)))
88
89
    {
89
90
      arg_count= 3;
90
91
      args[0]= a; args[1]= b; args[2]= c;
95
96
    allowed_arg_cols(1)
96
97
  {
97
98
    arg_count= 0;
98
 
    if ((args= (Item**) memory::sql_alloc(sizeof(Item*)*4)))
 
99
    if ((args= (Item**) sql_alloc(sizeof(Item*)*4)))
99
100
    {
100
101
      arg_count= 4;
101
102
      args[0]= a; args[1]= b; args[2]= c; args[3]= d;
107
108
    allowed_arg_cols(1)
108
109
  {
109
110
    arg_count= 5;
110
 
    if ((args= (Item**) memory::sql_alloc(sizeof(Item*)*5)))
 
111
    if ((args= (Item**) sql_alloc(sizeof(Item*)*5)))
111
112
    {
112
113
      args[0]= a; args[1]= b; args[2]= c; args[3]= d; args[4]= e;
113
114
      with_sum_func= a->with_sum_func || b->with_sum_func ||
116
117
  }
117
118
  Item_func(List<Item> &list);
118
119
  // Constructor used for Item_cond_and/or (see Item comment)
119
 
  Item_func(Session *session, Item_func *item);
120
 
  bool fix_fields(Session *, Item **ref);
121
 
  void fix_after_pullout(Select_Lex *new_parent, Item **ref);
 
120
  Item_func(THD *thd, Item_func *item);
 
121
  bool fix_fields(THD *, Item **ref);
 
122
  void fix_after_pullout(st_select_lex *new_parent, Item **ref);
122
123
  table_map used_tables() const;
123
124
  table_map not_null_tables() const;
124
125
  void update_used_tables();
142
143
  void set_arguments(List<Item> &list);
143
144
  uint32_t argument_count() const { return arg_count; }
144
145
  void remove_arguments() { arg_count=0; }
145
 
 
146
 
  /**
147
 
   * Check if the UDF supports the number of arguments passed in
148
 
   * @param number of args
149
 
   */
150
 
  virtual bool check_argument_count(int) { return true ; }
151
 
  virtual void split_sum_func(Session *session, Item **ref_pointer_array,
152
 
                              List<Item> &fields);
153
 
 
 
146
  void split_sum_func(THD *thd, Item **ref_pointer_array, List<Item> &fields);
154
147
  virtual void print(String *str, enum_query_type query_type);
155
148
  void print_op(String *str, enum_query_type query_type);
156
149
  void print_args(String *str, uint32_t from, enum_query_type query_type);
166
159
 
167
160
  void signal_divide_by_null();
168
161
 
169
 
  virtual Field *tmp_table_field() { return result_field; }
170
 
  virtual Field *tmp_table_field(Table *t_arg);
171
 
 
172
 
  Item *get_tmp_table_item(Session *session);
 
162
  Field *tmp_table_field() { return result_field; }
 
163
  Field *tmp_table_field(Table *t_arg);
 
164
  Item *get_tmp_table_item(THD *thd);
173
165
 
174
166
  my_decimal *val_decimal(my_decimal *);
175
167
 
190
182
 
191
183
};
192
184
 
193
 
} /* namespace drizzled */
194
 
 
195
 
 
196
 
#endif /* DRIZZLED_FUNCTION_FUNC_H */
 
185
 
 
186
#endif