64
59
enum Type type() const { return FUNC_ITEM; }
65
60
virtual enum Functype functype() const { return UNKNOWN_FUNC; }
66
virtual ~Item_func() {}
69
_session(*current_session),
70
62
allowed_arg_cols(1), arg_count(0)
73
collation.set(DERIVATION_SYSCONST);
76
66
Item_func(Item *a):
77
_session(*current_session),
78
67
allowed_arg_cols(1), arg_count(1)
82
71
with_sum_func= a->with_sum_func;
83
collation.set(DERIVATION_SYSCONST);
86
73
Item_func(Item *a,Item *b):
87
_session(*current_session),
88
74
allowed_arg_cols(1), arg_count(2)
91
77
args[0]= a; args[1]= b;
92
78
with_sum_func= a->with_sum_func || b->with_sum_func;
93
collation.set(DERIVATION_SYSCONST);
96
80
Item_func(Item *a,Item *b,Item *c):
97
_session(*current_session),
98
81
allowed_arg_cols(1)
101
if ((args= (Item**) memory::sql_alloc(sizeof(Item*)*3)))
84
if ((args= (Item**) sql_alloc(sizeof(Item*)*3)))
104
87
args[0]= a; args[1]= b; args[2]= c;
105
88
with_sum_func= a->with_sum_func || b->with_sum_func || c->with_sum_func;
107
collation.set(DERIVATION_SYSCONST);
110
91
Item_func(Item *a,Item *b,Item *c,Item *d):
111
_session(*current_session),
112
92
allowed_arg_cols(1)
115
if ((args= (Item**) memory::sql_alloc(sizeof(Item*)*4)))
95
if ((args= (Item**) sql_alloc(sizeof(Item*)*4)))
118
98
args[0]= a; args[1]= b; args[2]= c; args[3]= d;
119
99
with_sum_func= a->with_sum_func || b->with_sum_func ||
120
100
c->with_sum_func || d->with_sum_func;
122
collation.set(DERIVATION_SYSCONST);
125
103
Item_func(Item *a,Item *b,Item *c,Item *d,Item* e):
126
_session(*current_session),
127
104
allowed_arg_cols(1)
130
if ((args= (Item**) memory::sql_alloc(sizeof(Item*)*5)))
107
if ((args= (Item**) sql_alloc(sizeof(Item*)*5)))
132
109
args[0]= a; args[1]= b; args[2]= c; args[3]= d; args[4]= e;
133
110
with_sum_func= a->with_sum_func || b->with_sum_func ||
134
111
c->with_sum_func || d->with_sum_func || e->with_sum_func ;
136
collation.set(DERIVATION_SYSCONST);
139
114
Item_func(List<Item> &list);
141
115
// Constructor used for Item_cond_and/or (see Item comment)
142
116
Item_func(Session *session, Item_func *item);
144
117
bool fix_fields(Session *, Item **ref);
145
118
void fix_after_pullout(Select_Lex *new_parent, Item **ref);
146
119
table_map used_tables() const;
160
133
{Sum}Functype and Item_func::functype()/Item_sum::sum_func()
163
virtual const char *func_name() const { return NULL; }
136
virtual const char *func_name() const { return NULL; };
164
137
virtual bool const_item() const { return const_item_cache; }
165
138
Item **arguments() const { return args; }
166
139
void set_arguments(List<Item> &list);
167
140
uint32_t argument_count() const { return arg_count; }
168
141
void remove_arguments() { arg_count=0; }
171
* Check if the UDF supports the number of arguments passed in
172
* @param number of args
174
virtual bool check_argument_count(int) { return true ; }
175
142
virtual void split_sum_func(Session *session, Item **ref_pointer_array,
176
143
List<Item> &fields);