~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/function/func.h

  • Committer: Brian Aker
  • Date: 2009-08-17 06:21:44 UTC
  • mto: This revision was merged to the branch mainline in revision 1118.
  • Revision ID: brian@gaz-20090817062144-8lxn1sg93pd8nhev
Remove PACK_KEYS

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
#include <drizzled/item.h>
26
26
#include <drizzled/sql_list.h>
27
27
#include <drizzled/item/bin_string.h>
28
 
#include "drizzled/current_session.h"
29
28
 
30
 
namespace drizzled
31
 
{
32
29
 
33
30
class Item_func :public Item_result_field
34
31
{
35
 
  Session &_session;
36
 
 
37
32
protected:
38
33
  Item **args, *tmp_arg[2];
39
34
  /*
64
59
  enum Type type() const { return FUNC_ITEM; }
65
60
  virtual enum Functype functype() const   { return UNKNOWN_FUNC; }
66
61
  virtual ~Item_func() {}
67
 
 
68
62
  Item_func(void):
69
 
    _session(*current_session),
70
63
    allowed_arg_cols(1), arg_count(0)
71
64
  {
72
65
    with_sum_func= 0;
73
 
    collation.set(DERIVATION_SYSCONST);
74
66
  }
75
 
 
76
67
  Item_func(Item *a):
77
 
    _session(*current_session),
78
68
    allowed_arg_cols(1), arg_count(1)
79
69
  {
80
70
    args= tmp_arg;
81
71
    args[0]= a;
82
72
    with_sum_func= a->with_sum_func;
83
 
    collation.set(DERIVATION_SYSCONST);
84
73
  }
85
 
  
86
74
  Item_func(Item *a,Item *b):
87
 
    _session(*current_session),
88
75
    allowed_arg_cols(1), arg_count(2)
89
76
  {
90
77
    args= tmp_arg;
91
78
    args[0]= a; args[1]= b;
92
79
    with_sum_func= a->with_sum_func || b->with_sum_func;
93
 
    collation.set(DERIVATION_SYSCONST);
94
80
  }
95
 
  
96
81
  Item_func(Item *a,Item *b,Item *c):
97
 
    _session(*current_session),
98
82
    allowed_arg_cols(1)
99
83
  {
100
84
    arg_count= 0;
101
 
    if ((args= (Item**) memory::sql_alloc(sizeof(Item*)*3)))
 
85
    if ((args= (Item**) sql_alloc(sizeof(Item*)*3)))
102
86
    {
103
87
      arg_count= 3;
104
88
      args[0]= a; args[1]= b; args[2]= c;
105
89
      with_sum_func= a->with_sum_func || b->with_sum_func || c->with_sum_func;
106
90
    }
107
 
    collation.set(DERIVATION_SYSCONST);
108
91
  }
109
 
  
110
92
  Item_func(Item *a,Item *b,Item *c,Item *d):
111
 
    _session(*current_session),
112
93
    allowed_arg_cols(1)
113
94
  {
114
95
    arg_count= 0;
115
 
    if ((args= (Item**) memory::sql_alloc(sizeof(Item*)*4)))
 
96
    if ((args= (Item**) sql_alloc(sizeof(Item*)*4)))
116
97
    {
117
98
      arg_count= 4;
118
99
      args[0]= a; args[1]= b; args[2]= c; args[3]= d;
119
100
      with_sum_func= a->with_sum_func || b->with_sum_func ||
120
101
        c->with_sum_func || d->with_sum_func;
121
102
    }
122
 
    collation.set(DERIVATION_SYSCONST);
123
103
  }
124
 
  
125
104
  Item_func(Item *a,Item *b,Item *c,Item *d,Item* e):
126
 
    _session(*current_session),
127
105
    allowed_arg_cols(1)
128
106
  {
129
107
    arg_count= 5;
130
 
    if ((args= (Item**) memory::sql_alloc(sizeof(Item*)*5)))
 
108
    if ((args= (Item**) sql_alloc(sizeof(Item*)*5)))
131
109
    {
132
110
      args[0]= a; args[1]= b; args[2]= c; args[3]= d; args[4]= e;
133
111
      with_sum_func= a->with_sum_func || b->with_sum_func ||
134
112
        c->with_sum_func || d->with_sum_func || e->with_sum_func ;
135
113
    }
136
 
    collation.set(DERIVATION_SYSCONST);
137
114
  }
138
 
  
139
115
  Item_func(List<Item> &list);
140
 
  
141
116
  // Constructor used for Item_cond_and/or (see Item comment)
142
117
  Item_func(Session *session, Item_func *item);
143
 
  
144
118
  bool fix_fields(Session *, Item **ref);
145
119
  void fix_after_pullout(Select_Lex *new_parent, Item **ref);
146
120
  table_map used_tables() const;
160
134
    {Sum}Functype and Item_func::functype()/Item_sum::sum_func()
161
135
    instead.
162
136
  */
163
 
  virtual const char *func_name() const { return NULL; }
 
137
  virtual const char *func_name() const { return NULL; };
164
138
  virtual bool const_item() const { return const_item_cache; }
165
139
  Item **arguments() const { return args; }
166
140
  void set_arguments(List<Item> &list);
212
186
                     void * arg, traverse_order order);
213
187
  double fix_result(double value);
214
188
 
215
 
  Session &getSession()
216
 
  {
217
 
    return _session;
218
 
  }
219
 
 
220
 
  Session *getSessionPtr()
221
 
  {
222
 
    return &_session;
223
 
  }
224
 
 
225
189
};
226
190
 
227
 
} /* namespace drizzled */
228
 
 
229
191
 
230
192
#endif /* DRIZZLED_FUNCTION_FUNC_H */