~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/function/func.h

  • Committer: Monty Taylor
  • Date: 2010-02-05 08:11:15 UTC
  • mfrom: (1283 build)
  • mto: (1273.13.43 fix_is)
  • mto: This revision was merged to the branch mainline in revision 1300.
  • Revision ID: mordred@inaugust.com-20100205081115-dr82nvrwv4lvw7sd
Merged trunk.

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