1
by brian
clean slate |
1 |
/* Copyright (C) 2000-2003 MySQL AB
|
2 |
||
3 |
This program is free software; you can redistribute it and/or modify
|
|
4 |
it under the terms of the GNU General Public License as published by
|
|
5 |
the Free Software Foundation; version 2 of the License.
|
|
6 |
||
7 |
This program is distributed in the hope that it will be useful,
|
|
8 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
9 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
10 |
GNU General Public License for more details.
|
|
11 |
||
12 |
You should have received a copy of the GNU General Public License
|
|
13 |
along with this program; if not, write to the Free Software
|
|
1802.10.2
by Monty Taylor
Update all of the copyright headers to include the correct address. |
14 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
|
1
by brian
clean slate |
15 |
|
16 |
/**
|
|
17 |
@file
|
|
18 |
||
19 |
@brief
|
|
20 |
Functions to create an item. Used by sql_yac.yy
|
|
21 |
*/
|
|
22 |
||
1241.9.36
by Monty Taylor
ZOMG. I deleted drizzled/server_includes.h. |
23 |
#include "config.h" |
584.1.15
by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes. |
24 |
#include <drizzled/item/create.h> |
25 |
#include <drizzled/item/func.h> |
|
550
by Monty Taylor
Moved error.h into just the files that need it. |
26 |
#include <drizzled/error.h> |
1
by brian
clean slate |
27 |
|
1751.3.3
by Brian Aker
Shuffle native functions over to hash such that we have a specific container |
28 |
#include "drizzled/function_container.h" |
29 |
||
670.1.20
by Monty Taylor
Renamed functions to function... everything else is singular. |
30 |
#include <drizzled/function/str/binary.h> |
31 |
#include <drizzled/function/str/concat.h> |
|
32 |
#include <drizzled/function/str/conv.h> |
|
33 |
#include <drizzled/function/str/export_set.h> |
|
34 |
#include <drizzled/function/str/load_file.h> |
|
35 |
#include <drizzled/function/str/make_set.h> |
|
36 |
#include <drizzled/function/str/pad.h> |
|
37 |
#include <drizzled/function/str/repeat.h> |
|
38 |
#include <drizzled/function/str/str_conv.h> |
|
39 |
#include <drizzled/function/str/trim.h> |
|
642.1.12
by Lee
remove drizzled/item/strfunc.h, no longer needed |
40 |
|
670.1.22
by Monty Taylor
Merged from Lee. |
41 |
#include <drizzled/function/time/date_format.h> |
42 |
#include <drizzled/function/time/dayname.h> |
|
43 |
#include <drizzled/function/time/dayofmonth.h> |
|
44 |
#include <drizzled/function/time/dayofyear.h> |
|
45 |
#include <drizzled/function/time/from_unixtime.h> |
|
46 |
#include <drizzled/function/time/from_days.h> |
|
47 |
#include <drizzled/function/time/last_day.h> |
|
48 |
#include <drizzled/function/time/makedate.h> |
|
49 |
#include <drizzled/function/time/month.h> |
|
50 |
#include <drizzled/function/time/period_add.h> |
|
51 |
#include <drizzled/function/time/period_diff.h> |
|
52 |
#include <drizzled/function/time/to_days.h> |
|
53 |
#include <drizzled/function/time/typecast.h> |
|
54 |
#include <drizzled/function/time/unix_timestamp.h> |
|
55 |
#include <drizzled/function/time/weekday.h> |
|
642.1.13
by Lee
remove drizzled/item/timefunc.h, no longer needed |
56 |
|
584.4.7
by Monty Taylor
Removed a big bank of includes from item.h. |
57 |
#include <drizzled/item/cmpfunc.h> |
1130.1.12
by Monty Taylor
Moved service stuff into plugin/ |
58 |
#include <drizzled/plugin/function.h> |
584.1.15
by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes. |
59 |
#include <drizzled/session.h> |
584.4.7
by Monty Taylor
Removed a big bank of includes from item.h. |
60 |
|
648
by Brian Aker
Fix for create to keep its include files (which speeds up recompiles). |
61 |
/* Function declarations */
|
62 |
||
670.1.20
by Monty Taylor
Renamed functions to function... everything else is singular. |
63 |
#include <drizzled/function/func.h> |
64 |
#include <drizzled/function/additive_op.h> |
|
642.1.30
by Lee
move math functions to drizzled/function/math directory |
65 |
#include <drizzled/function/math/dec.h> |
66 |
#include <drizzled/function/math/decimal_typecast.h> |
|
670.1.20
by Monty Taylor
Renamed functions to function... everything else is singular. |
67 |
#include <drizzled/function/field.h> |
68 |
#include <drizzled/function/find_in_set.h> |
|
69 |
#include <drizzled/function/found_rows.h> |
|
70 |
#include <drizzled/function/get_system_var.h> |
|
642.1.30
by Lee
move math functions to drizzled/function/math directory |
71 |
#include <drizzled/function/math/int_val.h> |
72 |
#include <drizzled/function/math/integer.h> |
|
670.1.20
by Monty Taylor
Renamed functions to function... everything else is singular. |
73 |
#include <drizzled/function/last_insert.h> |
74 |
#include <drizzled/function/locate.h> |
|
75 |
#include <drizzled/function/min_max.h> |
|
76 |
#include <drizzled/function/num1.h> |
|
77 |
#include <drizzled/function/num_op.h> |
|
78 |
#include <drizzled/function/numhybrid.h> |
|
642.1.30
by Lee
move math functions to drizzled/function/math directory |
79 |
#include <drizzled/function/math/real.h> |
670.1.20
by Monty Taylor
Renamed functions to function... everything else is singular. |
80 |
#include <drizzled/function/row_count.h> |
81 |
#include <drizzled/function/set_user_var.h> |
|
82 |
#include <drizzled/function/sign.h> |
|
642.1.30
by Lee
move math functions to drizzled/function/math directory |
83 |
#include <drizzled/function/math/tan.h> |
670.1.20
by Monty Taylor
Renamed functions to function... everything else is singular. |
84 |
#include <drizzled/function/units.h> |
648
by Brian Aker
Fix for create to keep its include files (which speeds up recompiles). |
85 |
|
873.2.19
by Monty Taylor
Removed another HASH and another set of useless utf8 hashing. |
86 |
using namespace std; |
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
87 |
|
88 |
namespace drizzled |
|
89 |
{
|
|
648
by Brian Aker
Fix for create to keep its include files (which speeds up recompiles). |
90 |
|
584.4.7
by Monty Taylor
Removed a big bank of includes from item.h. |
91 |
class Item; |
92 |
||
584.1.15
by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes. |
93 |
|
1
by brian
clean slate |
94 |
/*
|
95 |
=============================================================================
|
|
96 |
LOCAL DECLARATIONS
|
|
97 |
=============================================================================
|
|
98 |
*/
|
|
99 |
||
100 |
/**
|
|
101 |
Adapter for native functions with a variable number of arguments.
|
|
102 |
The main use of this class is to discard the following calls:
|
|
103 |
<code>foo(expr1 AS name1, expr2 AS name2, ...)</code>
|
|
104 |
which are syntactically correct (the syntax can refer to a UDF),
|
|
105 |
but semantically invalid for native functions.
|
|
106 |
*/
|
|
107 |
||
108 |
class Create_native_func : public Create_func |
|
109 |
{
|
|
110 |
public: |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
111 |
virtual Item *create(Session *session, LEX_STRING name, List<Item> *item_list); |
1
by brian
clean slate |
112 |
|
113 |
/**
|
|
114 |
Builder method, with no arguments.
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
115 |
@param session The current thread
|
1
by brian
clean slate |
116 |
@param name The native function name
|
117 |
@param item_list The function parameters, none of which are named
|
|
118 |
@return An item representing the function call
|
|
119 |
*/
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
120 |
virtual Item *create_native(Session *session, LEX_STRING name, |
1
by brian
clean slate |
121 |
List<Item> *item_list) = 0; |
122 |
||
123 |
protected: |
|
124 |
/** Constructor. */
|
|
125 |
Create_native_func() {} |
|
126 |
/** Destructor. */
|
|
127 |
virtual ~Create_native_func() {} |
|
128 |
};
|
|
129 |
||
130 |
||
131 |
/**
|
|
132 |
Adapter for functions that takes exactly zero arguments.
|
|
133 |
*/
|
|
134 |
||
135 |
class Create_func_arg0 : public Create_func |
|
136 |
{
|
|
137 |
public: |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
138 |
virtual Item *create(Session *session, LEX_STRING name, List<Item> *item_list); |
1
by brian
clean slate |
139 |
|
140 |
/**
|
|
141 |
Builder method, with no arguments.
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
142 |
@param session The current thread
|
1
by brian
clean slate |
143 |
@return An item representing the function call
|
144 |
*/
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
145 |
virtual Item *create(Session *session) = 0; |
1
by brian
clean slate |
146 |
|
147 |
protected: |
|
148 |
/** Constructor. */
|
|
149 |
Create_func_arg0() {} |
|
150 |
/** Destructor. */
|
|
151 |
virtual ~Create_func_arg0() {} |
|
152 |
};
|
|
153 |
||
154 |
||
155 |
/**
|
|
156 |
Adapter for functions that takes exactly one argument.
|
|
157 |
*/
|
|
158 |
||
159 |
class Create_func_arg1 : public Create_func |
|
160 |
{
|
|
161 |
public: |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
162 |
virtual Item *create(Session *session, LEX_STRING name, List<Item> *item_list); |
1
by brian
clean slate |
163 |
|
164 |
/**
|
|
165 |
Builder method, with one argument.
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
166 |
@param session The current thread
|
1
by brian
clean slate |
167 |
@param arg1 The first argument of the function
|
168 |
@return An item representing the function call
|
|
169 |
*/
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
170 |
virtual Item *create(Session *session, Item *arg1) = 0; |
1
by brian
clean slate |
171 |
|
172 |
protected: |
|
173 |
/** Constructor. */
|
|
174 |
Create_func_arg1() {} |
|
175 |
/** Destructor. */
|
|
176 |
virtual ~Create_func_arg1() {} |
|
177 |
};
|
|
178 |
||
179 |
||
180 |
/**
|
|
181 |
Adapter for functions that takes exactly two arguments.
|
|
182 |
*/
|
|
183 |
||
184 |
class Create_func_arg2 : public Create_func |
|
185 |
{
|
|
186 |
public: |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
187 |
virtual Item *create(Session *session, LEX_STRING name, List<Item> *item_list); |
1
by brian
clean slate |
188 |
|
189 |
/**
|
|
190 |
Builder method, with two arguments.
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
191 |
@param session The current thread
|
1
by brian
clean slate |
192 |
@param arg1 The first argument of the function
|
193 |
@param arg2 The second argument of the function
|
|
194 |
@return An item representing the function call
|
|
195 |
*/
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
196 |
virtual Item *create(Session *session, Item *arg1, Item *arg2) = 0; |
1
by brian
clean slate |
197 |
|
198 |
protected: |
|
199 |
/** Constructor. */
|
|
200 |
Create_func_arg2() {} |
|
201 |
/** Destructor. */
|
|
202 |
virtual ~Create_func_arg2() {} |
|
203 |
};
|
|
204 |
||
205 |
||
206 |
/**
|
|
207 |
Adapter for functions that takes exactly three arguments.
|
|
208 |
*/
|
|
209 |
||
210 |
class Create_func_arg3 : public Create_func |
|
211 |
{
|
|
212 |
public: |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
213 |
virtual Item *create(Session *session, LEX_STRING name, List<Item> *item_list); |
1
by brian
clean slate |
214 |
|
215 |
/**
|
|
216 |
Builder method, with three arguments.
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
217 |
@param session The current thread
|
1
by brian
clean slate |
218 |
@param arg1 The first argument of the function
|
219 |
@param arg2 The second argument of the function
|
|
220 |
@param arg3 The third argument of the function
|
|
221 |
@return An item representing the function call
|
|
222 |
*/
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
223 |
virtual Item *create(Session *session, Item *arg1, Item *arg2, Item *arg3) = 0; |
1
by brian
clean slate |
224 |
|
225 |
protected: |
|
226 |
/** Constructor. */
|
|
227 |
Create_func_arg3() {} |
|
228 |
/** Destructor. */
|
|
229 |
virtual ~Create_func_arg3() {} |
|
230 |
};
|
|
231 |
||
232 |
||
233 |
/**
|
|
234 |
Function builder for Stored Functions.
|
|
235 |
*/
|
|
236 |
||
237 |
/*
|
|
238 |
Concrete functions builders (native functions).
|
|
239 |
Please keep this list sorted in alphabetical order,
|
|
240 |
it helps to compare code between versions, and helps with merges conflicts.
|
|
241 |
*/
|
|
242 |
||
243 |
||
244 |
class Create_func_bin : public Create_func_arg1 |
|
245 |
{
|
|
246 |
public: |
|
892.1.1
by Monty Taylor
Fixed virtual overload warnings. |
247 |
using Create_func_arg1::create; |
248 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
249 |
virtual Item *create(Session *session, Item *arg1); |
1
by brian
clean slate |
250 |
|
251 |
static Create_func_bin s_singleton; |
|
252 |
||
253 |
protected: |
|
254 |
Create_func_bin() {} |
|
255 |
virtual ~Create_func_bin() {} |
|
256 |
};
|
|
257 |
||
258 |
class Create_func_concat : public Create_native_func |
|
259 |
{
|
|
260 |
public: |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
261 |
virtual Item *create_native(Session *session, LEX_STRING name, List<Item> *item_list); |
1
by brian
clean slate |
262 |
|
263 |
static Create_func_concat s_singleton; |
|
264 |
||
265 |
protected: |
|
266 |
Create_func_concat() {} |
|
267 |
virtual ~Create_func_concat() {} |
|
268 |
};
|
|
269 |
||
270 |
||
271 |
class Create_func_concat_ws : public Create_native_func |
|
272 |
{
|
|
273 |
public: |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
274 |
virtual Item *create_native(Session *session, LEX_STRING name, List<Item> *item_list); |
1
by brian
clean slate |
275 |
|
276 |
static Create_func_concat_ws s_singleton; |
|
277 |
||
278 |
protected: |
|
279 |
Create_func_concat_ws() {} |
|
280 |
virtual ~Create_func_concat_ws() {} |
|
281 |
};
|
|
282 |
||
283 |
||
284 |
class Create_func_conv : public Create_func_arg3 |
|
285 |
{
|
|
286 |
public: |
|
892.1.1
by Monty Taylor
Fixed virtual overload warnings. |
287 |
using Create_func_arg3::create; |
288 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
289 |
virtual Item *create(Session *session, Item *arg1, Item *arg2, Item *arg3); |
1
by brian
clean slate |
290 |
|
291 |
static Create_func_conv s_singleton; |
|
292 |
||
293 |
protected: |
|
294 |
Create_func_conv() {} |
|
295 |
virtual ~Create_func_conv() {} |
|
296 |
};
|
|
297 |
||
298 |
class Create_func_cot : public Create_func_arg1 |
|
299 |
{
|
|
300 |
public: |
|
892.1.1
by Monty Taylor
Fixed virtual overload warnings. |
301 |
using Create_func_arg1::create; |
302 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
303 |
virtual Item *create(Session *session, Item *arg1); |
1
by brian
clean slate |
304 |
|
305 |
static Create_func_cot s_singleton; |
|
306 |
||
307 |
protected: |
|
308 |
Create_func_cot() {} |
|
309 |
virtual ~Create_func_cot() {} |
|
310 |
};
|
|
311 |
||
312 |
class Create_func_date_format : public Create_func_arg2 |
|
313 |
{
|
|
314 |
public: |
|
892.1.1
by Monty Taylor
Fixed virtual overload warnings. |
315 |
using Create_func_arg2::create; |
316 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
317 |
virtual Item *create(Session *session, Item *arg1, Item *arg2); |
1
by brian
clean slate |
318 |
|
319 |
static Create_func_date_format s_singleton; |
|
320 |
||
321 |
protected: |
|
322 |
Create_func_date_format() {} |
|
323 |
virtual ~Create_func_date_format() {} |
|
324 |
};
|
|
325 |
||
326 |
||
327 |
class Create_func_datediff : public Create_func_arg2 |
|
328 |
{
|
|
329 |
public: |
|
892.1.1
by Monty Taylor
Fixed virtual overload warnings. |
330 |
using Create_func_arg2::create; |
331 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
332 |
virtual Item *create(Session *session, Item *arg1, Item *arg2); |
1
by brian
clean slate |
333 |
|
334 |
static Create_func_datediff s_singleton; |
|
335 |
||
336 |
protected: |
|
337 |
Create_func_datediff() {} |
|
338 |
virtual ~Create_func_datediff() {} |
|
339 |
};
|
|
340 |
||
341 |
||
342 |
class Create_func_dayname : public Create_func_arg1 |
|
343 |
{
|
|
344 |
public: |
|
892.1.1
by Monty Taylor
Fixed virtual overload warnings. |
345 |
using Create_func_arg1::create; |
346 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
347 |
virtual Item *create(Session *session, Item *arg1); |
1
by brian
clean slate |
348 |
|
349 |
static Create_func_dayname s_singleton; |
|
350 |
||
351 |
protected: |
|
352 |
Create_func_dayname() {} |
|
353 |
virtual ~Create_func_dayname() {} |
|
354 |
};
|
|
355 |
||
356 |
||
357 |
class Create_func_dayofmonth : public Create_func_arg1 |
|
358 |
{
|
|
359 |
public: |
|
892.1.1
by Monty Taylor
Fixed virtual overload warnings. |
360 |
using Create_func_arg1::create; |
361 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
362 |
virtual Item *create(Session *session, Item *arg1); |
1
by brian
clean slate |
363 |
|
364 |
static Create_func_dayofmonth s_singleton; |
|
365 |
||
366 |
protected: |
|
367 |
Create_func_dayofmonth() {} |
|
368 |
virtual ~Create_func_dayofmonth() {} |
|
369 |
};
|
|
370 |
||
371 |
||
372 |
class Create_func_dayofweek : public Create_func_arg1 |
|
373 |
{
|
|
374 |
public: |
|
892.1.1
by Monty Taylor
Fixed virtual overload warnings. |
375 |
using Create_func_arg1::create; |
376 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
377 |
virtual Item *create(Session *session, Item *arg1); |
1
by brian
clean slate |
378 |
|
379 |
static Create_func_dayofweek s_singleton; |
|
380 |
||
381 |
protected: |
|
382 |
Create_func_dayofweek() {} |
|
383 |
virtual ~Create_func_dayofweek() {} |
|
384 |
};
|
|
385 |
||
386 |
||
387 |
class Create_func_dayofyear : public Create_func_arg1 |
|
388 |
{
|
|
389 |
public: |
|
892.1.1
by Monty Taylor
Fixed virtual overload warnings. |
390 |
using Create_func_arg1::create; |
391 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
392 |
virtual Item *create(Session *session, Item *arg1); |
1
by brian
clean slate |
393 |
|
394 |
static Create_func_dayofyear s_singleton; |
|
395 |
||
396 |
protected: |
|
397 |
Create_func_dayofyear() {} |
|
398 |
virtual ~Create_func_dayofyear() {} |
|
399 |
};
|
|
400 |
||
401 |
||
402 |
class Create_func_decode : public Create_func_arg2 |
|
403 |
{
|
|
404 |
public: |
|
892.1.1
by Monty Taylor
Fixed virtual overload warnings. |
405 |
using Create_func_arg2::create; |
406 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
407 |
virtual Item *create(Session *session, Item *arg1, Item *arg2); |
1
by brian
clean slate |
408 |
|
409 |
static Create_func_decode s_singleton; |
|
410 |
||
411 |
protected: |
|
412 |
Create_func_decode() {} |
|
413 |
virtual ~Create_func_decode() {} |
|
414 |
};
|
|
415 |
||
416 |
||
417 |
class Create_func_degrees : public Create_func_arg1 |
|
418 |
{
|
|
419 |
public: |
|
892.1.1
by Monty Taylor
Fixed virtual overload warnings. |
420 |
using Create_func_arg1::create; |
421 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
422 |
virtual Item *create(Session *session, Item *arg1); |
1
by brian
clean slate |
423 |
|
424 |
static Create_func_degrees s_singleton; |
|
425 |
||
426 |
protected: |
|
427 |
Create_func_degrees() {} |
|
428 |
virtual ~Create_func_degrees() {} |
|
429 |
};
|
|
430 |
||
431 |
class Create_func_export_set : public Create_native_func |
|
432 |
{
|
|
1759.3.15
by Stewart Smith
move SQRT() function into math_functions plugin |
433 |
|
1
by brian
clean slate |
434 |
public: |
520.1.22
by Brian Aker
Second pass of thd cleanup |
435 |
virtual Item *create_native(Session *session, LEX_STRING name, List<Item> *item_list); |
1
by brian
clean slate |
436 |
|
437 |
static Create_func_export_set s_singleton; |
|
438 |
||
439 |
protected: |
|
440 |
Create_func_export_set() {} |
|
441 |
virtual ~Create_func_export_set() {} |
|
442 |
};
|
|
443 |
||
444 |
||
445 |
class Create_func_field : public Create_native_func |
|
446 |
{
|
|
447 |
public: |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
448 |
virtual Item *create_native(Session *session, LEX_STRING name, List<Item> *item_list); |
1
by brian
clean slate |
449 |
|
450 |
static Create_func_field s_singleton; |
|
451 |
||
452 |
protected: |
|
453 |
Create_func_field() {} |
|
454 |
virtual ~Create_func_field() {} |
|
455 |
};
|
|
456 |
||
457 |
||
458 |
class Create_func_find_in_set : public Create_func_arg2 |
|
459 |
{
|
|
460 |
public: |
|
892.1.1
by Monty Taylor
Fixed virtual overload warnings. |
461 |
using Create_func_arg2::create; |
462 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
463 |
virtual Item *create(Session *session, Item *arg1, Item *arg2); |
1
by brian
clean slate |
464 |
|
465 |
static Create_func_find_in_set s_singleton; |
|
466 |
||
467 |
protected: |
|
468 |
Create_func_find_in_set() {} |
|
469 |
virtual ~Create_func_find_in_set() {} |
|
470 |
};
|
|
471 |
||
472 |
class Create_func_found_rows : public Create_func_arg0 |
|
473 |
{
|
|
474 |
public: |
|
892.1.1
by Monty Taylor
Fixed virtual overload warnings. |
475 |
using Create_func_arg0::create; |
476 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
477 |
virtual Item *create(Session *session); |
1
by brian
clean slate |
478 |
|
479 |
static Create_func_found_rows s_singleton; |
|
480 |
||
481 |
protected: |
|
482 |
Create_func_found_rows() {} |
|
483 |
virtual ~Create_func_found_rows() {} |
|
484 |
};
|
|
485 |
||
486 |
||
487 |
class Create_func_from_days : public Create_func_arg1 |
|
488 |
{
|
|
489 |
public: |
|
892.1.1
by Monty Taylor
Fixed virtual overload warnings. |
490 |
using Create_func_arg1::create; |
491 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
492 |
virtual Item *create(Session *session, Item *arg1); |
1
by brian
clean slate |
493 |
|
494 |
static Create_func_from_days s_singleton; |
|
495 |
||
496 |
protected: |
|
497 |
Create_func_from_days() {} |
|
498 |
virtual ~Create_func_from_days() {} |
|
499 |
};
|
|
500 |
||
501 |
||
502 |
class Create_func_from_unixtime : public Create_native_func |
|
503 |
{
|
|
504 |
public: |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
505 |
virtual Item *create_native(Session *session, LEX_STRING name, List<Item> *item_list); |
1
by brian
clean slate |
506 |
|
507 |
static Create_func_from_unixtime s_singleton; |
|
508 |
||
509 |
protected: |
|
510 |
Create_func_from_unixtime() {} |
|
511 |
virtual ~Create_func_from_unixtime() {} |
|
512 |
};
|
|
513 |
||
514 |
||
515 |
class Create_func_greatest : public Create_native_func |
|
516 |
{
|
|
517 |
public: |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
518 |
virtual Item *create_native(Session *session, LEX_STRING name, List<Item> *item_list); |
1
by brian
clean slate |
519 |
|
520 |
static Create_func_greatest s_singleton; |
|
521 |
||
522 |
protected: |
|
523 |
Create_func_greatest() {} |
|
524 |
virtual ~Create_func_greatest() {} |
|
525 |
};
|
|
526 |
||
527 |
||
528 |
class Create_func_ifnull : public Create_func_arg2 |
|
529 |
{
|
|
530 |
public: |
|
892.1.1
by Monty Taylor
Fixed virtual overload warnings. |
531 |
using Create_func_arg2::create; |
532 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
533 |
virtual Item *create(Session *session, Item *arg1, Item *arg2); |
1
by brian
clean slate |
534 |
|
535 |
static Create_func_ifnull s_singleton; |
|
536 |
||
537 |
protected: |
|
538 |
Create_func_ifnull() {} |
|
539 |
virtual ~Create_func_ifnull() {} |
|
540 |
};
|
|
541 |
||
542 |
||
543 |
class Create_func_instr : public Create_func_arg2 |
|
544 |
{
|
|
545 |
public: |
|
892.1.1
by Monty Taylor
Fixed virtual overload warnings. |
546 |
using Create_func_arg2::create; |
547 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
548 |
virtual Item *create(Session *session, Item *arg1, Item *arg2); |
1
by brian
clean slate |
549 |
|
550 |
static Create_func_instr s_singleton; |
|
551 |
||
552 |
protected: |
|
553 |
Create_func_instr() {} |
|
554 |
virtual ~Create_func_instr() {} |
|
555 |
};
|
|
556 |
||
557 |
||
558 |
class Create_func_isnull : public Create_func_arg1 |
|
559 |
{
|
|
560 |
public: |
|
892.1.1
by Monty Taylor
Fixed virtual overload warnings. |
561 |
using Create_func_arg1::create; |
562 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
563 |
virtual Item *create(Session *session, Item *arg1); |
1
by brian
clean slate |
564 |
|
565 |
static Create_func_isnull s_singleton; |
|
566 |
||
567 |
protected: |
|
568 |
Create_func_isnull() {} |
|
569 |
virtual ~Create_func_isnull() {} |
|
570 |
};
|
|
571 |
||
572 |
||
573 |
class Create_func_last_day : public Create_func_arg1 |
|
574 |
{
|
|
575 |
public: |
|
892.1.1
by Monty Taylor
Fixed virtual overload warnings. |
576 |
using Create_func_arg1::create; |
577 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
578 |
virtual Item *create(Session *session, Item *arg1); |
1
by brian
clean slate |
579 |
|
580 |
static Create_func_last_day s_singleton; |
|
581 |
||
582 |
protected: |
|
583 |
Create_func_last_day() {} |
|
584 |
virtual ~Create_func_last_day() {} |
|
585 |
};
|
|
586 |
||
587 |
||
588 |
class Create_func_last_insert_id : public Create_native_func |
|
589 |
{
|
|
590 |
public: |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
591 |
virtual Item *create_native(Session *session, LEX_STRING name, List<Item> *item_list); |
1
by brian
clean slate |
592 |
|
593 |
static Create_func_last_insert_id s_singleton; |
|
594 |
||
595 |
protected: |
|
596 |
Create_func_last_insert_id() {} |
|
597 |
virtual ~Create_func_last_insert_id() {} |
|
598 |
};
|
|
599 |
||
600 |
||
601 |
class Create_func_lcase : public Create_func_arg1 |
|
602 |
{
|
|
603 |
public: |
|
892.1.1
by Monty Taylor
Fixed virtual overload warnings. |
604 |
using Create_func_arg1::create; |
605 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
606 |
virtual Item *create(Session *session, Item *arg1); |
1
by brian
clean slate |
607 |
|
608 |
static Create_func_lcase s_singleton; |
|
609 |
||
610 |
protected: |
|
611 |
Create_func_lcase() {} |
|
612 |
virtual ~Create_func_lcase() {} |
|
613 |
};
|
|
614 |
||
615 |
||
616 |
class Create_func_least : public Create_native_func |
|
617 |
{
|
|
618 |
public: |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
619 |
virtual Item *create_native(Session *session, LEX_STRING name, List<Item> *item_list); |
1
by brian
clean slate |
620 |
|
621 |
static Create_func_least s_singleton; |
|
622 |
||
623 |
protected: |
|
624 |
Create_func_least() {} |
|
625 |
virtual ~Create_func_least() {} |
|
626 |
};
|
|
627 |
||
628 |
class Create_func_load_file : public Create_func_arg1 |
|
629 |
{
|
|
630 |
public: |
|
892.1.1
by Monty Taylor
Fixed virtual overload warnings. |
631 |
using Create_func_arg1::create; |
632 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
633 |
virtual Item *create(Session *session, Item *arg1); |
1
by brian
clean slate |
634 |
|
635 |
static Create_func_load_file s_singleton; |
|
636 |
||
637 |
protected: |
|
638 |
Create_func_load_file() {} |
|
639 |
virtual ~Create_func_load_file() {} |
|
640 |
};
|
|
641 |
||
642 |
||
643 |
class Create_func_locate : public Create_native_func |
|
644 |
{
|
|
645 |
public: |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
646 |
virtual Item *create_native(Session *session, LEX_STRING name, List<Item> *item_list); |
1
by brian
clean slate |
647 |
|
648 |
static Create_func_locate s_singleton; |
|
649 |
||
650 |
protected: |
|
651 |
Create_func_locate() {} |
|
652 |
virtual ~Create_func_locate() {} |
|
653 |
};
|
|
654 |
||
655 |
||
656 |
class Create_func_lpad : public Create_func_arg3 |
|
657 |
{
|
|
658 |
public: |
|
892.1.1
by Monty Taylor
Fixed virtual overload warnings. |
659 |
using Create_func_arg3::create; |
660 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
661 |
virtual Item *create(Session *session, Item *arg1, Item *arg2, Item *arg3); |
1
by brian
clean slate |
662 |
|
663 |
static Create_func_lpad s_singleton; |
|
664 |
||
665 |
protected: |
|
666 |
Create_func_lpad() {} |
|
667 |
virtual ~Create_func_lpad() {} |
|
668 |
};
|
|
669 |
||
670 |
||
671 |
class Create_func_ltrim : public Create_func_arg1 |
|
672 |
{
|
|
673 |
public: |
|
892.1.1
by Monty Taylor
Fixed virtual overload warnings. |
674 |
using Create_func_arg1::create; |
675 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
676 |
virtual Item *create(Session *session, Item *arg1); |
1
by brian
clean slate |
677 |
|
678 |
static Create_func_ltrim s_singleton; |
|
679 |
||
680 |
protected: |
|
681 |
Create_func_ltrim() {} |
|
682 |
virtual ~Create_func_ltrim() {} |
|
683 |
};
|
|
684 |
||
685 |
||
686 |
class Create_func_makedate : public Create_func_arg2 |
|
687 |
{
|
|
688 |
public: |
|
892.1.1
by Monty Taylor
Fixed virtual overload warnings. |
689 |
using Create_func_arg2::create; |
690 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
691 |
virtual Item *create(Session *session, Item *arg1, Item *arg2); |
1
by brian
clean slate |
692 |
|
693 |
static Create_func_makedate s_singleton; |
|
694 |
||
695 |
protected: |
|
696 |
Create_func_makedate() {} |
|
697 |
virtual ~Create_func_makedate() {} |
|
698 |
};
|
|
699 |
||
700 |
class Create_func_make_set : public Create_native_func |
|
701 |
{
|
|
702 |
public: |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
703 |
virtual Item *create_native(Session *session, LEX_STRING name, List<Item> *item_list); |
1
by brian
clean slate |
704 |
|
705 |
static Create_func_make_set s_singleton; |
|
706 |
||
707 |
protected: |
|
708 |
Create_func_make_set() {} |
|
709 |
virtual ~Create_func_make_set() {} |
|
710 |
};
|
|
711 |
||
712 |
||
713 |
class Create_func_monthname : public Create_func_arg1 |
|
714 |
{
|
|
715 |
public: |
|
892.1.1
by Monty Taylor
Fixed virtual overload warnings. |
716 |
using Create_func_arg1::create; |
717 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
718 |
virtual Item *create(Session *session, Item *arg1); |
1
by brian
clean slate |
719 |
|
720 |
static Create_func_monthname s_singleton; |
|
721 |
||
722 |
protected: |
|
723 |
Create_func_monthname() {} |
|
724 |
virtual ~Create_func_monthname() {} |
|
725 |
};
|
|
726 |
||
727 |
||
728 |
class Create_func_name_const : public Create_func_arg2 |
|
729 |
{
|
|
730 |
public: |
|
892.1.1
by Monty Taylor
Fixed virtual overload warnings. |
731 |
using Create_func_arg2::create; |
732 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
733 |
virtual Item *create(Session *session, Item *arg1, Item *arg2); |
1
by brian
clean slate |
734 |
|
735 |
static Create_func_name_const s_singleton; |
|
736 |
||
737 |
protected: |
|
738 |
Create_func_name_const() {} |
|
739 |
virtual ~Create_func_name_const() {} |
|
740 |
};
|
|
741 |
||
742 |
||
743 |
class Create_func_nullif : public Create_func_arg2 |
|
744 |
{
|
|
745 |
public: |
|
892.1.1
by Monty Taylor
Fixed virtual overload warnings. |
746 |
using Create_func_arg2::create; |
747 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
748 |
virtual Item *create(Session *session, Item *arg1, Item *arg2); |
1
by brian
clean slate |
749 |
|
750 |
static Create_func_nullif s_singleton; |
|
751 |
||
752 |
protected: |
|
753 |
Create_func_nullif() {} |
|
754 |
virtual ~Create_func_nullif() {} |
|
755 |
};
|
|
756 |
||
757 |
||
758 |
class Create_func_oct : public Create_func_arg1 |
|
759 |
{
|
|
760 |
public: |
|
892.1.1
by Monty Taylor
Fixed virtual overload warnings. |
761 |
using Create_func_arg1::create; |
762 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
763 |
virtual Item *create(Session *session, Item *arg1); |
1
by brian
clean slate |
764 |
|
765 |
static Create_func_oct s_singleton; |
|
766 |
||
767 |
protected: |
|
768 |
Create_func_oct() {} |
|
769 |
virtual ~Create_func_oct() {} |
|
770 |
};
|
|
771 |
||
772 |
class Create_func_period_add : public Create_func_arg2 |
|
773 |
{
|
|
774 |
public: |
|
892.1.1
by Monty Taylor
Fixed virtual overload warnings. |
775 |
using Create_func_arg2::create; |
776 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
777 |
virtual Item *create(Session *session, Item *arg1, Item *arg2); |
1
by brian
clean slate |
778 |
|
779 |
static Create_func_period_add s_singleton; |
|
780 |
||
781 |
protected: |
|
782 |
Create_func_period_add() {} |
|
783 |
virtual ~Create_func_period_add() {} |
|
784 |
};
|
|
785 |
||
786 |
||
787 |
class Create_func_period_diff : public Create_func_arg2 |
|
788 |
{
|
|
789 |
public: |
|
892.1.1
by Monty Taylor
Fixed virtual overload warnings. |
790 |
using Create_func_arg2::create; |
791 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
792 |
virtual Item *create(Session *session, Item *arg1, Item *arg2); |
1
by brian
clean slate |
793 |
|
794 |
static Create_func_period_diff s_singleton; |
|
795 |
||
796 |
protected: |
|
797 |
Create_func_period_diff() {} |
|
798 |
virtual ~Create_func_period_diff() {} |
|
799 |
};
|
|
800 |
||
801 |
||
802 |
class Create_func_pi : public Create_func_arg0 |
|
803 |
{
|
|
804 |
public: |
|
892.1.1
by Monty Taylor
Fixed virtual overload warnings. |
805 |
using Create_func_arg0::create; |
806 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
807 |
virtual Item *create(Session *session); |
1
by brian
clean slate |
808 |
|
809 |
static Create_func_pi s_singleton; |
|
810 |
||
811 |
protected: |
|
812 |
Create_func_pi() {} |
|
813 |
virtual ~Create_func_pi() {} |
|
814 |
};
|
|
815 |
||
816 |
class Create_func_radians : public Create_func_arg1 |
|
817 |
{
|
|
818 |
public: |
|
892.1.1
by Monty Taylor
Fixed virtual overload warnings. |
819 |
using Create_func_arg1::create; |
820 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
821 |
virtual Item *create(Session *session, Item *arg1); |
1
by brian
clean slate |
822 |
|
823 |
static Create_func_radians s_singleton; |
|
824 |
||
825 |
protected: |
|
826 |
Create_func_radians() {} |
|
827 |
virtual ~Create_func_radians() {} |
|
828 |
};
|
|
829 |
||
830 |
||
831 |
class Create_func_round : public Create_native_func |
|
832 |
{
|
|
833 |
public: |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
834 |
virtual Item *create_native(Session *session, LEX_STRING name, List<Item> *item_list); |
1
by brian
clean slate |
835 |
|
836 |
static Create_func_round s_singleton; |
|
837 |
||
838 |
protected: |
|
839 |
Create_func_round() {} |
|
840 |
virtual ~Create_func_round() {} |
|
841 |
};
|
|
842 |
||
843 |
||
844 |
class Create_func_row_count : public Create_func_arg0 |
|
845 |
{
|
|
846 |
public: |
|
892.1.1
by Monty Taylor
Fixed virtual overload warnings. |
847 |
using Create_func_arg0::create; |
848 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
849 |
virtual Item *create(Session *session); |
1
by brian
clean slate |
850 |
|
851 |
static Create_func_row_count s_singleton; |
|
852 |
||
853 |
protected: |
|
854 |
Create_func_row_count() {} |
|
855 |
virtual ~Create_func_row_count() {} |
|
856 |
};
|
|
857 |
||
858 |
||
859 |
class Create_func_rpad : public Create_func_arg3 |
|
860 |
{
|
|
861 |
public: |
|
892.1.1
by Monty Taylor
Fixed virtual overload warnings. |
862 |
using Create_func_arg3::create; |
863 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
864 |
virtual Item *create(Session *session, Item *arg1, Item *arg2, Item *arg3); |
1
by brian
clean slate |
865 |
|
866 |
static Create_func_rpad s_singleton; |
|
867 |
||
868 |
protected: |
|
869 |
Create_func_rpad() {} |
|
870 |
virtual ~Create_func_rpad() {} |
|
871 |
};
|
|
872 |
||
873 |
||
874 |
class Create_func_rtrim : public Create_func_arg1 |
|
875 |
{
|
|
876 |
public: |
|
892.1.1
by Monty Taylor
Fixed virtual overload warnings. |
877 |
using Create_func_arg1::create; |
878 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
879 |
virtual Item *create(Session *session, Item *arg1); |
1
by brian
clean slate |
880 |
|
881 |
static Create_func_rtrim s_singleton; |
|
882 |
||
883 |
protected: |
|
884 |
Create_func_rtrim() {} |
|
885 |
virtual ~Create_func_rtrim() {} |
|
886 |
};
|
|
887 |
||
888 |
class Create_func_sign : public Create_func_arg1 |
|
889 |
{
|
|
890 |
public: |
|
892.1.1
by Monty Taylor
Fixed virtual overload warnings. |
891 |
using Create_func_arg1::create; |
892 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
893 |
virtual Item *create(Session *session, Item *arg1); |
1
by brian
clean slate |
894 |
|
895 |
static Create_func_sign s_singleton; |
|
896 |
||
897 |
protected: |
|
898 |
Create_func_sign() {} |
|
899 |
virtual ~Create_func_sign() {} |
|
900 |
};
|
|
901 |
||
902 |
class Create_func_space : public Create_func_arg1 |
|
903 |
{
|
|
904 |
public: |
|
892.1.1
by Monty Taylor
Fixed virtual overload warnings. |
905 |
using Create_func_arg1::create; |
906 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
907 |
virtual Item *create(Session *session, Item *arg1); |
1
by brian
clean slate |
908 |
|
909 |
static Create_func_space s_singleton; |
|
910 |
||
911 |
protected: |
|
912 |
Create_func_space() {} |
|
913 |
virtual ~Create_func_space() {} |
|
914 |
};
|
|
915 |
||
916 |
class Create_func_strcmp : public Create_func_arg2 |
|
917 |
{
|
|
918 |
public: |
|
892.1.1
by Monty Taylor
Fixed virtual overload warnings. |
919 |
using Create_func_arg2::create; |
920 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
921 |
virtual Item *create(Session *session, Item *arg1, Item *arg2); |
1
by brian
clean slate |
922 |
|
923 |
static Create_func_strcmp s_singleton; |
|
924 |
||
925 |
protected: |
|
926 |
Create_func_strcmp() {} |
|
927 |
virtual ~Create_func_strcmp() {} |
|
928 |
};
|
|
929 |
||
930 |
||
931 |
class Create_func_tan : public Create_func_arg1 |
|
932 |
{
|
|
933 |
public: |
|
892.1.1
by Monty Taylor
Fixed virtual overload warnings. |
934 |
using Create_func_arg1::create; |
935 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
936 |
virtual Item *create(Session *session, Item *arg1); |
1
by brian
clean slate |
937 |
|
938 |
static Create_func_tan s_singleton; |
|
939 |
||
940 |
protected: |
|
941 |
Create_func_tan() {} |
|
942 |
virtual ~Create_func_tan() {} |
|
943 |
};
|
|
944 |
||
945 |
||
946 |
class Create_func_time_format : public Create_func_arg2 |
|
947 |
{
|
|
948 |
public: |
|
892.1.1
by Monty Taylor
Fixed virtual overload warnings. |
949 |
using Create_func_arg2::create; |
950 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
951 |
virtual Item *create(Session *session, Item *arg1, Item *arg2); |
1
by brian
clean slate |
952 |
|
953 |
static Create_func_time_format s_singleton; |
|
954 |
||
955 |
protected: |
|
956 |
Create_func_time_format() {} |
|
957 |
virtual ~Create_func_time_format() {} |
|
958 |
};
|
|
959 |
||
960 |
||
961 |
class Create_func_time_to_sec : public Create_func_arg1 |
|
962 |
{
|
|
963 |
public: |
|
892.1.1
by Monty Taylor
Fixed virtual overload warnings. |
964 |
using Create_func_arg1::create; |
965 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
966 |
virtual Item *create(Session *session, Item *arg1); |
1
by brian
clean slate |
967 |
|
968 |
static Create_func_time_to_sec s_singleton; |
|
969 |
||
970 |
protected: |
|
971 |
Create_func_time_to_sec() {} |
|
972 |
virtual ~Create_func_time_to_sec() {} |
|
973 |
};
|
|
974 |
||
975 |
||
976 |
class Create_func_to_days : public Create_func_arg1 |
|
977 |
{
|
|
978 |
public: |
|
892.1.1
by Monty Taylor
Fixed virtual overload warnings. |
979 |
using Create_func_arg1::create; |
980 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
981 |
virtual Item *create(Session *session, Item *arg1); |
1
by brian
clean slate |
982 |
|
983 |
static Create_func_to_days s_singleton; |
|
984 |
||
985 |
protected: |
|
986 |
Create_func_to_days() {} |
|
987 |
virtual ~Create_func_to_days() {} |
|
988 |
};
|
|
989 |
||
990 |
||
991 |
class Create_func_ucase : public Create_func_arg1 |
|
992 |
{
|
|
993 |
public: |
|
892.1.1
by Monty Taylor
Fixed virtual overload warnings. |
994 |
using Create_func_arg1::create; |
995 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
996 |
virtual Item *create(Session *session, Item *arg1); |
1
by brian
clean slate |
997 |
|
998 |
static Create_func_ucase s_singleton; |
|
999 |
||
1000 |
protected: |
|
1001 |
Create_func_ucase() {} |
|
1002 |
virtual ~Create_func_ucase() {} |
|
1003 |
};
|
|
1004 |
||
1005 |
||
1006 |
class Create_func_unix_timestamp : public Create_native_func |
|
1007 |
{
|
|
1008 |
public: |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1009 |
virtual Item *create_native(Session *session, LEX_STRING name, List<Item> *item_list); |
1
by brian
clean slate |
1010 |
|
1011 |
static Create_func_unix_timestamp s_singleton; |
|
1012 |
||
1013 |
protected: |
|
1014 |
Create_func_unix_timestamp() {} |
|
1015 |
virtual ~Create_func_unix_timestamp() {} |
|
1016 |
};
|
|
1017 |
||
1018 |
||
1019 |
class Create_func_weekday : public Create_func_arg1 |
|
1020 |
{
|
|
1021 |
public: |
|
892.1.1
by Monty Taylor
Fixed virtual overload warnings. |
1022 |
using Create_func_arg1::create; |
1023 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
1024 |
virtual Item *create(Session *session, Item *arg1); |
1
by brian
clean slate |
1025 |
|
1026 |
static Create_func_weekday s_singleton; |
|
1027 |
||
1028 |
protected: |
|
1029 |
Create_func_weekday() {} |
|
1030 |
virtual ~Create_func_weekday() {} |
|
1031 |
};
|
|
1032 |
||
1033 |
/*
|
|
1034 |
=============================================================================
|
|
1035 |
IMPLEMENTATION
|
|
1036 |
=============================================================================
|
|
1037 |
*/
|
|
1038 |
||
1039 |
/**
|
|
1040 |
Checks if there are named parameters in a parameter list.
|
|
1041 |
The syntax to name parameters in a function call is as follow:
|
|
1042 |
<code>foo(expr AS named, expr named, expr AS "named", expr "named")</code>
|
|
1043 |
@param params The parameter list, can be null
|
|
1044 |
@return true if one or more parameter is named
|
|
1045 |
*/
|
|
1046 |
static bool has_named_parameters(List<Item> *params) |
|
1047 |
{
|
|
1048 |
if (params) |
|
1049 |
{
|
|
1050 |
Item *param; |
|
1051 |
List_iterator<Item> it(*params); |
|
1052 |
while ((param= it++)) |
|
1053 |
{
|
|
1054 |
if (! param->is_autogenerated_name) |
|
1055 |
return true; |
|
1056 |
}
|
|
1057 |
}
|
|
1058 |
||
1059 |
return false; |
|
1060 |
}
|
|
1061 |
||
1062 |
||
1063 |
Create_udf_func Create_udf_func::s_singleton; |
|
1064 |
||
1065 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1066 |
Create_udf_func::create(Session *session, LEX_STRING name, List<Item> *item_list) |
1
by brian
clean slate |
1067 |
{
|
1130.1.12
by Monty Taylor
Moved service stuff into plugin/ |
1068 |
const plugin::Function *udf= plugin::Function::get(name.str, name.length); |
51.1.19
by Jay Pipes
Removed/replace DBUG symbols |
1069 |
assert(udf); |
520.1.22
by Brian Aker
Second pass of thd cleanup |
1070 |
return create(session, udf, item_list); |
1
by brian
clean slate |
1071 |
}
|
1072 |
||
1073 |
||
1074 |
Item* |
|
1093.1.62
by Monty Taylor
Moved UDFs to slot organization. |
1075 |
Create_udf_func::create(Session *session, const plugin::Function *udf, |
942.1.12
by Monty Taylor
Converted udf_func into a factory. |
1076 |
List<Item> *item_list) |
1
by brian
clean slate |
1077 |
{
|
139.1.8
by Stewart Smith
UDFs are now normal Item_func objects. Simplifies handling them a lot. |
1078 |
Item_func *func= NULL; |
1
by brian
clean slate |
1079 |
int arg_count= 0; |
1080 |
||
1081 |
if (item_list != NULL) |
|
1082 |
arg_count= item_list->elements; |
|
1083 |
||
942.1.12
by Monty Taylor
Converted udf_func into a factory. |
1084 |
func= (*udf)(session->mem_root); |
139.1.8
by Stewart Smith
UDFs are now normal Item_func objects. Simplifies handling them a lot. |
1085 |
|
997.8.1
by Stewart Smith
Add check for argument numbers for UDFs. Fix crc32 and md5 |
1086 |
if(!func->check_argument_count(arg_count)) |
1087 |
{
|
|
1124.3.2
by Diego Medina
Renamed ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT to ER_WRONG_PARAMCOUNT_TO_FUNCTION |
1088 |
my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), func->func_name()); |
997.8.1
by Stewart Smith
Add check for argument numbers for UDFs. Fix crc32 and md5 |
1089 |
return NULL; |
1090 |
}
|
|
1091 |
||
1092 |
if(item_list) |
|
1093 |
func->set_arguments(*item_list); |
|
139.1.8
by Stewart Smith
UDFs are now normal Item_func objects. Simplifies handling them a lot. |
1094 |
|
1
by brian
clean slate |
1095 |
return func; |
1096 |
}
|
|
1097 |
||
1098 |
||
1099 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1100 |
Create_native_func::create(Session *session, LEX_STRING name, List<Item> *item_list) |
1
by brian
clean slate |
1101 |
{
|
1102 |
if (has_named_parameters(item_list)) |
|
1103 |
{
|
|
1104 |
my_error(ER_WRONG_PARAMETERS_TO_NATIVE_FCT, MYF(0), name.str); |
|
1105 |
return NULL; |
|
1106 |
}
|
|
1107 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
1108 |
return create_native(session, name, item_list); |
1
by brian
clean slate |
1109 |
}
|
1110 |
||
1111 |
||
1112 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1113 |
Create_func_arg0::create(Session *session, LEX_STRING name, List<Item> *item_list) |
1
by brian
clean slate |
1114 |
{
|
1115 |
int arg_count= 0; |
|
1116 |
||
1117 |
if (item_list != NULL) |
|
1118 |
arg_count= item_list->elements; |
|
1119 |
||
1120 |
if (arg_count != 0) |
|
1121 |
{
|
|
1124.3.2
by Diego Medina
Renamed ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT to ER_WRONG_PARAMCOUNT_TO_FUNCTION |
1122 |
my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.str); |
1
by brian
clean slate |
1123 |
return NULL; |
1124 |
}
|
|
1125 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
1126 |
return create(session); |
1
by brian
clean slate |
1127 |
}
|
1128 |
||
1129 |
||
1130 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1131 |
Create_func_arg1::create(Session *session, LEX_STRING name, List<Item> *item_list) |
1
by brian
clean slate |
1132 |
{
|
1133 |
int arg_count= 0; |
|
1134 |
||
1135 |
if (item_list) |
|
1136 |
arg_count= item_list->elements; |
|
1137 |
||
1138 |
if (arg_count != 1) |
|
1139 |
{
|
|
1124.3.2
by Diego Medina
Renamed ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT to ER_WRONG_PARAMCOUNT_TO_FUNCTION |
1140 |
my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.str); |
1
by brian
clean slate |
1141 |
return NULL; |
1142 |
}
|
|
1143 |
||
1144 |
Item *param_1= item_list->pop(); |
|
1145 |
||
1146 |
if (! param_1->is_autogenerated_name) |
|
1147 |
{
|
|
1148 |
my_error(ER_WRONG_PARAMETERS_TO_NATIVE_FCT, MYF(0), name.str); |
|
1149 |
return NULL; |
|
1150 |
}
|
|
1151 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
1152 |
return create(session, param_1); |
1
by brian
clean slate |
1153 |
}
|
1154 |
||
1155 |
||
1156 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1157 |
Create_func_arg2::create(Session *session, LEX_STRING name, List<Item> *item_list) |
1
by brian
clean slate |
1158 |
{
|
1159 |
int arg_count= 0; |
|
1160 |
||
1161 |
if (item_list) |
|
1162 |
arg_count= item_list->elements; |
|
1163 |
||
1164 |
if (arg_count != 2) |
|
1165 |
{
|
|
1124.3.2
by Diego Medina
Renamed ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT to ER_WRONG_PARAMCOUNT_TO_FUNCTION |
1166 |
my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.str); |
1
by brian
clean slate |
1167 |
return NULL; |
1168 |
}
|
|
1169 |
||
1170 |
Item *param_1= item_list->pop(); |
|
1171 |
Item *param_2= item_list->pop(); |
|
1172 |
||
1173 |
if ( (! param_1->is_autogenerated_name) |
|
1174 |
|| (! param_2->is_autogenerated_name)) |
|
1175 |
{
|
|
1176 |
my_error(ER_WRONG_PARAMETERS_TO_NATIVE_FCT, MYF(0), name.str); |
|
1177 |
return NULL; |
|
1178 |
}
|
|
1179 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
1180 |
return create(session, param_1, param_2); |
1
by brian
clean slate |
1181 |
}
|
1182 |
||
1183 |
||
1184 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1185 |
Create_func_arg3::create(Session *session, LEX_STRING name, List<Item> *item_list) |
1
by brian
clean slate |
1186 |
{
|
1187 |
int arg_count= 0; |
|
1188 |
||
1189 |
if (item_list) |
|
1190 |
arg_count= item_list->elements; |
|
1191 |
||
1192 |
if (arg_count != 3) |
|
1193 |
{
|
|
1124.3.2
by Diego Medina
Renamed ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT to ER_WRONG_PARAMCOUNT_TO_FUNCTION |
1194 |
my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.str); |
1
by brian
clean slate |
1195 |
return NULL; |
1196 |
}
|
|
1197 |
||
1198 |
Item *param_1= item_list->pop(); |
|
1199 |
Item *param_2= item_list->pop(); |
|
1200 |
Item *param_3= item_list->pop(); |
|
1201 |
||
1202 |
if ( (! param_1->is_autogenerated_name) |
|
1203 |
|| (! param_2->is_autogenerated_name) |
|
1204 |
|| (! param_3->is_autogenerated_name)) |
|
1205 |
{
|
|
1206 |
my_error(ER_WRONG_PARAMETERS_TO_NATIVE_FCT, MYF(0), name.str); |
|
1207 |
return NULL; |
|
1208 |
}
|
|
1209 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
1210 |
return create(session, param_1, param_2, param_3); |
1
by brian
clean slate |
1211 |
}
|
1212 |
||
1213 |
Create_func_bin Create_func_bin::s_singleton; |
|
1214 |
||
1215 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1216 |
Create_func_bin::create(Session *session, Item *arg1) |
1
by brian
clean slate |
1217 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1218 |
Item *i10= new (session->mem_root) Item_int((int32_t) 10,2); |
1219 |
Item *i2= new (session->mem_root) Item_int((int32_t) 2,1); |
|
1220 |
return new (session->mem_root) Item_func_conv(arg1, i10, i2); |
|
1
by brian
clean slate |
1221 |
}
|
1222 |
||
1223 |
Create_func_concat Create_func_concat::s_singleton; |
|
1224 |
||
1225 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1226 |
Create_func_concat::create_native(Session *session, LEX_STRING name, |
1
by brian
clean slate |
1227 |
List<Item> *item_list) |
1228 |
{
|
|
1229 |
int arg_count= 0; |
|
1230 |
||
1231 |
if (item_list != NULL) |
|
1232 |
arg_count= item_list->elements; |
|
1233 |
||
1234 |
if (arg_count < 1) |
|
1235 |
{
|
|
1124.3.2
by Diego Medina
Renamed ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT to ER_WRONG_PARAMCOUNT_TO_FUNCTION |
1236 |
my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.str); |
1
by brian
clean slate |
1237 |
return NULL; |
1238 |
}
|
|
1239 |
||
1633.4.4
by Brian Aker
Remove more of current_session |
1240 |
return new (session->mem_root) Item_func_concat(*session, *item_list); |
1
by brian
clean slate |
1241 |
}
|
1242 |
||
1243 |
||
1244 |
Create_func_concat_ws Create_func_concat_ws::s_singleton; |
|
1245 |
||
1246 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1247 |
Create_func_concat_ws::create_native(Session *session, LEX_STRING name, |
1
by brian
clean slate |
1248 |
List<Item> *item_list) |
1249 |
{
|
|
1250 |
int arg_count= 0; |
|
1251 |
||
1252 |
if (item_list != NULL) |
|
1253 |
arg_count= item_list->elements; |
|
1254 |
||
1255 |
/* "WS" stands for "With Separator": this function takes 2+ arguments */
|
|
1256 |
if (arg_count < 2) |
|
1257 |
{
|
|
1124.3.2
by Diego Medina
Renamed ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT to ER_WRONG_PARAMCOUNT_TO_FUNCTION |
1258 |
my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.str); |
1
by brian
clean slate |
1259 |
return NULL; |
1260 |
}
|
|
1261 |
||
1633.4.4
by Brian Aker
Remove more of current_session |
1262 |
return new (session->mem_root) Item_func_concat_ws(*session, *item_list); |
1
by brian
clean slate |
1263 |
}
|
1264 |
||
1265 |
||
1266 |
Create_func_conv Create_func_conv::s_singleton; |
|
1267 |
||
1268 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1269 |
Create_func_conv::create(Session *session, Item *arg1, Item *arg2, Item *arg3) |
1
by brian
clean slate |
1270 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1271 |
return new (session->mem_root) Item_func_conv(arg1, arg2, arg3); |
1
by brian
clean slate |
1272 |
}
|
1273 |
||
1274 |
Create_func_cot Create_func_cot::s_singleton; |
|
1275 |
||
1276 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1277 |
Create_func_cot::create(Session *session, Item *arg1) |
1
by brian
clean slate |
1278 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1279 |
Item *i1= new (session->mem_root) Item_int((char*) "1", 1, 1); |
1280 |
Item *i2= new (session->mem_root) Item_func_tan(arg1); |
|
1578.6.7
by Brian Aker
Removed current_session for use to find out current session divide value. |
1281 |
return new (session->mem_root) Item_func_div(session, i1, i2); |
1
by brian
clean slate |
1282 |
}
|
1283 |
||
1284 |
Create_func_date_format Create_func_date_format::s_singleton; |
|
1285 |
||
1286 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1287 |
Create_func_date_format::create(Session *session, Item *arg1, Item *arg2) |
1
by brian
clean slate |
1288 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1289 |
return new (session->mem_root) Item_func_date_format(arg1, arg2, 0); |
1
by brian
clean slate |
1290 |
}
|
1291 |
||
1292 |
||
1293 |
Create_func_datediff Create_func_datediff::s_singleton; |
|
1294 |
||
1295 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1296 |
Create_func_datediff::create(Session *session, Item *arg1, Item *arg2) |
1
by brian
clean slate |
1297 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1298 |
Item *i1= new (session->mem_root) Item_func_to_days(arg1); |
1299 |
Item *i2= new (session->mem_root) Item_func_to_days(arg2); |
|
1
by brian
clean slate |
1300 |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1301 |
return new (session->mem_root) Item_func_minus(i1, i2); |
1
by brian
clean slate |
1302 |
}
|
1303 |
||
1304 |
||
1305 |
Create_func_dayname Create_func_dayname::s_singleton; |
|
1306 |
||
1307 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1308 |
Create_func_dayname::create(Session *session, Item *arg1) |
1
by brian
clean slate |
1309 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1310 |
return new (session->mem_root) Item_func_dayname(arg1); |
1
by brian
clean slate |
1311 |
}
|
1312 |
||
1313 |
||
1314 |
Create_func_dayofmonth Create_func_dayofmonth::s_singleton; |
|
1315 |
||
1316 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1317 |
Create_func_dayofmonth::create(Session *session, Item *arg1) |
1
by brian
clean slate |
1318 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1319 |
return new (session->mem_root) Item_func_dayofmonth(arg1); |
1
by brian
clean slate |
1320 |
}
|
1321 |
||
1322 |
||
1323 |
Create_func_dayofweek Create_func_dayofweek::s_singleton; |
|
1324 |
||
1325 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1326 |
Create_func_dayofweek::create(Session *session, Item *arg1) |
1
by brian
clean slate |
1327 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1328 |
return new (session->mem_root) Item_func_weekday(arg1, 1); |
1
by brian
clean slate |
1329 |
}
|
1330 |
||
1331 |
||
1332 |
Create_func_dayofyear Create_func_dayofyear::s_singleton; |
|
1333 |
||
1334 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1335 |
Create_func_dayofyear::create(Session *session, Item *arg1) |
1
by brian
clean slate |
1336 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1337 |
return new (session->mem_root) Item_func_dayofyear(arg1); |
1
by brian
clean slate |
1338 |
}
|
1339 |
||
1340 |
||
1341 |
Create_func_degrees Create_func_degrees::s_singleton; |
|
1342 |
||
1343 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1344 |
Create_func_degrees::create(Session *session, Item *arg1) |
1
by brian
clean slate |
1345 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1346 |
return new (session->mem_root) Item_func_units((char*) "degrees", arg1, |
1
by brian
clean slate |
1347 |
180/M_PI, 0.0); |
1348 |
}
|
|
1349 |
||
1350 |
Create_func_export_set Create_func_export_set::s_singleton; |
|
1351 |
||
1352 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1353 |
Create_func_export_set::create_native(Session *session, LEX_STRING name, |
1
by brian
clean slate |
1354 |
List<Item> *item_list) |
1355 |
{
|
|
1356 |
Item *func= NULL; |
|
1357 |
int arg_count= 0; |
|
1358 |
||
1359 |
if (item_list != NULL) |
|
1360 |
arg_count= item_list->elements; |
|
1361 |
||
1362 |
switch (arg_count) { |
|
1363 |
case 3: |
|
1364 |
{
|
|
1365 |
Item *param_1= item_list->pop(); |
|
1366 |
Item *param_2= item_list->pop(); |
|
1367 |
Item *param_3= item_list->pop(); |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1368 |
func= new (session->mem_root) Item_func_export_set(param_1, param_2, param_3); |
1
by brian
clean slate |
1369 |
break; |
1370 |
}
|
|
1371 |
case 4: |
|
1372 |
{
|
|
1373 |
Item *param_1= item_list->pop(); |
|
1374 |
Item *param_2= item_list->pop(); |
|
1375 |
Item *param_3= item_list->pop(); |
|
1376 |
Item *param_4= item_list->pop(); |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1377 |
func= new (session->mem_root) Item_func_export_set(param_1, param_2, param_3, |
1
by brian
clean slate |
1378 |
param_4); |
1379 |
break; |
|
1380 |
}
|
|
1381 |
case 5: |
|
1382 |
{
|
|
1383 |
Item *param_1= item_list->pop(); |
|
1384 |
Item *param_2= item_list->pop(); |
|
1385 |
Item *param_3= item_list->pop(); |
|
1386 |
Item *param_4= item_list->pop(); |
|
1387 |
Item *param_5= item_list->pop(); |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1388 |
func= new (session->mem_root) Item_func_export_set(param_1, param_2, param_3, |
1
by brian
clean slate |
1389 |
param_4, param_5); |
1390 |
break; |
|
1391 |
}
|
|
1392 |
default: |
|
1393 |
{
|
|
1124.3.2
by Diego Medina
Renamed ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT to ER_WRONG_PARAMCOUNT_TO_FUNCTION |
1394 |
my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.str); |
1
by brian
clean slate |
1395 |
break; |
1396 |
}
|
|
1397 |
}
|
|
1398 |
||
1399 |
return func; |
|
1400 |
}
|
|
1401 |
||
1402 |
||
1403 |
Create_func_field Create_func_field::s_singleton; |
|
1404 |
||
1405 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1406 |
Create_func_field::create_native(Session *session, LEX_STRING name, |
1
by brian
clean slate |
1407 |
List<Item> *item_list) |
1408 |
{
|
|
1409 |
int arg_count= 0; |
|
1410 |
||
1411 |
if (item_list != NULL) |
|
1412 |
arg_count= item_list->elements; |
|
1413 |
||
1414 |
if (arg_count < 2) |
|
1415 |
{
|
|
1124.3.2
by Diego Medina
Renamed ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT to ER_WRONG_PARAMCOUNT_TO_FUNCTION |
1416 |
my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.str); |
1
by brian
clean slate |
1417 |
return NULL; |
1418 |
}
|
|
1419 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
1420 |
return new (session->mem_root) Item_func_field(*item_list); |
1
by brian
clean slate |
1421 |
}
|
1422 |
||
1423 |
||
1424 |
Create_func_find_in_set Create_func_find_in_set::s_singleton; |
|
1425 |
||
1426 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1427 |
Create_func_find_in_set::create(Session *session, Item *arg1, Item *arg2) |
1
by brian
clean slate |
1428 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1429 |
return new (session->mem_root) Item_func_find_in_set(arg1, arg2); |
1
by brian
clean slate |
1430 |
}
|
1431 |
||
1432 |
Create_func_found_rows Create_func_found_rows::s_singleton; |
|
1433 |
||
1434 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1435 |
Create_func_found_rows::create(Session *session) |
1
by brian
clean slate |
1436 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1437 |
return new (session->mem_root) Item_func_found_rows(); |
1
by brian
clean slate |
1438 |
}
|
1439 |
||
1440 |
||
1441 |
Create_func_from_days Create_func_from_days::s_singleton; |
|
1442 |
||
1443 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1444 |
Create_func_from_days::create(Session *session, Item *arg1) |
1
by brian
clean slate |
1445 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1446 |
return new (session->mem_root) Item_func_from_days(arg1); |
1
by brian
clean slate |
1447 |
}
|
1448 |
||
1449 |
||
1450 |
Create_func_from_unixtime Create_func_from_unixtime::s_singleton; |
|
1451 |
||
1452 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1453 |
Create_func_from_unixtime::create_native(Session *session, LEX_STRING name, |
1
by brian
clean slate |
1454 |
List<Item> *item_list) |
1455 |
{
|
|
1456 |
Item *func= NULL; |
|
1457 |
int arg_count= 0; |
|
1458 |
||
1459 |
if (item_list != NULL) |
|
1460 |
arg_count= item_list->elements; |
|
1461 |
||
1462 |
switch (arg_count) { |
|
1463 |
case 1: |
|
1464 |
{
|
|
1465 |
Item *param_1= item_list->pop(); |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1466 |
func= new (session->mem_root) Item_func_from_unixtime(param_1); |
1
by brian
clean slate |
1467 |
break; |
1468 |
}
|
|
1469 |
case 2: |
|
1470 |
{
|
|
1471 |
Item *param_1= item_list->pop(); |
|
1472 |
Item *param_2= item_list->pop(); |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1473 |
Item *ut= new (session->mem_root) Item_func_from_unixtime(param_1); |
1474 |
func= new (session->mem_root) Item_func_date_format(ut, param_2, 0); |
|
1
by brian
clean slate |
1475 |
break; |
1476 |
}
|
|
1477 |
default: |
|
1478 |
{
|
|
1124.3.2
by Diego Medina
Renamed ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT to ER_WRONG_PARAMCOUNT_TO_FUNCTION |
1479 |
my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.str); |
1
by brian
clean slate |
1480 |
break; |
1481 |
}
|
|
1482 |
}
|
|
1483 |
||
1484 |
return func; |
|
1485 |
}
|
|
1486 |
||
1487 |
||
1488 |
Create_func_greatest Create_func_greatest::s_singleton; |
|
1489 |
||
1490 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1491 |
Create_func_greatest::create_native(Session *session, LEX_STRING name, |
1
by brian
clean slate |
1492 |
List<Item> *item_list) |
1493 |
{
|
|
1494 |
int arg_count= 0; |
|
1495 |
||
1496 |
if (item_list != NULL) |
|
1497 |
arg_count= item_list->elements; |
|
1498 |
||
1499 |
if (arg_count < 2) |
|
1500 |
{
|
|
1124.3.2
by Diego Medina
Renamed ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT to ER_WRONG_PARAMCOUNT_TO_FUNCTION |
1501 |
my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.str); |
1
by brian
clean slate |
1502 |
return NULL; |
1503 |
}
|
|
1504 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
1505 |
return new (session->mem_root) Item_func_max(*item_list); |
1
by brian
clean slate |
1506 |
}
|
1507 |
||
1508 |
Create_func_ifnull Create_func_ifnull::s_singleton; |
|
1509 |
||
1510 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1511 |
Create_func_ifnull::create(Session *session, Item *arg1, Item *arg2) |
1
by brian
clean slate |
1512 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1513 |
return new (session->mem_root) Item_func_ifnull(arg1, arg2); |
1
by brian
clean slate |
1514 |
}
|
1515 |
||
1516 |
||
1517 |
Create_func_instr Create_func_instr::s_singleton; |
|
1518 |
||
1519 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1520 |
Create_func_instr::create(Session *session, Item *arg1, Item *arg2) |
1
by brian
clean slate |
1521 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1522 |
return new (session->mem_root) Item_func_locate(arg1, arg2); |
1
by brian
clean slate |
1523 |
}
|
1524 |
||
1525 |
||
1526 |
Create_func_isnull Create_func_isnull::s_singleton; |
|
1527 |
||
1528 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1529 |
Create_func_isnull::create(Session *session, Item *arg1) |
1
by brian
clean slate |
1530 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1531 |
return new (session->mem_root) Item_func_isnull(arg1); |
1
by brian
clean slate |
1532 |
}
|
1533 |
||
1534 |
||
1535 |
Create_func_last_day Create_func_last_day::s_singleton; |
|
1536 |
||
1537 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1538 |
Create_func_last_day::create(Session *session, Item *arg1) |
1
by brian
clean slate |
1539 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1540 |
return new (session->mem_root) Item_func_last_day(arg1); |
1
by brian
clean slate |
1541 |
}
|
1542 |
||
1543 |
||
1544 |
Create_func_last_insert_id Create_func_last_insert_id::s_singleton; |
|
1545 |
||
1546 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1547 |
Create_func_last_insert_id::create_native(Session *session, LEX_STRING name, |
1
by brian
clean slate |
1548 |
List<Item> *item_list) |
1549 |
{
|
|
1550 |
Item *func= NULL; |
|
1551 |
int arg_count= 0; |
|
1552 |
||
1553 |
if (item_list != NULL) |
|
1554 |
arg_count= item_list->elements; |
|
1555 |
||
1556 |
switch (arg_count) { |
|
1557 |
case 0: |
|
1558 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1559 |
func= new (session->mem_root) Item_func_last_insert_id(); |
1
by brian
clean slate |
1560 |
break; |
1561 |
}
|
|
1562 |
case 1: |
|
1563 |
{
|
|
1564 |
Item *param_1= item_list->pop(); |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1565 |
func= new (session->mem_root) Item_func_last_insert_id(param_1); |
1
by brian
clean slate |
1566 |
break; |
1567 |
}
|
|
1568 |
default: |
|
1569 |
{
|
|
1124.3.2
by Diego Medina
Renamed ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT to ER_WRONG_PARAMCOUNT_TO_FUNCTION |
1570 |
my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.str); |
1
by brian
clean slate |
1571 |
break; |
1572 |
}
|
|
1573 |
}
|
|
1574 |
||
1575 |
return func; |
|
1576 |
}
|
|
1577 |
||
1578 |
||
1579 |
Create_func_lcase Create_func_lcase::s_singleton; |
|
1580 |
||
1581 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1582 |
Create_func_lcase::create(Session *session, Item *arg1) |
1
by brian
clean slate |
1583 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1584 |
return new (session->mem_root) Item_func_lcase(arg1); |
1
by brian
clean slate |
1585 |
}
|
1586 |
||
1587 |
||
1588 |
Create_func_least Create_func_least::s_singleton; |
|
1589 |
||
1590 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1591 |
Create_func_least::create_native(Session *session, LEX_STRING name, |
1
by brian
clean slate |
1592 |
List<Item> *item_list) |
1593 |
{
|
|
1594 |
int arg_count= 0; |
|
1595 |
||
1596 |
if (item_list != NULL) |
|
1597 |
arg_count= item_list->elements; |
|
1598 |
||
1599 |
if (arg_count < 2) |
|
1600 |
{
|
|
1124.3.2
by Diego Medina
Renamed ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT to ER_WRONG_PARAMCOUNT_TO_FUNCTION |
1601 |
my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.str); |
1
by brian
clean slate |
1602 |
return NULL; |
1603 |
}
|
|
1604 |
||
520.1.22
by Brian Aker
Second pass of thd cleanup |
1605 |
return new (session->mem_root) Item_func_min(*item_list); |
1
by brian
clean slate |
1606 |
}
|
1607 |
||
1608 |
Create_func_load_file Create_func_load_file::s_singleton; |
|
1609 |
||
1610 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1611 |
Create_func_load_file::create(Session *session, Item *arg1) |
1
by brian
clean slate |
1612 |
{
|
1633.4.6
by Brian Aker
More current_session issues. |
1613 |
return new (session->mem_root) Item_load_file(*session, arg1); |
1
by brian
clean slate |
1614 |
}
|
1615 |
||
1616 |
||
1617 |
Create_func_locate Create_func_locate::s_singleton; |
|
1618 |
||
1619 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1620 |
Create_func_locate::create_native(Session *session, LEX_STRING name, |
1
by brian
clean slate |
1621 |
List<Item> *item_list) |
1622 |
{
|
|
1623 |
Item *func= NULL; |
|
1624 |
int arg_count= 0; |
|
1625 |
||
1626 |
if (item_list != NULL) |
|
1627 |
arg_count= item_list->elements; |
|
1628 |
||
1629 |
switch (arg_count) { |
|
1630 |
case 2: |
|
1631 |
{
|
|
1632 |
Item *param_1= item_list->pop(); |
|
1633 |
Item *param_2= item_list->pop(); |
|
1634 |
/* Yes, parameters in that order : 2, 1 */
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1635 |
func= new (session->mem_root) Item_func_locate(param_2, param_1); |
1
by brian
clean slate |
1636 |
break; |
1637 |
}
|
|
1638 |
case 3: |
|
1639 |
{
|
|
1640 |
Item *param_1= item_list->pop(); |
|
1641 |
Item *param_2= item_list->pop(); |
|
1642 |
Item *param_3= item_list->pop(); |
|
1643 |
/* Yes, parameters in that order : 2, 1, 3 */
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1644 |
func= new (session->mem_root) Item_func_locate(param_2, param_1, param_3); |
1
by brian
clean slate |
1645 |
break; |
1646 |
}
|
|
1647 |
default: |
|
1648 |
{
|
|
1124.3.2
by Diego Medina
Renamed ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT to ER_WRONG_PARAMCOUNT_TO_FUNCTION |
1649 |
my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.str); |
1
by brian
clean slate |
1650 |
break; |
1651 |
}
|
|
1652 |
}
|
|
1653 |
||
1654 |
return func; |
|
1655 |
}
|
|
1656 |
||
1657 |
Create_func_lpad Create_func_lpad::s_singleton; |
|
1658 |
||
1659 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1660 |
Create_func_lpad::create(Session *session, Item *arg1, Item *arg2, Item *arg3) |
1
by brian
clean slate |
1661 |
{
|
1633.4.6
by Brian Aker
More current_session issues. |
1662 |
return new (session->mem_root) Item_func_lpad(*session, arg1, arg2, arg3); |
1
by brian
clean slate |
1663 |
}
|
1664 |
||
1665 |
||
1666 |
Create_func_ltrim Create_func_ltrim::s_singleton; |
|
1667 |
||
1668 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1669 |
Create_func_ltrim::create(Session *session, Item *arg1) |
1
by brian
clean slate |
1670 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1671 |
return new (session->mem_root) Item_func_ltrim(arg1); |
1
by brian
clean slate |
1672 |
}
|
1673 |
||
1674 |
||
1675 |
Create_func_makedate Create_func_makedate::s_singleton; |
|
1676 |
||
1677 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1678 |
Create_func_makedate::create(Session *session, Item *arg1, Item *arg2) |
1
by brian
clean slate |
1679 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1680 |
return new (session->mem_root) Item_func_makedate(arg1, arg2); |
1
by brian
clean slate |
1681 |
}
|
1682 |
||
1683 |
||
1684 |
Create_func_make_set Create_func_make_set::s_singleton; |
|
1685 |
||
1686 |
Item* |
|
1633.4.6
by Brian Aker
More current_session issues. |
1687 |
Create_func_make_set::create_native(Session *session_arg, LEX_STRING name, |
1
by brian
clean slate |
1688 |
List<Item> *item_list) |
1689 |
{
|
|
1690 |
int arg_count= 0; |
|
1691 |
||
1692 |
if (item_list != NULL) |
|
1693 |
arg_count= item_list->elements; |
|
1694 |
||
1695 |
if (arg_count < 2) |
|
1696 |
{
|
|
1124.3.2
by Diego Medina
Renamed ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT to ER_WRONG_PARAMCOUNT_TO_FUNCTION |
1697 |
my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.str); |
1
by brian
clean slate |
1698 |
return NULL; |
1699 |
}
|
|
1700 |
||
1701 |
Item *param_1= item_list->pop(); |
|
1633.4.6
by Brian Aker
More current_session issues. |
1702 |
return new (session_arg->mem_root) Item_func_make_set(*session_arg, param_1, *item_list); |
1
by brian
clean slate |
1703 |
}
|
1704 |
||
1705 |
||
1706 |
Create_func_monthname Create_func_monthname::s_singleton; |
|
1707 |
||
1708 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1709 |
Create_func_monthname::create(Session *session, Item *arg1) |
1
by brian
clean slate |
1710 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1711 |
return new (session->mem_root) Item_func_monthname(arg1); |
1
by brian
clean slate |
1712 |
}
|
1713 |
||
1714 |
||
1715 |
Create_func_nullif Create_func_nullif::s_singleton; |
|
1716 |
||
1717 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1718 |
Create_func_nullif::create(Session *session, Item *arg1, Item *arg2) |
1
by brian
clean slate |
1719 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1720 |
return new (session->mem_root) Item_func_nullif(arg1, arg2); |
1
by brian
clean slate |
1721 |
}
|
1722 |
||
1723 |
||
1724 |
Create_func_oct Create_func_oct::s_singleton; |
|
1725 |
||
1726 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1727 |
Create_func_oct::create(Session *session, Item *arg1) |
1
by brian
clean slate |
1728 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1729 |
Item *i10= new (session->mem_root) Item_int((int32_t) 10,2); |
1730 |
Item *i8= new (session->mem_root) Item_int((int32_t) 8,1); |
|
1731 |
return new (session->mem_root) Item_func_conv(arg1, i10, i8); |
|
1
by brian
clean slate |
1732 |
}
|
1733 |
||
1734 |
Create_func_period_add Create_func_period_add::s_singleton; |
|
1735 |
||
1736 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1737 |
Create_func_period_add::create(Session *session, Item *arg1, Item *arg2) |
1
by brian
clean slate |
1738 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1739 |
return new (session->mem_root) Item_func_period_add(arg1, arg2); |
1
by brian
clean slate |
1740 |
}
|
1741 |
||
1742 |
||
1743 |
Create_func_period_diff Create_func_period_diff::s_singleton; |
|
1744 |
||
1745 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1746 |
Create_func_period_diff::create(Session *session, Item *arg1, Item *arg2) |
1
by brian
clean slate |
1747 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1748 |
return new (session->mem_root) Item_func_period_diff(arg1, arg2); |
1
by brian
clean slate |
1749 |
}
|
1750 |
||
1751 |
||
1752 |
Create_func_pi Create_func_pi::s_singleton; |
|
1753 |
||
1754 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1755 |
Create_func_pi::create(Session *session) |
1
by brian
clean slate |
1756 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1757 |
return new (session->mem_root) Item_static_float_func("pi()", M_PI, 6, 8); |
1
by brian
clean slate |
1758 |
}
|
1759 |
||
1760 |
Create_func_radians Create_func_radians::s_singleton; |
|
1761 |
||
1762 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1763 |
Create_func_radians::create(Session *session, Item *arg1) |
1
by brian
clean slate |
1764 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1765 |
return new (session->mem_root) Item_func_units((char*) "radians", arg1, |
1
by brian
clean slate |
1766 |
M_PI/180, 0.0); |
1767 |
}
|
|
1768 |
||
1769 |
Create_func_round Create_func_round::s_singleton; |
|
1770 |
||
1771 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1772 |
Create_func_round::create_native(Session *session, LEX_STRING name, |
1
by brian
clean slate |
1773 |
List<Item> *item_list) |
1774 |
{
|
|
1775 |
Item *func= NULL; |
|
1776 |
int arg_count= 0; |
|
1777 |
||
1778 |
if (item_list != NULL) |
|
1779 |
arg_count= item_list->elements; |
|
1780 |
||
1781 |
switch (arg_count) { |
|
1782 |
case 1: |
|
1783 |
{
|
|
1784 |
Item *param_1= item_list->pop(); |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1785 |
Item *i0 = new (session->mem_root) Item_int((char*)"0", 0, 1); |
1786 |
func= new (session->mem_root) Item_func_round(param_1, i0, 0); |
|
1
by brian
clean slate |
1787 |
break; |
1788 |
}
|
|
1789 |
case 2: |
|
1790 |
{
|
|
1791 |
Item *param_1= item_list->pop(); |
|
1792 |
Item *param_2= item_list->pop(); |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1793 |
func= new (session->mem_root) Item_func_round(param_1, param_2, 0); |
1
by brian
clean slate |
1794 |
break; |
1795 |
}
|
|
1796 |
default: |
|
1797 |
{
|
|
1124.3.2
by Diego Medina
Renamed ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT to ER_WRONG_PARAMCOUNT_TO_FUNCTION |
1798 |
my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.str); |
1
by brian
clean slate |
1799 |
break; |
1800 |
}
|
|
1801 |
}
|
|
1802 |
||
1803 |
return func; |
|
1804 |
}
|
|
1805 |
||
1806 |
||
1807 |
Create_func_row_count Create_func_row_count::s_singleton; |
|
1808 |
||
1809 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1810 |
Create_func_row_count::create(Session *session) |
1
by brian
clean slate |
1811 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1812 |
return new (session->mem_root) Item_func_row_count(); |
1
by brian
clean slate |
1813 |
}
|
1814 |
||
1815 |
||
1816 |
Create_func_rpad Create_func_rpad::s_singleton; |
|
1817 |
||
1818 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1819 |
Create_func_rpad::create(Session *session, Item *arg1, Item *arg2, Item *arg3) |
1
by brian
clean slate |
1820 |
{
|
1633.4.6
by Brian Aker
More current_session issues. |
1821 |
return new (session->mem_root) Item_func_rpad(*session, arg1, arg2, arg3); |
1
by brian
clean slate |
1822 |
}
|
1823 |
||
1824 |
||
1825 |
Create_func_rtrim Create_func_rtrim::s_singleton; |
|
1826 |
||
1827 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1828 |
Create_func_rtrim::create(Session *session, Item *arg1) |
1
by brian
clean slate |
1829 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1830 |
return new (session->mem_root) Item_func_rtrim(arg1); |
1
by brian
clean slate |
1831 |
}
|
1832 |
||
1833 |
||
1834 |
Create_func_sign Create_func_sign::s_singleton; |
|
1835 |
||
1836 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1837 |
Create_func_sign::create(Session *session, Item *arg1) |
1
by brian
clean slate |
1838 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1839 |
return new (session->mem_root) Item_func_sign(arg1); |
1
by brian
clean slate |
1840 |
}
|
1841 |
||
1842 |
Create_func_space Create_func_space::s_singleton; |
|
1843 |
||
1844 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1845 |
Create_func_space::create(Session *session, Item *arg1) |
1
by brian
clean slate |
1846 |
{
|
1847 |
/**
|
|
1848 |
TODO: Fix Bug#23637
|
|
1849 |
The parsed item tree should not depend on
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1850 |
<code>session->variables.collation_connection</code>.
|
1
by brian
clean slate |
1851 |
*/
|
748
by Brian Aker
Removal of client side collation. |
1852 |
const CHARSET_INFO * const cs= session->variables.getCollation(); |
1
by brian
clean slate |
1853 |
Item *sp; |
1854 |
||
1855 |
if (cs->mbminlen > 1) |
|
1856 |
{
|
|
1816.3.1
by Brian Aker
Convert sql_string to use size_t (this should clean up ICC warnings). |
1857 |
size_t dummy_errors; |
1022.1.3
by Brian Aker
Force UTF8 (remove the bits for looking for ascii). |
1858 |
sp= new (session->mem_root) Item_string("", 0, cs, DERIVATION_COERCIBLE); |
383.1.12
by Brian Aker
Much closer toward UTF8 being around all the time... |
1859 |
sp->str_value.copy(" ", 1, &my_charset_utf8_general_ci, cs, &dummy_errors); |
1
by brian
clean slate |
1860 |
}
|
1861 |
else
|
|
1862 |
{
|
|
1022.1.3
by Brian Aker
Force UTF8 (remove the bits for looking for ascii). |
1863 |
sp= new (session->mem_root) Item_string(" ", 1, cs, DERIVATION_COERCIBLE); |
1
by brian
clean slate |
1864 |
}
|
1865 |
||
1633.4.5
by Brian Aker
More current_session. |
1866 |
return new (session->mem_root) Item_func_repeat(*session, sp, arg1); |
1
by brian
clean slate |
1867 |
}
|
1868 |
||
1869 |
Create_func_strcmp Create_func_strcmp::s_singleton; |
|
1870 |
||
1871 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1872 |
Create_func_strcmp::create(Session *session, Item *arg1, Item *arg2) |
1
by brian
clean slate |
1873 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1874 |
return new (session->mem_root) Item_func_strcmp(arg1, arg2); |
1
by brian
clean slate |
1875 |
}
|
1876 |
||
1877 |
||
1878 |
Create_func_tan Create_func_tan::s_singleton; |
|
1879 |
||
1880 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1881 |
Create_func_tan::create(Session *session, Item *arg1) |
1
by brian
clean slate |
1882 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1883 |
return new (session->mem_root) Item_func_tan(arg1); |
1
by brian
clean slate |
1884 |
}
|
1885 |
||
1886 |
||
1887 |
Create_func_time_format Create_func_time_format::s_singleton; |
|
1888 |
||
1889 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1890 |
Create_func_time_format::create(Session *session, Item *arg1, Item *arg2) |
1
by brian
clean slate |
1891 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1892 |
return new (session->mem_root) Item_func_date_format(arg1, arg2, 1); |
1
by brian
clean slate |
1893 |
}
|
1894 |
||
1895 |
Create_func_to_days Create_func_to_days::s_singleton; |
|
1896 |
||
1897 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1898 |
Create_func_to_days::create(Session *session, Item *arg1) |
1
by brian
clean slate |
1899 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1900 |
return new (session->mem_root) Item_func_to_days(arg1); |
1
by brian
clean slate |
1901 |
}
|
1902 |
||
1903 |
||
1904 |
Create_func_ucase Create_func_ucase::s_singleton; |
|
1905 |
||
1906 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1907 |
Create_func_ucase::create(Session *session, Item *arg1) |
1
by brian
clean slate |
1908 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1909 |
return new (session->mem_root) Item_func_ucase(arg1); |
1
by brian
clean slate |
1910 |
}
|
1911 |
||
1912 |
Create_func_unix_timestamp Create_func_unix_timestamp::s_singleton; |
|
1913 |
||
1914 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1915 |
Create_func_unix_timestamp::create_native(Session *session, LEX_STRING name, |
1
by brian
clean slate |
1916 |
List<Item> *item_list) |
1917 |
{
|
|
1918 |
Item *func= NULL; |
|
1919 |
int arg_count= 0; |
|
1920 |
||
1921 |
if (item_list != NULL) |
|
1922 |
arg_count= item_list->elements; |
|
1923 |
||
1924 |
switch (arg_count) { |
|
1925 |
case 0: |
|
1926 |
{
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1927 |
func= new (session->mem_root) Item_func_unix_timestamp(); |
1
by brian
clean slate |
1928 |
break; |
1929 |
}
|
|
1930 |
case 1: |
|
1931 |
{
|
|
1932 |
Item *param_1= item_list->pop(); |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1933 |
func= new (session->mem_root) Item_func_unix_timestamp(param_1); |
1
by brian
clean slate |
1934 |
break; |
1935 |
}
|
|
1936 |
default: |
|
1937 |
{
|
|
1124.3.2
by Diego Medina
Renamed ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT to ER_WRONG_PARAMCOUNT_TO_FUNCTION |
1938 |
my_error(ER_WRONG_PARAMCOUNT_TO_FUNCTION, MYF(0), name.str); |
1
by brian
clean slate |
1939 |
break; |
1940 |
}
|
|
1941 |
}
|
|
1942 |
||
1943 |
return func; |
|
1944 |
}
|
|
1945 |
||
1946 |
||
1947 |
Create_func_weekday Create_func_weekday::s_singleton; |
|
1948 |
||
1949 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1950 |
Create_func_weekday::create(Session *session, Item *arg1) |
1
by brian
clean slate |
1951 |
{
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
1952 |
return new (session->mem_root) Item_func_weekday(arg1, 0); |
1
by brian
clean slate |
1953 |
}
|
1954 |
||
1955 |
struct Native_func_registry |
|
1956 |
{
|
|
1957 |
LEX_STRING name; |
|
1958 |
Create_func *builder; |
|
1959 |
};
|
|
1960 |
||
1961 |
#define BUILDER(F) & F::s_singleton
|
|
1962 |
||
1963 |
/*
|
|
1964 |
MySQL native functions.
|
|
1965 |
MAINTAINER:
|
|
1966 |
- Keep sorted for human lookup. At runtime, a hash table is used.
|
|
1967 |
- keep 1 line per entry, it makes grep | sort easier
|
|
1968 |
*/
|
|
1969 |
||
1970 |
static Native_func_registry func_array[] = |
|
1971 |
{
|
|
1972 |
{ { C_STRING_WITH_LEN("BIN") }, BUILDER(Create_func_bin)}, |
|
1973 |
{ { C_STRING_WITH_LEN("CONCAT") }, BUILDER(Create_func_concat)}, |
|
1974 |
{ { C_STRING_WITH_LEN("CONCAT_WS") }, BUILDER(Create_func_concat_ws)}, |
|
1975 |
{ { C_STRING_WITH_LEN("CONV") }, BUILDER(Create_func_conv)}, |
|
1976 |
{ { C_STRING_WITH_LEN("COT") }, BUILDER(Create_func_cot)}, |
|
1977 |
{ { C_STRING_WITH_LEN("DATEDIFF") }, BUILDER(Create_func_datediff)}, |
|
1978 |
{ { C_STRING_WITH_LEN("DATE_FORMAT") }, BUILDER(Create_func_date_format)}, |
|
1979 |
{ { C_STRING_WITH_LEN("DAYNAME") }, BUILDER(Create_func_dayname)}, |
|
1980 |
{ { C_STRING_WITH_LEN("DAYOFMONTH") }, BUILDER(Create_func_dayofmonth)}, |
|
1981 |
{ { C_STRING_WITH_LEN("DAYOFWEEK") }, BUILDER(Create_func_dayofweek)}, |
|
1982 |
{ { C_STRING_WITH_LEN("DAYOFYEAR") }, BUILDER(Create_func_dayofyear)}, |
|
1983 |
{ { C_STRING_WITH_LEN("DEGREES") }, BUILDER(Create_func_degrees)}, |
|
1984 |
{ { C_STRING_WITH_LEN("EXPORT_SET") }, BUILDER(Create_func_export_set)}, |
|
1985 |
{ { C_STRING_WITH_LEN("FIELD") }, BUILDER(Create_func_field)}, |
|
1986 |
{ { C_STRING_WITH_LEN("FIND_IN_SET") }, BUILDER(Create_func_find_in_set)}, |
|
1987 |
{ { C_STRING_WITH_LEN("FOUND_ROWS") }, BUILDER(Create_func_found_rows)}, |
|
1988 |
{ { C_STRING_WITH_LEN("FROM_DAYS") }, BUILDER(Create_func_from_days)}, |
|
1989 |
{ { C_STRING_WITH_LEN("FROM_UNIXTIME") }, BUILDER(Create_func_from_unixtime)}, |
|
1990 |
{ { C_STRING_WITH_LEN("GREATEST") }, BUILDER(Create_func_greatest)}, |
|
1991 |
{ { C_STRING_WITH_LEN("IFNULL") }, BUILDER(Create_func_ifnull)}, |
|
1992 |
{ { C_STRING_WITH_LEN("INSTR") }, BUILDER(Create_func_instr)}, |
|
1993 |
{ { C_STRING_WITH_LEN("ISNULL") }, BUILDER(Create_func_isnull)}, |
|
1994 |
{ { C_STRING_WITH_LEN("LAST_DAY") }, BUILDER(Create_func_last_day)}, |
|
1995 |
{ { C_STRING_WITH_LEN("LAST_INSERT_ID") }, BUILDER(Create_func_last_insert_id)}, |
|
1996 |
{ { C_STRING_WITH_LEN("LCASE") }, BUILDER(Create_func_lcase)}, |
|
1997 |
{ { C_STRING_WITH_LEN("LEAST") }, BUILDER(Create_func_least)}, |
|
1998 |
{ { C_STRING_WITH_LEN("LOAD_FILE") }, BUILDER(Create_func_load_file)}, |
|
1999 |
{ { C_STRING_WITH_LEN("LOCATE") }, BUILDER(Create_func_locate)}, |
|
2000 |
{ { C_STRING_WITH_LEN("LOWER") }, BUILDER(Create_func_lcase)}, |
|
2001 |
{ { C_STRING_WITH_LEN("LPAD") }, BUILDER(Create_func_lpad)}, |
|
2002 |
{ { C_STRING_WITH_LEN("LTRIM") }, BUILDER(Create_func_ltrim)}, |
|
2003 |
{ { C_STRING_WITH_LEN("MAKEDATE") }, BUILDER(Create_func_makedate)}, |
|
2004 |
{ { C_STRING_WITH_LEN("MAKE_SET") }, BUILDER(Create_func_make_set)}, |
|
2005 |
{ { C_STRING_WITH_LEN("MONTHNAME") }, BUILDER(Create_func_monthname)}, |
|
2006 |
{ { C_STRING_WITH_LEN("NULLIF") }, BUILDER(Create_func_nullif)}, |
|
2007 |
{ { C_STRING_WITH_LEN("OCT") }, BUILDER(Create_func_oct)}, |
|
2008 |
{ { C_STRING_WITH_LEN("PERIOD_ADD") }, BUILDER(Create_func_period_add)}, |
|
2009 |
{ { C_STRING_WITH_LEN("PERIOD_DIFF") }, BUILDER(Create_func_period_diff)}, |
|
2010 |
{ { C_STRING_WITH_LEN("PI") }, BUILDER(Create_func_pi)}, |
|
2011 |
{ { C_STRING_WITH_LEN("RADIANS") }, BUILDER(Create_func_radians)}, |
|
2012 |
{ { C_STRING_WITH_LEN("ROUND") }, BUILDER(Create_func_round)}, |
|
2013 |
{ { C_STRING_WITH_LEN("ROW_COUNT") }, BUILDER(Create_func_row_count)}, |
|
2014 |
{ { C_STRING_WITH_LEN("RPAD") }, BUILDER(Create_func_rpad)}, |
|
2015 |
{ { C_STRING_WITH_LEN("RTRIM") }, BUILDER(Create_func_rtrim)}, |
|
2016 |
{ { C_STRING_WITH_LEN("SIGN") }, BUILDER(Create_func_sign)}, |
|
2017 |
{ { C_STRING_WITH_LEN("SPACE") }, BUILDER(Create_func_space)}, |
|
2018 |
{ { C_STRING_WITH_LEN("STRCMP") }, BUILDER(Create_func_strcmp)}, |
|
2019 |
{ { C_STRING_WITH_LEN("TAN") }, BUILDER(Create_func_tan)}, |
|
2020 |
{ { C_STRING_WITH_LEN("TIME_FORMAT") }, BUILDER(Create_func_time_format)}, |
|
2021 |
{ { C_STRING_WITH_LEN("TO_DAYS") }, BUILDER(Create_func_to_days)}, |
|
2022 |
{ { C_STRING_WITH_LEN("UCASE") }, BUILDER(Create_func_ucase)}, |
|
2023 |
{ { C_STRING_WITH_LEN("UNIX_TIMESTAMP") }, BUILDER(Create_func_unix_timestamp)}, |
|
2024 |
{ { C_STRING_WITH_LEN("UPPER") }, BUILDER(Create_func_ucase)}, |
|
2025 |
{ { C_STRING_WITH_LEN("WEEKDAY") }, BUILDER(Create_func_weekday)}, |
|
2026 |
||
2027 |
{ {0, 0}, NULL} |
|
2028 |
};
|
|
2029 |
||
2030 |
/*
|
|
2031 |
Load the hash table for native functions.
|
|
2032 |
Note: this code is not thread safe, and is intended to be used at server
|
|
2033 |
startup only (before going multi-threaded)
|
|
2034 |
*/
|
|
2035 |
||
2036 |
int item_create_init() |
|
2037 |
{
|
|
873.2.19
by Monty Taylor
Removed another HASH and another set of useless utf8 hashing. |
2038 |
string func_name; |
2039 |
||
1
by brian
clean slate |
2040 |
Native_func_registry *func; |
2041 |
for (func= func_array; func->builder != NULL; func++) |
|
2042 |
{
|
|
873.2.19
by Monty Taylor
Removed another HASH and another set of useless utf8 hashing. |
2043 |
func_name.assign(func->name.str, func->name.length); |
2044 |
||
1751.3.3
by Brian Aker
Shuffle native functions over to hash such that we have a specific container |
2045 |
FunctionContainer::getMap()[func_name]= func; |
51.1.19
by Jay Pipes
Removed/replace DBUG symbols |
2046 |
}
|
2047 |
||
873.2.19
by Monty Taylor
Removed another HASH and another set of useless utf8 hashing. |
2048 |
return 0; |
2049 |
}
|
|
2050 |
||
1
by brian
clean slate |
2051 |
|
2052 |
Create_func * |
|
873.2.19
by Monty Taylor
Removed another HASH and another set of useless utf8 hashing. |
2053 |
find_native_function_builder(LEX_STRING name) |
1
by brian
clean slate |
2054 |
{
|
2055 |
Native_func_registry *func; |
|
2056 |
Create_func *builder= NULL; |
|
2057 |
||
873.2.19
by Monty Taylor
Removed another HASH and another set of useless utf8 hashing. |
2058 |
string func_name(name.str, name.length); |
2059 |
||
1751.3.3
by Brian Aker
Shuffle native functions over to hash such that we have a specific container |
2060 |
NativeFunctionsMap::iterator func_iter= |
2061 |
FunctionContainer::getMap().find(func_name); |
|
873.2.19
by Monty Taylor
Removed another HASH and another set of useless utf8 hashing. |
2062 |
|
1751.3.3
by Brian Aker
Shuffle native functions over to hash such that we have a specific container |
2063 |
if (func_iter != FunctionContainer::getMap().end()) |
1
by brian
clean slate |
2064 |
{
|
873.2.19
by Monty Taylor
Removed another HASH and another set of useless utf8 hashing. |
2065 |
func= (*func_iter).second; |
1
by brian
clean slate |
2066 |
builder= func->builder; |
2067 |
}
|
|
2068 |
||
2069 |
return builder; |
|
2070 |
}
|
|
2071 |
||
2072 |
||
2073 |
Item* |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2074 |
create_func_char_cast(Session *session, Item *a, int len, const CHARSET_INFO * const cs) |
1
by brian
clean slate |
2075 |
{
|
748
by Brian Aker
Removal of client side collation. |
2076 |
const CHARSET_INFO * const real_cs= (cs ? cs : session->variables.getCollation()); |
520.1.22
by Brian Aker
Second pass of thd cleanup |
2077 |
return new (session->mem_root) Item_char_typecast(a, len, real_cs); |
1
by brian
clean slate |
2078 |
}
|
2079 |
||
2080 |
||
2081 |
Item * |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2082 |
create_func_cast(Session *session, Item *a, Cast_target cast_type, |
1
by brian
clean slate |
2083 |
const char *c_len, const char *c_dec, |
264.2.6
by Andrey Hristov
Constify the usage of CHARSET_INFO almost to the last place in the code. |
2084 |
const CHARSET_INFO * const cs) |
1
by brian
clean slate |
2085 |
{
|
2086 |
Item *res; |
|
290
by Brian Aker
Update for ulong change over. |
2087 |
uint32_t len; |
482
by Brian Aker
Remove uint. |
2088 |
uint32_t dec; |
1
by brian
clean slate |
2089 |
|
2090 |
switch (cast_type) { |
|
2091 |
case ITEM_CAST_BINARY: |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2092 |
res= new (session->mem_root) Item_func_binary(a); |
1
by brian
clean slate |
2093 |
break; |
2094 |
case ITEM_CAST_DATE: |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2095 |
res= new (session->mem_root) Item_date_typecast(a); |
1
by brian
clean slate |
2096 |
break; |
2097 |
case ITEM_CAST_DATETIME: |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2098 |
res= new (session->mem_root) Item_datetime_typecast(a); |
1
by brian
clean slate |
2099 |
break; |
2100 |
case ITEM_CAST_DECIMAL: |
|
2101 |
{
|
|
2102 |
len= c_len ? atoi(c_len) : 0; |
|
2103 |
dec= c_dec ? atoi(c_dec) : 0; |
|
2104 |
my_decimal_trim(&len, &dec); |
|
2105 |
if (len < dec) |
|
2106 |
{
|
|
2107 |
my_error(ER_M_BIGGER_THAN_D, MYF(0), ""); |
|
2108 |
return 0; |
|
2109 |
}
|
|
2110 |
if (len > DECIMAL_MAX_PRECISION) |
|
2111 |
{
|
|
2112 |
my_error(ER_TOO_BIG_PRECISION, MYF(0), len, a->name, |
|
2113 |
DECIMAL_MAX_PRECISION); |
|
2114 |
return 0; |
|
2115 |
}
|
|
2116 |
if (dec > DECIMAL_MAX_SCALE) |
|
2117 |
{
|
|
2118 |
my_error(ER_TOO_BIG_SCALE, MYF(0), dec, a->name, |
|
2119 |
DECIMAL_MAX_SCALE); |
|
2120 |
return 0; |
|
2121 |
}
|
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2122 |
res= new (session->mem_root) Item_decimal_typecast(a, len, dec); |
1
by brian
clean slate |
2123 |
break; |
2124 |
}
|
|
2125 |
case ITEM_CAST_CHAR: |
|
2126 |
{
|
|
2127 |
len= c_len ? atoi(c_len) : -1; |
|
520.1.22
by Brian Aker
Second pass of thd cleanup |
2128 |
res= create_func_char_cast(session, a, len, cs); |
1
by brian
clean slate |
2129 |
break; |
2130 |
}
|
|
2131 |
default: |
|
2132 |
{
|
|
51.1.19
by Jay Pipes
Removed/replace DBUG symbols |
2133 |
assert(0); |
1
by brian
clean slate |
2134 |
res= 0; |
2135 |
break; |
|
2136 |
}
|
|
2137 |
}
|
|
2138 |
return res; |
|
2139 |
}
|
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
2140 |
|
2141 |
} /* namespace drizzled */ |