17
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22
20
#ifndef DRIZZLED_FUNCTION_FUNC_H
23
21
#define DRIZZLED_FUNCTION_FUNC_H
25
23
/// TODO: Rename this file - func.h is stupid.
27
#include <drizzled/charset_info.h>
28
#include <drizzled/current_session.h>
29
25
#include <drizzled/item.h>
26
#include <drizzled/sql_list.h>
30
27
#include <drizzled/item/bin_string.h>
31
#include <drizzled/lex_string.h>
32
#include <drizzled/sql_list.h>
33
#include <drizzled/type/decimal.h>
35
#include "drizzled/visibility.h"
40
class DRIZZLED_API Item_func :
41
public Item_result_field
30
class Item_func :public Item_result_field
46
33
Item **args, *tmp_arg[2];
72
59
enum Type type() const { return FUNC_ITEM; }
73
60
virtual enum Functype functype() const { return UNKNOWN_FUNC; }
74
61
virtual ~Item_func() {}
77
_session(*current_session),
78
allowed_arg_cols(1), arg_count(0),
79
const_item_cache(false)
63
allowed_arg_cols(1), arg_count(0)
82
collation.set(DERIVATION_SYSCONST);
85
67
Item_func(Item *a):
86
_session(*current_session),
87
allowed_arg_cols(1), arg_count(1),
88
const_item_cache(false)
68
allowed_arg_cols(1), arg_count(1)
92
72
with_sum_func= a->with_sum_func;
93
collation.set(DERIVATION_SYSCONST);
96
74
Item_func(Item *a,Item *b):
97
_session(*current_session),
98
allowed_arg_cols(1), arg_count(2),
99
const_item_cache(false)
75
allowed_arg_cols(1), arg_count(2)
102
78
args[0]= a; args[1]= b;
103
79
with_sum_func= a->with_sum_func || b->with_sum_func;
104
collation.set(DERIVATION_SYSCONST);
107
81
Item_func(Item *a,Item *b,Item *c):
108
_session(*current_session),
110
const_item_cache(false)
113
if ((args= (Item**) memory::sql_alloc(sizeof(Item*)*3)))
85
if ((args= (Item**) sql_alloc(sizeof(Item*)*3)))
116
88
args[0]= a; args[1]= b; args[2]= c;
117
89
with_sum_func= a->with_sum_func || b->with_sum_func || c->with_sum_func;
119
collation.set(DERIVATION_SYSCONST);
122
92
Item_func(Item *a,Item *b,Item *c,Item *d):
123
_session(*current_session),
125
const_item_cache(false)
128
if ((args= (Item**) memory::sql_alloc(sizeof(Item*)*4)))
96
if ((args= (Item**) sql_alloc(sizeof(Item*)*4)))
131
99
args[0]= a; args[1]= b; args[2]= c; args[3]= d;
132
100
with_sum_func= a->with_sum_func || b->with_sum_func ||
133
101
c->with_sum_func || d->with_sum_func;
135
collation.set(DERIVATION_SYSCONST);
138
104
Item_func(Item *a,Item *b,Item *c,Item *d,Item* e):
139
_session(*current_session),
141
const_item_cache(false)
144
if ((args= (Item**) memory::sql_alloc(sizeof(Item*)*5)))
108
if ((args= (Item**) sql_alloc(sizeof(Item*)*5)))
146
110
args[0]= a; args[1]= b; args[2]= c; args[3]= d; args[4]= e;
147
111
with_sum_func= a->with_sum_func || b->with_sum_func ||
148
112
c->with_sum_func || d->with_sum_func || e->with_sum_func ;
150
collation.set(DERIVATION_SYSCONST);
153
115
Item_func(List<Item> &list);
155
116
// Constructor used for Item_cond_and/or (see Item comment)
156
117
Item_func(Session *session, Item_func *item);
158
118
bool fix_fields(Session *, Item **ref);
159
119
void fix_after_pullout(Select_Lex *new_parent, Item **ref);
160
120
table_map used_tables() const;
197
157
void count_real_length();
198
158
void count_decimal_length();
200
bool get_arg0_date(type::Time <ime, uint32_t fuzzy_date);
201
bool get_arg0_time(type::Time <ime);
160
bool get_arg0_date(DRIZZLE_TIME *ltime, uint32_t fuzzy_date);
161
bool get_arg0_time(DRIZZLE_TIME *ltime);
205
virtual bool deterministic() const
210
165
void signal_divide_by_null();
212
167
virtual Field *tmp_table_field() { return result_field; }