1 /*
2    Copyright (c) 2000, 2021, Oracle and/or its affiliates.
3 
4    This program is free software; you can redistribute it and/or modify
5    it under the terms of the GNU General Public License, version 2.0,
6    as published by the Free Software Foundation.
7 
8    This program is also distributed with certain software (including
9    but not limited to OpenSSL) that is licensed under separate terms,
10    as designated in a particular file or component or in included license
11    documentation.  The authors of MySQL hereby grant you an additional
12    permission to link the program and your derivative works with the
13    separately licensed software that they have included with MySQL.
14 
15    This program is distributed in the hope that it will be useful,
16    but WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18    GNU General Public License, version 2.0, for more details.
19 
20    You should have received a copy of the GNU General Public License
21    along with this program; if not, write to the Free Software
22    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
23 
24 /**
25   @file
26 
27   @brief
28   Functions to create an item. Used by sql_yac.yy
29 */
30 
31 #include "item_create.h"
32 
33 #include "item_cmpfunc.h"        // Item_func_any_value
34 #include "item_func.h"           // Item_func_udf_str
35 #include "item_geofunc.h"        // Item_func_area
36 #include "item_inetfunc.h"       // Item_func_inet_ntoa
37 #include "item_json_func.h"      // Item_func_json
38 #include "item_strfunc.h"        // Item_func_aes_encrypt
39 #include "item_sum.h"            // Item_sum_udf_str
40 #include "item_timefunc.h"       // Item_func_add_time
41 #include "item_xmlfunc.h"        // Item_func_xml_extractvalue
42 #include "parse_tree_helpers.h"  // PT_item_list
43 #include "sql_class.h"           // THD
44 #include "sql_time.h"            // str_to_datetime
45 
46 /*
47 =============================================================================
48   LOCAL DECLARATIONS
49 =============================================================================
50 */
51 
52 /**
53   Adapter for native functions with a variable number of arguments.
54   The main use of this class is to discard the following calls:
55   <code>foo(expr1 AS name1, expr2 AS name2, ...)</code>
56   which are syntactically correct (the syntax can refer to a UDF),
57   but semantically invalid for native functions.
58 */
59 
60 class Create_native_func : public Create_func
61 {
62 public:
63   virtual Item *create_func(THD *thd, LEX_STRING name, PT_item_list *item_list);
64 
65   /**
66     Builder method, with no arguments.
67     @param thd The current thread
68     @param name The native function name
69     @param item_list The function parameters, none of which are named
70     @return An item representing the function call
71   */
72   virtual Item *create_native(THD *thd, LEX_STRING name,
73                               PT_item_list *item_list) = 0;
74 
75 protected:
76   /** Constructor. */
Create_native_func()77   Create_native_func() {}
78   /** Destructor. */
~Create_native_func()79   virtual ~Create_native_func() {}
80 };
81 
82 
83 /**
84   Adapter for functions that takes exactly zero arguments.
85 */
86 
87 class Create_func_arg0 : public Create_func
88 {
89 public:
90   virtual Item *create_func(THD *thd, LEX_STRING name, PT_item_list *item_list);
91 
92   /**
93     Builder method, with no arguments.
94     @param thd The current thread
95     @return An item representing the function call
96   */
97   virtual Item *create(THD *thd) = 0;
98 
99 protected:
100   /** Constructor. */
Create_func_arg0()101   Create_func_arg0() {}
102   /** Destructor. */
~Create_func_arg0()103   virtual ~Create_func_arg0() {}
104 };
105 
106 
107 /**
108   Adapter for functions that takes exactly one argument.
109 */
110 
111 class Create_func_arg1 : public Create_func
112 {
113 public:
114   virtual Item *create_func(THD *thd, LEX_STRING name, PT_item_list *item_list);
115 
116   /**
117     Builder method, with one argument.
118     @param thd The current thread
119     @param arg1 The first argument of the function
120     @return An item representing the function call
121   */
122   virtual Item *create(THD *thd, Item *arg1) = 0;
123 
124 protected:
125   /** Constructor. */
Create_func_arg1()126   Create_func_arg1() {}
127   /** Destructor. */
~Create_func_arg1()128   virtual ~Create_func_arg1() {}
129 };
130 
131 
132 /**
133   Adapter for functions that takes exactly two arguments.
134 */
135 
136 class Create_func_arg2 : public Create_func
137 {
138 public:
139   virtual Item *create_func(THD *thd, LEX_STRING name, PT_item_list *item_list);
140 
141   /**
142     Builder method, with two arguments.
143     @param thd The current thread
144     @param arg1 The first argument of the function
145     @param arg2 The second argument of the function
146     @return An item representing the function call
147   */
148   virtual Item *create(THD *thd, Item *arg1, Item *arg2) = 0;
149 
150 protected:
151   /** Constructor. */
Create_func_arg2()152   Create_func_arg2() {}
153   /** Destructor. */
~Create_func_arg2()154   virtual ~Create_func_arg2() {}
155 };
156 
157 
158 /**
159   Adapter for functions that takes exactly three arguments.
160 */
161 
162 class Create_func_arg3 : public Create_func
163 {
164 public:
165   virtual Item *create_func(THD *thd, LEX_STRING name, PT_item_list *item_list);
166 
167   /**
168     Builder method, with three arguments.
169     @param thd The current thread
170     @param arg1 The first argument of the function
171     @param arg2 The second argument of the function
172     @param arg3 The third argument of the function
173     @return An item representing the function call
174   */
175   virtual Item *create(THD *thd, Item *arg1, Item *arg2, Item *arg3) = 0;
176 
177 protected:
178   /** Constructor. */
Create_func_arg3()179   Create_func_arg3() {}
180   /** Destructor. */
~Create_func_arg3()181   virtual ~Create_func_arg3() {}
182 };
183 
184 
185 /**
186   Function builder for Stored Functions.
187 */
188 
189 class Create_sp_func : public Create_qfunc
190 {
191 public:
192   virtual Item *create(THD *thd, LEX_STRING db, LEX_STRING name,
193                        bool use_explicit_name, PT_item_list *item_list);
194 
195   static Create_sp_func s_singleton;
196 
197 protected:
198   /** Constructor. */
Create_sp_func()199   Create_sp_func() {}
200   /** Destructor. */
~Create_sp_func()201   virtual ~Create_sp_func() {}
202 };
203 
204 
205 
206 
207 /*
208   Concrete functions builders (native functions).
209   Please keep this list sorted in alphabetical order,
210   it helps to compare code between versions, and helps with merges conflicts.
211 */
212 
213 class Create_func_abs : public Create_func_arg1
214 {
215 public:
216   virtual Item *create(THD *thd, Item *arg1);
217 
218   static Create_func_abs s_singleton;
219 
220 protected:
Create_func_abs()221   Create_func_abs() {}
~Create_func_abs()222   virtual ~Create_func_abs() {}
223 };
224 
225 
226 class Create_func_acos : public Create_func_arg1
227 {
228 public:
229   virtual Item *create(THD *thd, Item *arg1);
230 
231   static Create_func_acos s_singleton;
232 
233 protected:
Create_func_acos()234   Create_func_acos() {}
~Create_func_acos()235   virtual ~Create_func_acos() {}
236 };
237 
238 
239 class Create_func_addtime : public Create_func_arg2
240 {
241 public:
242   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
243 
244   static Create_func_addtime s_singleton;
245 
246 protected:
Create_func_addtime()247   Create_func_addtime() {}
~Create_func_addtime()248   virtual ~Create_func_addtime() {}
249 };
250 
251 class Create_func_aes_base : public Create_native_func
252 {
253 public:
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)254   virtual Item *create_native(THD *thd, LEX_STRING name,
255                               PT_item_list *item_list)
256   {
257     Item *func= NULL, *p1, *p2, *p3;
258     int arg_count= 0;
259 
260     if (item_list != NULL)
261       arg_count= item_list->elements();
262 
263     switch (arg_count)
264     {
265     case 2:
266       {
267         p1= item_list->pop_front();
268         p2= item_list->pop_front();
269         func= create_aes(thd, p1, p2);
270         break;
271       }
272     case 3:
273       {
274         p1= item_list->pop_front();
275         p2= item_list->pop_front();
276         p3= item_list->pop_front();
277         func= create_aes(thd, p1, p2, p3);
278         break;
279       }
280     default:
281       {
282         my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
283         break;
284       }
285     }
286     return func;
287 
288   }
289   virtual Item *create_aes(THD *thd, Item *arg1, Item *arg2)= 0;
290   virtual Item *create_aes(THD *thd, Item *arg1, Item *arg2, Item *arg3)= 0;
291 protected:
Create_func_aes_base()292   Create_func_aes_base()
293   {}
~Create_func_aes_base()294   virtual ~Create_func_aes_base()
295   {}
296 
297 };
298 
299 
300 class Create_func_aes_encrypt : public Create_func_aes_base
301 {
302 public:
create_aes(THD * thd,Item * arg1,Item * arg2)303   virtual Item *create_aes(THD *thd, Item *arg1, Item *arg2)
304   {
305     return new (thd->mem_root) Item_func_aes_encrypt(POS(), arg1, arg2);
306   }
create_aes(THD * thd,Item * arg1,Item * arg2,Item * arg3)307   virtual Item *create_aes(THD *thd, Item *arg1, Item *arg2, Item *arg3)
308   {
309     return new (thd->mem_root) Item_func_aes_encrypt(POS(), arg1, arg2, arg3);
310   }
311 
312   static Create_func_aes_encrypt s_singleton;
313 
314 protected:
Create_func_aes_encrypt()315   Create_func_aes_encrypt() {}
~Create_func_aes_encrypt()316   virtual ~Create_func_aes_encrypt() {}
317 };
318 
319 
320 class Create_func_aes_decrypt : public Create_func_aes_base
321 {
322 public:
create_aes(THD * thd,Item * arg1,Item * arg2)323   virtual Item *create_aes(THD *thd, Item *arg1, Item *arg2)
324   {
325     return new (thd->mem_root) Item_func_aes_decrypt(POS(), arg1, arg2);
326   }
create_aes(THD * thd,Item * arg1,Item * arg2,Item * arg3)327   virtual Item *create_aes(THD *thd, Item *arg1, Item *arg2, Item *arg3)
328   {
329     return new (thd->mem_root) Item_func_aes_decrypt(POS(), arg1, arg2, arg3);
330   }
331 
332   static Create_func_aes_decrypt s_singleton;
333 
334 protected:
Create_func_aes_decrypt()335   Create_func_aes_decrypt() {}
~Create_func_aes_decrypt()336   virtual ~Create_func_aes_decrypt() {}
337 };
338 
339 
340 class Create_func_random_bytes : public Create_func_arg1
341 {
342 public:
create(THD * thd,Item * arg1)343   virtual Item *create(THD *thd, Item *arg1)
344   {
345     return new (thd->mem_root) Item_func_random_bytes(POS(), arg1);
346   }
347   static Create_func_random_bytes s_singleton;
348 
349 protected:
Create_func_random_bytes()350   Create_func_random_bytes()
351   {}
~Create_func_random_bytes()352   virtual ~Create_func_random_bytes()
353   {}
354 };
355 
356 
357 class Create_func_any_value : public Create_func_arg1
358 {
359 public:
create(THD * thd,Item * arg1)360   virtual Item *create(THD *thd, Item *arg1)
361   { return new (thd->mem_root) Item_func_any_value(POS(), arg1); }
362 
363   static Create_func_any_value s_singleton;
364 
365 protected:
Create_func_any_value()366   Create_func_any_value() {}
~Create_func_any_value()367   virtual ~Create_func_any_value() {}
368 };
369 
370 
371 class Create_func_area : public Create_func_arg1
372 {
373 public:
374   virtual Item *create(THD *thd, Item *arg1);
375 
376   static Create_func_area s_singleton;
377 
378 protected:
Create_func_area()379   Create_func_area() {}
~Create_func_area()380   virtual ~Create_func_area() {}
381 };
382 
383 
384 class Create_func_area_deprecated : public Create_func_area
385 {
386 public:
create(THD * thd,Item * arg1)387   virtual Item *create(THD *thd, Item *arg1)
388   {
389     push_deprecated_warn(thd, "AREA", "ST_AREA");
390     return Create_func_area::create(thd, arg1);
391   }
392 
393   static Create_func_area_deprecated s_singleton;
394 };
395 Create_func_area_deprecated Create_func_area_deprecated::s_singleton;
396 
397 
398 class Create_func_as_geojson : public Create_native_func
399 {
400 public:
401   virtual Item *create_native(THD *thd, LEX_STRING name,
402                               PT_item_list *item_list);
403 
404   static Create_func_as_geojson s_singleton;
405 
406 protected:
Create_func_as_geojson()407   Create_func_as_geojson() {}
~Create_func_as_geojson()408   virtual ~Create_func_as_geojson() {}
409 };
410 
411 
412 class Create_func_as_wkb : public Create_func_arg1
413 {
414 public:
415   virtual Item *create(THD *thd, Item *arg1);
416 
417   static Create_func_as_wkb s_singleton;
418 
419 protected:
Create_func_as_wkb()420   Create_func_as_wkb() {}
~Create_func_as_wkb()421   virtual ~Create_func_as_wkb() {}
422 };
423 
424 
425 class Create_func_as_binary_deprecated : public Create_func_as_wkb
426 {
427 public:
create(THD * thd,Item * arg1)428   virtual Item *create(THD *thd, Item *arg1)
429   {
430     push_deprecated_warn(thd, "ASBINARY", "ST_ASBINARY");
431     return Create_func_as_wkb::create(thd, arg1);
432   }
433 
434   static Create_func_as_binary_deprecated s_singleton;
435 };
436 Create_func_as_binary_deprecated Create_func_as_binary_deprecated::s_singleton;
437 
438 
439 class Create_func_as_wkb_deprecated : public Create_func_as_wkb
440 {
441 public:
create(THD * thd,Item * arg1)442   virtual Item *create(THD *thd, Item *arg1)
443   {
444     push_deprecated_warn(thd, "ASWKB", "ST_ASWKB");
445     return Create_func_as_wkb::create(thd, arg1);
446   }
447 
448   static Create_func_as_wkb_deprecated s_singleton;
449 };
450 Create_func_as_wkb_deprecated Create_func_as_wkb_deprecated::s_singleton;
451 
452 
453 class Create_func_as_wkt : public Create_func_arg1
454 {
455 public:
456   virtual Item *create(THD *thd, Item *arg1);
457 
458   static Create_func_as_wkt s_singleton;
459 
460 protected:
Create_func_as_wkt()461   Create_func_as_wkt() {}
~Create_func_as_wkt()462   virtual ~Create_func_as_wkt() {}
463 };
464 
465 
466 class Create_func_as_text_deprecated : public Create_func_as_wkt
467 {
468 public:
create(THD * thd,Item * arg1)469   virtual Item *create(THD *thd, Item *arg1)
470   {
471     push_deprecated_warn(thd, "ASTEXT", "ST_ASTEXT");
472     return Create_func_as_wkt::create(thd, arg1);
473   }
474 
475   static Create_func_as_text_deprecated s_singleton;
476 };
477 Create_func_as_text_deprecated Create_func_as_text_deprecated::s_singleton;
478 
479 
480 class Create_func_as_wkt_deprecated : public Create_func_as_wkt
481 {
482 public:
create(THD * thd,Item * arg1)483   virtual Item *create(THD *thd, Item *arg1)
484   {
485     push_deprecated_warn(thd, "ASWKT", "ST_ASWKT");
486     return Create_func_as_wkt::create(thd, arg1);
487   }
488 
489   static Create_func_as_wkt_deprecated s_singleton;
490 };
491 Create_func_as_wkt_deprecated Create_func_as_wkt_deprecated::s_singleton;
492 
493 
494 class Create_func_asin : public Create_func_arg1
495 {
496 public:
497   virtual Item *create(THD *thd, Item *arg1);
498 
499   static Create_func_asin s_singleton;
500 
501 protected:
Create_func_asin()502   Create_func_asin() {}
~Create_func_asin()503   virtual ~Create_func_asin() {}
504 };
505 
506 
507 class Create_func_atan : public Create_native_func
508 {
509 public:
510   virtual Item *create_native(THD *thd, LEX_STRING name, PT_item_list *item_list);
511 
512   static Create_func_atan s_singleton;
513 
514 protected:
Create_func_atan()515   Create_func_atan() {}
~Create_func_atan()516   virtual ~Create_func_atan() {}
517 };
518 
519 
520 class Create_func_benchmark : public Create_func_arg2
521 {
522 public:
523   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
524 
525   static Create_func_benchmark s_singleton;
526 
527 protected:
Create_func_benchmark()528   Create_func_benchmark() {}
~Create_func_benchmark()529   virtual ~Create_func_benchmark() {}
530 };
531 
532 
533 class Create_func_bin : public Create_func_arg1
534 {
535 public:
536   virtual Item *create(THD *thd, Item *arg1);
537 
538   static Create_func_bin s_singleton;
539 
540 protected:
Create_func_bin()541   Create_func_bin() {}
~Create_func_bin()542   virtual ~Create_func_bin() {}
543 };
544 
545 
546 class Create_func_bit_count : public Create_func_arg1
547 {
548 public:
549   virtual Item *create(THD *thd, Item *arg1);
550 
551   static Create_func_bit_count s_singleton;
552 
553 protected:
Create_func_bit_count()554   Create_func_bit_count() {}
~Create_func_bit_count()555   virtual ~Create_func_bit_count() {}
556 };
557 
558 
559 class Create_func_bit_length : public Create_func_arg1
560 {
561 public:
562   virtual Item *create(THD *thd, Item *arg1);
563 
564   static Create_func_bit_length s_singleton;
565 
566 protected:
Create_func_bit_length()567   Create_func_bit_length() {}
~Create_func_bit_length()568   virtual ~Create_func_bit_length() {}
569 };
570 
571 
572 class Create_func_buffer_strategy : public Create_native_func
573 {
574 public:
575   virtual Item *create_native(THD *thd, LEX_STRING name,
576                               PT_item_list *item_list);
577 
578   static Create_func_buffer_strategy s_singleton;
579 
580 protected:
Create_func_buffer_strategy()581   Create_func_buffer_strategy() {}
~Create_func_buffer_strategy()582   virtual ~Create_func_buffer_strategy() {}
583 };
584 
585 
586 class Create_func_ceiling : public Create_func_arg1
587 {
588 public:
589   virtual Item *create(THD *thd, Item *arg1);
590 
591   static Create_func_ceiling s_singleton;
592 
593 protected:
Create_func_ceiling()594   Create_func_ceiling() {}
~Create_func_ceiling()595   virtual ~Create_func_ceiling() {}
596 };
597 
598 
599 class Create_func_centroid : public Create_func_arg1
600 {
601 public:
602   virtual Item *create(THD *thd, Item *arg1);
603 
604   static Create_func_centroid s_singleton;
605 
606 protected:
Create_func_centroid()607   Create_func_centroid() {}
~Create_func_centroid()608   virtual ~Create_func_centroid() {}
609 };
610 
611 
612 class Create_func_centroid_deprecated : public Create_func_centroid
613 {
614 public:
create(THD * thd,Item * arg1)615   virtual Item *create(THD *thd, Item *arg1)
616   {
617     push_deprecated_warn(thd, "CENTROID", "ST_CENTROID");
618     return Create_func_centroid::create(thd, arg1);
619   }
620 
621   static Create_func_centroid_deprecated s_singleton;
622 };
623 Create_func_centroid_deprecated Create_func_centroid_deprecated::s_singleton;
624 
625 
626 class Create_func_char_length : public Create_func_arg1
627 {
628 public:
629   virtual Item *create(THD *thd, Item *arg1);
630 
631   static Create_func_char_length s_singleton;
632 
633 protected:
Create_func_char_length()634   Create_func_char_length() {}
~Create_func_char_length()635   virtual ~Create_func_char_length() {}
636 };
637 
638 
639 class Create_func_coercibility : public Create_func_arg1
640 {
641 public:
642   virtual Item *create(THD *thd, Item *arg1);
643 
644   static Create_func_coercibility s_singleton;
645 
646 protected:
Create_func_coercibility()647   Create_func_coercibility() {}
~Create_func_coercibility()648   virtual ~Create_func_coercibility() {}
649 };
650 
651 
652 class Create_func_compress : public Create_func_arg1
653 {
654 public:
655   virtual Item *create(THD *thd, Item *arg1);
656 
657   static Create_func_compress s_singleton;
658 
659 protected:
Create_func_compress()660   Create_func_compress() {}
~Create_func_compress()661   virtual ~Create_func_compress() {}
662 };
663 
664 
665 class Create_func_concat : public Create_native_func
666 {
667 public:
668   virtual Item *create_native(THD *thd, LEX_STRING name,
669                               PT_item_list *item_list);
670 
671   static Create_func_concat s_singleton;
672 
673 protected:
Create_func_concat()674   Create_func_concat() {}
~Create_func_concat()675   virtual ~Create_func_concat() {}
676 };
677 
678 
679 class Create_func_concat_ws : public Create_native_func
680 {
681 public:
682   virtual Item *create_native(THD *thd, LEX_STRING name, PT_item_list *item_list);
683 
684   static Create_func_concat_ws s_singleton;
685 
686 protected:
Create_func_concat_ws()687   Create_func_concat_ws() {}
~Create_func_concat_ws()688   virtual ~Create_func_concat_ws() {}
689 };
690 
691 
692 class Create_func_connection_id : public Create_func_arg0
693 {
694 public:
695   virtual Item *create(THD *thd);
696 
697   static Create_func_connection_id s_singleton;
698 
699 protected:
Create_func_connection_id()700   Create_func_connection_id() {}
~Create_func_connection_id()701   virtual ~Create_func_connection_id() {}
702 };
703 
704 
705 class Create_func_convex_hull : public Create_func_arg1
706 {
707 public:
708   virtual Item *create(THD *thd, Item *arg1);
709 
710   static Create_func_convex_hull s_singleton;
711 
712 protected:
Create_func_convex_hull()713   Create_func_convex_hull() {}
~Create_func_convex_hull()714   virtual ~Create_func_convex_hull() {}
715 };
716 
717 
718 class Create_func_mbr_covered_by : public Create_func_arg2
719 {
720 public:
721   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
722 
723   static Create_func_mbr_covered_by s_singleton;
724 
725 protected:
Create_func_mbr_covered_by()726   Create_func_mbr_covered_by() {}
~Create_func_mbr_covered_by()727   virtual ~Create_func_mbr_covered_by() {}
728 };
729 
730 
731 class Create_func_mbr_covers : public Create_func_arg2
732 {
733 public:
734   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
735 
736   static Create_func_mbr_covers s_singleton;
737 
738 protected:
Create_func_mbr_covers()739   Create_func_mbr_covers() {}
~Create_func_mbr_covers()740   virtual ~Create_func_mbr_covers() {}
741 };
742 
743 
744 class Create_func_convex_hull_deprecated : public Create_func_convex_hull
745 {
746 public:
create(THD * thd,Item * arg1)747   virtual Item *create(THD *thd, Item *arg1)
748   {
749     push_deprecated_warn(thd, "CONVEXHULL", "ST_CONVEXHULL");
750     return Create_func_convex_hull::create(thd, arg1);
751   }
752 
753   static Create_func_convex_hull_deprecated s_singleton;
754 };
755 Create_func_convex_hull_deprecated Create_func_convex_hull_deprecated::s_singleton;
756 
757 
758 class Create_func_mbr_contains : public Create_func_arg2
759 {
760 public:
761   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
762 
763   static Create_func_mbr_contains s_singleton;
764 
765 protected:
Create_func_mbr_contains()766   Create_func_mbr_contains() {}
~Create_func_mbr_contains()767   virtual ~Create_func_mbr_contains() {}
768 };
769 
770 
771 class Create_func_contains : public Create_func_arg2
772 {
773 public:
774   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
775 
776   static Create_func_contains s_singleton;
777 
778 protected:
Create_func_contains()779   Create_func_contains() {}
~Create_func_contains()780   virtual ~Create_func_contains() {}
781 };
782 
783 
784 class Create_func_conv : public Create_func_arg3
785 {
786 public:
787   virtual Item *create(THD *thd, Item *arg1, Item *arg2, Item *arg3);
788 
789   static Create_func_conv s_singleton;
790 
791 protected:
Create_func_conv()792   Create_func_conv() {}
~Create_func_conv()793   virtual ~Create_func_conv() {}
794 };
795 
796 
797 class Create_func_convert_tz : public Create_func_arg3
798 {
799 public:
800   virtual Item *create(THD *thd, Item *arg1, Item *arg2, Item *arg3);
801 
802   static Create_func_convert_tz s_singleton;
803 
804 protected:
Create_func_convert_tz()805   Create_func_convert_tz() {}
~Create_func_convert_tz()806   virtual ~Create_func_convert_tz() {}
807 };
808 
809 
810 class Create_func_cos : public Create_func_arg1
811 {
812 public:
813   virtual Item *create(THD *thd, Item *arg1);
814 
815   static Create_func_cos s_singleton;
816 
817 protected:
Create_func_cos()818   Create_func_cos() {}
~Create_func_cos()819   virtual ~Create_func_cos() {}
820 };
821 
822 
823 class Create_func_cot : public Create_func_arg1
824 {
825 public:
826   virtual Item *create(THD *thd, Item *arg1);
827 
828   static Create_func_cot s_singleton;
829 
830 protected:
Create_func_cot()831   Create_func_cot() {}
~Create_func_cot()832   virtual ~Create_func_cot() {}
833 };
834 
835 
836 class Create_func_crc32 : public Create_func_arg1
837 {
838 public:
839   virtual Item *create(THD *thd, Item *arg1);
840 
841   static Create_func_crc32 s_singleton;
842 
843 protected:
Create_func_crc32()844   Create_func_crc32() {}
~Create_func_crc32()845   virtual ~Create_func_crc32() {}
846 };
847 
848 
849 class Create_func_crosses : public Create_func_arg2
850 {
851 public:
852   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
853 
854   static Create_func_crosses s_singleton;
855 
856 protected:
Create_func_crosses()857   Create_func_crosses() {}
~Create_func_crosses()858   virtual ~Create_func_crosses() {}
859 };
860 
861 
862 class Create_func_crosses_deprecated : public Create_func_crosses
863 {
864 public:
create(THD * thd,Item * arg1,Item * arg2)865   virtual Item *create(THD *thd, Item *arg1, Item *arg2)
866   {
867     push_deprecated_warn(thd, "CROSSES", "ST_CROSSES");
868     return Create_func_crosses::create(thd, arg1, arg2);
869   }
870 
871   static Create_func_crosses_deprecated s_singleton;
872 };
873 Create_func_crosses_deprecated Create_func_crosses_deprecated::s_singleton;
874 
875 
876 class Create_func_date_format : public Create_func_arg2
877 {
878 public:
879   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
880 
881   static Create_func_date_format s_singleton;
882 
883 protected:
Create_func_date_format()884   Create_func_date_format() {}
~Create_func_date_format()885   virtual ~Create_func_date_format() {}
886 };
887 
888 
889 class Create_func_datediff : public Create_func_arg2
890 {
891 public:
892   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
893 
894   static Create_func_datediff s_singleton;
895 
896 protected:
Create_func_datediff()897   Create_func_datediff() {}
~Create_func_datediff()898   virtual ~Create_func_datediff() {}
899 };
900 
901 
902 class Create_func_dayname : public Create_func_arg1
903 {
904 public:
905   virtual Item *create(THD *thd, Item *arg1);
906 
907   static Create_func_dayname s_singleton;
908 
909 protected:
Create_func_dayname()910   Create_func_dayname() {}
~Create_func_dayname()911   virtual ~Create_func_dayname() {}
912 };
913 
914 
915 class Create_func_dayofmonth : public Create_func_arg1
916 {
917 public:
918   virtual Item *create(THD *thd, Item *arg1);
919 
920   static Create_func_dayofmonth s_singleton;
921 
922 protected:
Create_func_dayofmonth()923   Create_func_dayofmonth() {}
~Create_func_dayofmonth()924   virtual ~Create_func_dayofmonth() {}
925 };
926 
927 
928 class Create_func_dayofweek : public Create_func_arg1
929 {
930 public:
931   virtual Item *create(THD *thd, Item *arg1);
932 
933   static Create_func_dayofweek s_singleton;
934 
935 protected:
Create_func_dayofweek()936   Create_func_dayofweek() {}
~Create_func_dayofweek()937   virtual ~Create_func_dayofweek() {}
938 };
939 
940 
941 class Create_func_dayofyear : public Create_func_arg1
942 {
943 public:
944   virtual Item *create(THD *thd, Item *arg1);
945 
946   static Create_func_dayofyear s_singleton;
947 
948 protected:
Create_func_dayofyear()949   Create_func_dayofyear() {}
~Create_func_dayofyear()950   virtual ~Create_func_dayofyear() {}
951 };
952 
953 
954 class Create_func_decode : public Create_func_arg2
955 {
956 public:
957   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
958 
959   static Create_func_decode s_singleton;
960 
961 protected:
Create_func_decode()962   Create_func_decode() {}
~Create_func_decode()963   virtual ~Create_func_decode() {}
964 };
965 
966 
967 class Create_func_degrees : public Create_func_arg1
968 {
969 public:
970   virtual Item *create(THD *thd, Item *arg1);
971 
972   static Create_func_degrees s_singleton;
973 
974 protected:
Create_func_degrees()975   Create_func_degrees() {}
~Create_func_degrees()976   virtual ~Create_func_degrees() {}
977 };
978 
979 
980 class Create_func_des_decrypt : public Create_native_func
981 {
982 public:
983   virtual Item *create_native(THD *thd, LEX_STRING name,
984                               PT_item_list *item_list);
985 
986   static Create_func_des_decrypt s_singleton;
987 
988 protected:
Create_func_des_decrypt()989   Create_func_des_decrypt() {}
~Create_func_des_decrypt()990   virtual ~Create_func_des_decrypt() {}
991 };
992 
993 
994 class Create_func_des_encrypt : public Create_native_func
995 {
996 public:
997   virtual Item *create_native(THD *thd, LEX_STRING name,
998                               PT_item_list *item_list);
999 
1000   static Create_func_des_encrypt s_singleton;
1001 
1002 protected:
Create_func_des_encrypt()1003   Create_func_des_encrypt() {}
~Create_func_des_encrypt()1004   virtual ~Create_func_des_encrypt() {}
1005 };
1006 
1007 
1008 class Create_func_dimension : public Create_func_arg1
1009 {
1010 public:
1011   virtual Item *create(THD *thd, Item *arg1);
1012 
1013   static Create_func_dimension s_singleton;
1014 
1015 protected:
Create_func_dimension()1016   Create_func_dimension() {}
~Create_func_dimension()1017   virtual ~Create_func_dimension() {}
1018 };
1019 
1020 
1021 class Create_func_dimension_deprecated : public Create_func_dimension
1022 {
1023 public:
create(THD * thd,Item * arg1)1024   virtual Item *create(THD *thd, Item *arg1)
1025   {
1026     push_deprecated_warn(current_thd, "DIMENSION", "ST_DIMENSION");
1027     return Create_func_dimension::create(thd, arg1);
1028   }
1029 
1030   static Create_func_dimension_deprecated s_singleton;
1031 };
1032 Create_func_dimension_deprecated Create_func_dimension_deprecated::s_singleton;
1033 
1034 
1035 class Create_func_mbr_disjoint : public Create_func_arg2
1036 {
1037 public:
1038   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
1039 
1040   static Create_func_mbr_disjoint s_singleton;
1041 
1042 protected:
Create_func_mbr_disjoint()1043   Create_func_mbr_disjoint() {}
~Create_func_mbr_disjoint()1044   virtual ~Create_func_mbr_disjoint() {}
1045 };
1046 
1047 
1048 class Create_func_disjoint : public Create_func_arg2
1049 {
1050 public:
1051   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
1052 
1053   static Create_func_disjoint s_singleton;
1054 
1055 protected:
Create_func_disjoint()1056   Create_func_disjoint() {}
~Create_func_disjoint()1057   virtual ~Create_func_disjoint() {}
1058 };
1059 
1060 
1061 class Create_func_distance : public Create_native_func
1062 {
1063 public:
1064   virtual Item *create_native(THD *thd, LEX_STRING name,
1065                               PT_item_list *item_list);
1066 
1067   static Create_func_distance s_singleton;
1068 
1069 protected:
Create_func_distance()1070   Create_func_distance() {}
~Create_func_distance()1071   virtual ~Create_func_distance() {}
1072 };
1073 
1074 
1075 class Create_func_distance_sphere : public Create_native_func
1076 {
1077 public:
1078   virtual Item *create_native(THD *thd, LEX_STRING name,
1079                               PT_item_list *item_list);
1080 
1081   static Create_func_distance_sphere s_singleton;
1082 
1083 protected:
Create_func_distance_sphere()1084   Create_func_distance_sphere() {}
~Create_func_distance_sphere()1085   virtual ~Create_func_distance_sphere() {}
1086 };
1087 
1088 
1089 class Create_func_distance_deprecated : public Create_func_distance
1090 {
1091 public:
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)1092   virtual Item *create_native(THD *thd, LEX_STRING name,
1093                               PT_item_list *item_list)
1094   {
1095     push_deprecated_warn(thd, "DISTANCE", "ST_DISTANCE");
1096     return Create_func_distance::create_native(thd, name, item_list);
1097   }
1098 
1099   static Create_func_distance_deprecated s_singleton;
1100 };
1101 Create_func_distance_deprecated Create_func_distance_deprecated::s_singleton;
1102 
1103 
1104 class Create_func_elt : public Create_native_func
1105 {
1106 public:
1107   virtual Item *create_native(THD *thd, LEX_STRING name,
1108                               PT_item_list *item_list);
1109 
1110   static Create_func_elt s_singleton;
1111 
1112 protected:
Create_func_elt()1113   Create_func_elt() {}
~Create_func_elt()1114   virtual ~Create_func_elt() {}
1115 };
1116 
1117 
1118 class Create_func_encode : public Create_func_arg2
1119 {
1120 public:
1121   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
1122 
1123   static Create_func_encode s_singleton;
1124 
1125 protected:
Create_func_encode()1126   Create_func_encode() {}
~Create_func_encode()1127   virtual ~Create_func_encode() {}
1128 };
1129 
1130 
1131 class Create_func_encrypt : public Create_native_func
1132 {
1133 public:
1134   virtual Item *create_native(THD *thd, LEX_STRING name,
1135                               PT_item_list *item_list);
1136 
1137   static Create_func_encrypt s_singleton;
1138 
1139 protected:
Create_func_encrypt()1140   Create_func_encrypt() {}
~Create_func_encrypt()1141   virtual ~Create_func_encrypt() {}
1142 };
1143 
1144 
1145 class Create_func_endpoint : public Create_func_arg1
1146 {
1147 public:
1148   virtual Item *create(THD *thd, Item *arg1);
1149 
1150   static Create_func_endpoint s_singleton;
1151 
1152 protected:
Create_func_endpoint()1153   Create_func_endpoint() {}
~Create_func_endpoint()1154   virtual ~Create_func_endpoint() {}
1155 };
1156 
1157 
1158 class Create_func_endpoint_deprecated : public Create_func_endpoint
1159 {
1160 public:
create(THD * thd,Item * arg1)1161   virtual Item *create(THD *thd, Item *arg1)
1162   {
1163     push_deprecated_warn(thd, "ENDPOINT", "ST_ENDPOINT");
1164     return Create_func_endpoint::create(thd, arg1);
1165   }
1166 
1167   static Create_func_endpoint_deprecated s_singleton;
1168 };
1169 Create_func_endpoint_deprecated Create_func_endpoint_deprecated::s_singleton;
1170 
1171 
1172 class Create_func_envelope : public Create_func_arg1
1173 {
1174 public:
1175   virtual Item *create(THD *thd, Item *arg1);
1176 
1177   static Create_func_envelope s_singleton;
1178 
1179 protected:
Create_func_envelope()1180   Create_func_envelope() {}
~Create_func_envelope()1181   virtual ~Create_func_envelope() {}
1182 };
1183 
1184 
1185 class Create_func_envelope_deprecated : public Create_func_envelope
1186 {
1187 public:
create(THD * thd,Item * arg1)1188   virtual Item *create(THD *thd, Item *arg1)
1189   {
1190     push_deprecated_warn(thd, "ENVELOPE", "ST_ENVELOPE");
1191     return Create_func_envelope::create(thd, arg1);
1192   }
1193 
1194   static Create_func_envelope_deprecated s_singleton;
1195 };
1196 Create_func_envelope_deprecated Create_func_envelope_deprecated::s_singleton;
1197 
1198 
1199 class Create_func_mbr_equals : public Create_func_arg2
1200 {
1201 public:
1202   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
1203 
1204   static Create_func_mbr_equals s_singleton;
1205 
1206 protected:
Create_func_mbr_equals()1207   Create_func_mbr_equals() {}
~Create_func_mbr_equals()1208   virtual ~Create_func_mbr_equals() {}
1209 };
1210 
1211 
1212 class Create_func_mbr_equal_deprecated : public Create_func_mbr_equals
1213 {
1214 public:
create(THD * thd,Item * arg1,Item * arg2)1215   virtual Item *create(THD *thd, Item *arg1, Item *arg2)
1216   {
1217     push_deprecated_warn(thd, "MBREQUAL", "MBREQUALS");
1218     return Create_func_mbr_equals::create(thd, arg1, arg2);
1219   }
1220 
1221   static Create_func_mbr_equal_deprecated s_singleton;
1222 };
1223 Create_func_mbr_equal_deprecated Create_func_mbr_equal_deprecated::s_singleton;
1224 
1225 
1226 class Create_func_equals_deprecated : public Create_func_mbr_equals
1227 {
1228 public:
create(THD * thd,Item * arg1,Item * arg2)1229   virtual Item *create(THD *thd, Item *arg1, Item *arg2)
1230   {
1231     push_deprecated_warn(thd, "EQUALS", "MBREQUALS");
1232     return Create_func_mbr_equals::create(thd, arg1, arg2);
1233   }
1234 
1235   static Create_func_equals_deprecated s_singleton;
1236 };
1237 Create_func_equals_deprecated Create_func_equals_deprecated::s_singleton;
1238 
1239 
1240 class Create_func_equals : public Create_func_arg2
1241 {
1242 public:
1243   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
1244 
1245   static Create_func_equals s_singleton;
1246 
1247 protected:
Create_func_equals()1248   Create_func_equals() {}
~Create_func_equals()1249   virtual ~Create_func_equals() {}
1250 };
1251 
1252 
1253 class Create_func_exp : public Create_func_arg1
1254 {
1255 public:
1256   virtual Item *create(THD *thd, Item *arg1);
1257 
1258   static Create_func_exp s_singleton;
1259 
1260 protected:
Create_func_exp()1261   Create_func_exp() {}
~Create_func_exp()1262   virtual ~Create_func_exp() {}
1263 };
1264 
1265 
1266 class Create_func_export_set : public Create_native_func
1267 {
1268 public:
1269   virtual Item *create_native(THD *thd, LEX_STRING name,
1270                               PT_item_list *item_list);
1271 
1272   static Create_func_export_set s_singleton;
1273 
1274 protected:
Create_func_export_set()1275   Create_func_export_set() {}
~Create_func_export_set()1276   virtual ~Create_func_export_set() {}
1277 };
1278 
1279 
1280 class Create_func_exteriorring : public Create_func_arg1
1281 {
1282 public:
1283   virtual Item *create(THD *thd, Item *arg1);
1284 
1285   static Create_func_exteriorring s_singleton;
1286 
1287 protected:
Create_func_exteriorring()1288   Create_func_exteriorring() {}
~Create_func_exteriorring()1289   virtual ~Create_func_exteriorring() {}
1290 };
1291 
1292 
1293 class Create_func_exteriorring_deprecated : public Create_func_exteriorring
1294 {
1295 public:
create(THD * thd,Item * arg1)1296   virtual Item *create(THD *thd, Item *arg1)
1297   {
1298     push_deprecated_warn(thd, "EXTERIORRING", "ST_EXTERIORRING");
1299     return Create_func_exteriorring::create(thd, arg1);
1300   }
1301 
1302   static Create_func_exteriorring_deprecated s_singleton;
1303 };
1304 Create_func_exteriorring_deprecated Create_func_exteriorring_deprecated::s_singleton;
1305 
1306 
1307 class Create_func_field : public Create_native_func
1308 {
1309 public:
1310   virtual Item *create_native(THD *thd, LEX_STRING name,
1311                               PT_item_list *item_list);
1312 
1313   static Create_func_field s_singleton;
1314 
1315 protected:
Create_func_field()1316   Create_func_field() {}
~Create_func_field()1317   virtual ~Create_func_field() {}
1318 };
1319 
1320 
1321 class Create_func_find_in_set : public Create_func_arg2
1322 {
1323 public:
1324   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
1325 
1326   static Create_func_find_in_set s_singleton;
1327 
1328 protected:
Create_func_find_in_set()1329   Create_func_find_in_set() {}
~Create_func_find_in_set()1330   virtual ~Create_func_find_in_set() {}
1331 };
1332 
1333 
1334 class Create_func_floor : public Create_func_arg1
1335 {
1336 public:
1337   virtual Item *create(THD *thd, Item *arg1);
1338 
1339   static Create_func_floor s_singleton;
1340 
1341 protected:
Create_func_floor()1342   Create_func_floor() {}
~Create_func_floor()1343   virtual ~Create_func_floor() {}
1344 };
1345 
1346 
1347 class Create_func_found_rows : public Create_func_arg0
1348 {
1349 public:
1350   virtual Item *create(THD *thd);
1351 
1352   static Create_func_found_rows s_singleton;
1353 
1354 protected:
Create_func_found_rows()1355   Create_func_found_rows() {}
~Create_func_found_rows()1356   virtual ~Create_func_found_rows() {}
1357 };
1358 
1359 
1360 class Create_func_from_base64 : public Create_func_arg1
1361 {
1362 public:
1363   virtual Item *create(THD *thd, Item *arg1);
1364 
1365   static Create_func_from_base64 s_singleton;
1366 
1367 protected:
Create_func_from_base64()1368   Create_func_from_base64() {}
~Create_func_from_base64()1369   virtual ~Create_func_from_base64() {}
1370 };
1371 
1372 
1373 class Create_func_from_days : public Create_func_arg1
1374 {
1375 public:
1376   virtual Item *create(THD *thd, Item *arg1);
1377 
1378   static Create_func_from_days s_singleton;
1379 
1380 protected:
Create_func_from_days()1381   Create_func_from_days() {}
~Create_func_from_days()1382   virtual ~Create_func_from_days() {}
1383 };
1384 
1385 
1386 class Create_func_from_unixtime : public Create_native_func
1387 {
1388 public:
1389   virtual Item *create_native(THD *thd, LEX_STRING name,
1390                               PT_item_list *item_list);
1391 
1392   static Create_func_from_unixtime s_singleton;
1393 
1394 protected:
Create_func_from_unixtime()1395   Create_func_from_unixtime() {}
~Create_func_from_unixtime()1396   virtual ~Create_func_from_unixtime() {}
1397 };
1398 
1399 
1400 class Create_func_geohash : public Create_native_func
1401 {
1402 public:
1403   virtual Item *create_native(THD *thd, LEX_STRING name,
1404                               PT_item_list *item_list);
1405 
1406   static Create_func_geohash s_singleton;
1407 
1408 protected:
Create_func_geohash()1409   Create_func_geohash() {}
~Create_func_geohash()1410   virtual ~Create_func_geohash() {}
1411 };
1412 
1413 
1414 class Create_func_geometry_from_text : public Create_native_func
1415 {
1416 public:
1417   virtual Item *create_native(THD *thd, LEX_STRING name,
1418                               PT_item_list *item_list);
1419 
1420   static Create_func_geometry_from_text s_singleton;
1421 
1422 protected:
Create_func_geometry_from_text()1423   Create_func_geometry_from_text() {}
~Create_func_geometry_from_text()1424   virtual ~Create_func_geometry_from_text() {}
1425 };
1426 
1427 
1428 class Create_func_geomcollfromtext_deprecated : public Create_func_geometry_from_text
1429 {
1430 public:
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)1431   virtual Item *create_native(THD *thd, LEX_STRING name,
1432                               PT_item_list *item_list)
1433   {
1434     push_deprecated_warn(thd, "GEOMCOLLFROMTEXT", "ST_GEOMCOLLFROMTEXT");
1435     return Create_func_geometry_from_text::create_native(thd, name, item_list);
1436   }
1437 
1438   static Create_func_geomcollfromtext_deprecated s_singleton;
1439 };
1440 Create_func_geomcollfromtext_deprecated Create_func_geomcollfromtext_deprecated::s_singleton;
1441 
1442 
1443 class Create_func_geometrycollectionfromtext_deprecated : public Create_func_geometry_from_text
1444 {
1445 public:
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)1446   virtual Item *create_native(THD *thd, LEX_STRING name,
1447                               PT_item_list *item_list)
1448   {
1449     push_deprecated_warn(thd, "GEOMETRYCOLLECTIONFROMTEXT", "ST_GEOMETRYCOLLECTIONFROMTEXT");
1450     return Create_func_geometry_from_text::create_native(thd, name, item_list);
1451   }
1452 
1453   static Create_func_geometrycollectionfromtext_deprecated s_singleton;
1454 };
1455 Create_func_geometrycollectionfromtext_deprecated Create_func_geometrycollectionfromtext_deprecated::s_singleton;
1456 
1457 
1458 class Create_func_geometryfromtext_deprecated : public Create_func_geometry_from_text
1459 {
1460 public:
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)1461   virtual Item *create_native(THD *thd, LEX_STRING name,
1462                               PT_item_list *item_list)
1463   {
1464     push_deprecated_warn(thd, "GEOMETRYFROMTEXT", "ST_GEOMETRYFROMTEXT");
1465     return Create_func_geometry_from_text::create_native(thd, name, item_list);
1466   }
1467 
1468   static Create_func_geometryfromtext_deprecated s_singleton;
1469 };
1470 Create_func_geometryfromtext_deprecated Create_func_geometryfromtext_deprecated::s_singleton;
1471 
1472 
1473 class Create_func_geomfromtext_deprecated : public Create_func_geometry_from_text
1474 {
1475 public:
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)1476   virtual Item *create_native(THD *thd, LEX_STRING name,
1477                               PT_item_list *item_list)
1478   {
1479     push_deprecated_warn(thd, "GEOMFROMTEXT", "ST_GEOMFROMTEXT");
1480     return Create_func_geometry_from_text::create_native(thd, name, item_list);
1481   }
1482 
1483   static Create_func_geomfromtext_deprecated s_singleton;
1484 };
1485 Create_func_geomfromtext_deprecated Create_func_geomfromtext_deprecated::s_singleton;
1486 
1487 
1488 class Create_func_linefromtext_deprecated : public Create_func_geometry_from_text
1489 {
1490 public:
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)1491   virtual Item *create_native(THD *thd, LEX_STRING name,
1492                               PT_item_list *item_list)
1493   {
1494     push_deprecated_warn(thd, "LINEFROMTEXT", "ST_LINEFROMTEXT");
1495     return Create_func_geometry_from_text::create_native(thd, name, item_list);
1496   }
1497 
1498   static Create_func_linefromtext_deprecated s_singleton;
1499 };
1500 Create_func_linefromtext_deprecated Create_func_linefromtext_deprecated::s_singleton;
1501 
1502 
1503 class Create_func_linestringfromtext_deprecated : public Create_func_geometry_from_text
1504 {
1505 public:
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)1506   virtual Item *create_native(THD *thd, LEX_STRING name,
1507                               PT_item_list *item_list)
1508   {
1509     push_deprecated_warn(thd, "LINESTRINGFROMTEXT", "ST_LINESTRINGFROMTEXT");
1510     return Create_func_geometry_from_text::create_native(thd, name, item_list);
1511   }
1512 
1513   static Create_func_linestringfromtext_deprecated s_singleton;
1514 };
1515 Create_func_linestringfromtext_deprecated Create_func_linestringfromtext_deprecated::s_singleton;
1516 
1517 
1518 class Create_func_mlinefromtext_deprecated : public Create_func_geometry_from_text
1519 {
1520 public:
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)1521   virtual Item *create_native(THD *thd, LEX_STRING name,
1522                               PT_item_list *item_list)
1523   {
1524     push_deprecated_warn(thd, "MLINEFROMTEXT", "ST_MLINEFROMTEXT");
1525     return Create_func_geometry_from_text::create_native(thd, name, item_list);
1526   }
1527 
1528   static Create_func_mlinefromtext_deprecated s_singleton;
1529 };
1530 Create_func_mlinefromtext_deprecated Create_func_mlinefromtext_deprecated::s_singleton;
1531 
1532 
1533 class Create_func_mpointfromtext_deprecated : public Create_func_geometry_from_text
1534 {
1535 public:
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)1536   virtual Item *create_native(THD *thd, LEX_STRING name,
1537                               PT_item_list *item_list)
1538   {
1539     push_deprecated_warn(thd, "MPOINTFROMTEXT", "ST_MPOINTFROMTEXT");
1540     return Create_func_geometry_from_text::create_native(thd, name, item_list);
1541   }
1542 
1543   static Create_func_mpointfromtext_deprecated s_singleton;
1544 };
1545 Create_func_mpointfromtext_deprecated Create_func_mpointfromtext_deprecated::s_singleton;
1546 
1547 
1548 class Create_func_mpolyfromtext_deprecated : public Create_func_geometry_from_text
1549 {
1550 public:
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)1551   virtual Item *create_native(THD *thd, LEX_STRING name,
1552                               PT_item_list *item_list)
1553   {
1554     push_deprecated_warn(thd, "MPOLYFROMTEXT", "ST_MPOLYFROMTEXT");
1555     return Create_func_geometry_from_text::create_native(thd, name, item_list);
1556   }
1557 
1558   static Create_func_mpolyfromtext_deprecated s_singleton;
1559 };
1560 Create_func_mpolyfromtext_deprecated Create_func_mpolyfromtext_deprecated::s_singleton;
1561 
1562 
1563 class Create_func_multilinestringfromtext_deprecated : public Create_func_geometry_from_text
1564 {
1565 public:
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)1566   virtual Item *create_native(THD *thd, LEX_STRING name,
1567                               PT_item_list *item_list)
1568   {
1569     push_deprecated_warn(thd, "MULTILINESTRINGFROMTEXT", "ST_MULTILINESTRINGFROMTEXT");
1570     return Create_func_geometry_from_text::create_native(thd, name, item_list);
1571   }
1572 
1573   static Create_func_multilinestringfromtext_deprecated s_singleton;
1574 };
1575 Create_func_multilinestringfromtext_deprecated Create_func_multilinestringfromtext_deprecated::s_singleton;
1576 
1577 
1578 class Create_func_multipointfromtext_deprecated : public Create_func_geometry_from_text
1579 {
1580 public:
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)1581   virtual Item *create_native(THD *thd, LEX_STRING name,
1582                               PT_item_list *item_list)
1583   {
1584     push_deprecated_warn(thd, "MULTIPOINTFROMTEXT", "ST_MULTIPOINTFROMTEXT");
1585     return Create_func_geometry_from_text::create_native(thd, name, item_list);
1586   }
1587 
1588   static Create_func_multipointfromtext_deprecated s_singleton;
1589 };
1590 Create_func_multipointfromtext_deprecated Create_func_multipointfromtext_deprecated::s_singleton;
1591 
1592 
1593 class Create_func_multipolygonfromtext_deprecated : public Create_func_geometry_from_text
1594 {
1595 public:
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)1596   virtual Item *create_native(THD *thd, LEX_STRING name,
1597                               PT_item_list *item_list)
1598   {
1599     push_deprecated_warn(thd, "MULTIPOLYGONFROMTEXT", "ST_MULTIPOLYGONFROMTEXT");
1600     return Create_func_geometry_from_text::create_native(thd, name, item_list);
1601   }
1602 
1603   static Create_func_multipolygonfromtext_deprecated s_singleton;
1604 };
1605 Create_func_multipolygonfromtext_deprecated Create_func_multipolygonfromtext_deprecated::s_singleton;
1606 
1607 
1608 class Create_func_pointfromtext_deprecated : public Create_func_geometry_from_text
1609 {
1610 public:
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)1611   virtual Item *create_native(THD *thd, LEX_STRING name,
1612                               PT_item_list *item_list)
1613   {
1614     push_deprecated_warn(thd, "POINTFROMTEXT", "ST_POINTFROMTEXT");
1615     return Create_func_geometry_from_text::create_native(thd, name, item_list);
1616   }
1617 
1618   static Create_func_pointfromtext_deprecated s_singleton;
1619 };
1620 Create_func_pointfromtext_deprecated Create_func_pointfromtext_deprecated::s_singleton;
1621 
1622 
1623 class Create_func_polyfromtext_deprecated : public Create_func_geometry_from_text
1624 {
1625 public:
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)1626   virtual Item *create_native(THD *thd, LEX_STRING name,
1627                               PT_item_list *item_list)
1628   {
1629     push_deprecated_warn(thd, "POLYFROMTEXT", "ST_POLYFROMTEXT");
1630     return Create_func_geometry_from_text::create_native(thd, name, item_list);
1631   }
1632 
1633   static Create_func_polyfromtext_deprecated s_singleton;
1634 };
1635 Create_func_polyfromtext_deprecated Create_func_polyfromtext_deprecated::s_singleton;
1636 
1637 
1638 class Create_func_polygonfromtext_deprecated : public Create_func_geometry_from_text
1639 {
1640 public:
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)1641   virtual Item *create_native(THD *thd, LEX_STRING name,
1642                               PT_item_list *item_list)
1643   {
1644     push_deprecated_warn(thd, "POLYGONFROMTEXT", "ST_POLYGONFROMTEXT");
1645     return Create_func_geometry_from_text::create_native(thd, name, item_list);
1646   }
1647 
1648   static Create_func_polygonfromtext_deprecated s_singleton;
1649 };
1650 Create_func_polygonfromtext_deprecated Create_func_polygonfromtext_deprecated::s_singleton;
1651 
1652 
1653 class Create_func_geometry_from_wkb : public Create_native_func
1654 {
1655 public:
1656   virtual Item *create_native(THD *thd, LEX_STRING name,
1657                               PT_item_list *item_list);
1658 
1659   static Create_func_geometry_from_wkb s_singleton;
1660 
1661 protected:
Create_func_geometry_from_wkb()1662   Create_func_geometry_from_wkb() {}
~Create_func_geometry_from_wkb()1663   virtual ~Create_func_geometry_from_wkb() {}
1664 };
1665 
1666 
1667 class Create_func_geomcollfromwkb_deprecated : public Create_func_geometry_from_wkb
1668 {
1669 public:
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)1670   virtual Item *create_native(THD *thd, LEX_STRING name,
1671                               PT_item_list *item_list)
1672   {
1673     push_deprecated_warn(thd, "GEOMCOLLFROMWKB", "ST_GEOMCOLLFROMWKB");
1674     return Create_func_geometry_from_wkb::create_native(thd, name, item_list);
1675   }
1676 
1677   static Create_func_geomcollfromwkb_deprecated s_singleton;
1678 };
1679 Create_func_geomcollfromwkb_deprecated Create_func_geomcollfromwkb_deprecated::s_singleton;
1680 
1681 
1682 class Create_func_geometrycollectionfromwkb_deprecated : public Create_func_geometry_from_wkb
1683 {
1684 public:
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)1685   virtual Item *create_native(THD *thd, LEX_STRING name,
1686                               PT_item_list *item_list)
1687   {
1688     push_deprecated_warn(thd, "GEOMETRYCOLLECTIONFROMWKB", "ST_GEOMETRYCOLLECTIONFROMWKB");
1689     return Create_func_geometry_from_wkb::create_native(thd, name, item_list);
1690   }
1691 
1692   static Create_func_geometrycollectionfromwkb_deprecated s_singleton;
1693 };
1694 Create_func_geometrycollectionfromwkb_deprecated Create_func_geometrycollectionfromwkb_deprecated::s_singleton;
1695 
1696 
1697 class Create_func_geometryfromwkb_deprecated : public Create_func_geometry_from_wkb
1698 {
1699 public:
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)1700   virtual Item *create_native(THD *thd, LEX_STRING name,
1701                               PT_item_list *item_list)
1702   {
1703     push_deprecated_warn(thd, "GEOMETRYFROMWKB", "ST_GEOMETRYFROMWKB");
1704     return Create_func_geometry_from_wkb::create_native(thd, name, item_list);
1705   }
1706 
1707   static Create_func_geometryfromwkb_deprecated s_singleton;
1708 };
1709 Create_func_geometryfromwkb_deprecated Create_func_geometryfromwkb_deprecated::s_singleton;
1710 
1711 
1712 class Create_func_geomfromwkb_deprecated : public Create_func_geometry_from_wkb
1713 {
1714 public:
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)1715   virtual Item *create_native(THD *thd, LEX_STRING name,
1716                               PT_item_list *item_list)
1717   {
1718     push_deprecated_warn(thd, "GEOMFROMWKB", "ST_GEOMFROMWKB");
1719     return Create_func_geometry_from_wkb::create_native(thd, name, item_list);
1720   }
1721 
1722   static Create_func_geomfromwkb_deprecated s_singleton;
1723 };
1724 Create_func_geomfromwkb_deprecated Create_func_geomfromwkb_deprecated::s_singleton;
1725 
1726 
1727 class Create_func_linefromwkb_deprecated : public Create_func_geometry_from_wkb
1728 {
1729 public:
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)1730   virtual Item *create_native(THD *thd, LEX_STRING name,
1731                               PT_item_list *item_list)
1732   {
1733     push_deprecated_warn(thd, "LINEFROMWKB", "ST_LINEFROMWKB");
1734     return Create_func_geometry_from_wkb::create_native(thd, name, item_list);
1735   }
1736 
1737   static Create_func_linefromwkb_deprecated s_singleton;
1738 };
1739 Create_func_linefromwkb_deprecated Create_func_linefromwkb_deprecated::s_singleton;
1740 
1741 
1742 class Create_func_linestringfromwkb_deprecated : public Create_func_geometry_from_wkb
1743 {
1744 public:
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)1745   virtual Item *create_native(THD *thd, LEX_STRING name,
1746                               PT_item_list *item_list)
1747   {
1748     push_deprecated_warn(thd, "LINESTRINGFROMWKB", "ST_LINESTRINGFROMWKB");
1749     return Create_func_geometry_from_wkb::create_native(thd, name, item_list);
1750   }
1751 
1752   static Create_func_linestringfromwkb_deprecated s_singleton;
1753 };
1754 Create_func_linestringfromwkb_deprecated Create_func_linestringfromwkb_deprecated::s_singleton;
1755 
1756 
1757 class Create_func_mlinefromwkb_deprecated : public Create_func_geometry_from_wkb
1758 {
1759 public:
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)1760   virtual Item *create_native(THD *thd, LEX_STRING name,
1761                               PT_item_list *item_list)
1762   {
1763     push_deprecated_warn(thd, "MLINEFROMWKB", "ST_MLINEFROMWKB");
1764     return Create_func_geometry_from_wkb::create_native(thd, name, item_list);
1765   }
1766 
1767   static Create_func_mlinefromwkb_deprecated s_singleton;
1768 };
1769 Create_func_mlinefromwkb_deprecated Create_func_mlinefromwkb_deprecated::s_singleton;
1770 
1771 
1772 class Create_func_mpointfromwkb_deprecated : public Create_func_geometry_from_wkb
1773 {
1774 public:
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)1775   virtual Item *create_native(THD *thd, LEX_STRING name,
1776                               PT_item_list *item_list)
1777   {
1778     push_deprecated_warn(thd, "MPOINTFROMWKB", "ST_MPOINTFROMWKB");
1779     return Create_func_geometry_from_wkb::create_native(thd, name, item_list);
1780   }
1781 
1782   static Create_func_mpointfromwkb_deprecated s_singleton;
1783 };
1784 Create_func_mpointfromwkb_deprecated Create_func_mpointfromwkb_deprecated::s_singleton;
1785 
1786 
1787 class Create_func_mpolyfromwkb_deprecated : public Create_func_geometry_from_wkb
1788 {
1789 public:
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)1790   virtual Item *create_native(THD *thd, LEX_STRING name,
1791                               PT_item_list *item_list)
1792   {
1793     push_deprecated_warn(thd, "MPOLYFROMWKB", "ST_MPOLYFROMWKB");
1794     return Create_func_geometry_from_wkb::create_native(thd, name, item_list);
1795   }
1796 
1797   static Create_func_mpolyfromwkb_deprecated s_singleton;
1798 };
1799 Create_func_mpolyfromwkb_deprecated Create_func_mpolyfromwkb_deprecated::s_singleton;
1800 
1801 
1802 class Create_func_multilinestringfromwkb_deprecated : public Create_func_geometry_from_wkb
1803 {
1804 public:
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)1805   virtual Item *create_native(THD *thd, LEX_STRING name,
1806                               PT_item_list *item_list)
1807   {
1808     push_deprecated_warn(thd, "MULTILINESTRINGFROMWKB", "ST_MULTILINESTRINGFROMWKB");
1809     return Create_func_geometry_from_wkb::create_native(thd, name, item_list);
1810   }
1811 
1812   static Create_func_multilinestringfromwkb_deprecated s_singleton;
1813 };
1814 Create_func_multilinestringfromwkb_deprecated Create_func_multilinestringfromwkb_deprecated::s_singleton;
1815 
1816 
1817 class Create_func_multipointfromwkb_deprecated : public Create_func_geometry_from_wkb
1818 {
1819 public:
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)1820   virtual Item *create_native(THD *thd, LEX_STRING name,
1821                               PT_item_list *item_list)
1822   {
1823     push_deprecated_warn(thd, "MULTIPOINTFROMWKB", "ST_MULTIPOINTFROMWKB");
1824     return Create_func_geometry_from_wkb::create_native(thd, name, item_list);
1825   }
1826 
1827   static Create_func_multipointfromwkb_deprecated s_singleton;
1828 };
1829 Create_func_multipointfromwkb_deprecated Create_func_multipointfromwkb_deprecated::s_singleton;
1830 
1831 
1832 class Create_func_multipolygonfromwkb_deprecated : public Create_func_geometry_from_wkb
1833 {
1834 public:
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)1835   virtual Item *create_native(THD *thd, LEX_STRING name,
1836                               PT_item_list *item_list)
1837   {
1838     push_deprecated_warn(thd, "MULTIPOLYGONFROMWKB", "ST_MULTIPOLYGONFROMWKB");
1839     return Create_func_geometry_from_wkb::create_native(thd, name, item_list);
1840   }
1841 
1842   static Create_func_multipolygonfromwkb_deprecated s_singleton;
1843 };
1844 Create_func_multipolygonfromwkb_deprecated Create_func_multipolygonfromwkb_deprecated::s_singleton;
1845 
1846 
1847 class Create_func_pointfromwkb_deprecated : public Create_func_geometry_from_wkb
1848 {
1849 public:
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)1850   virtual Item *create_native(THD *thd, LEX_STRING name,
1851                               PT_item_list *item_list)
1852   {
1853     push_deprecated_warn(thd, "POINTFROMWKB", "ST_POINTFROMWKB");
1854     return Create_func_geometry_from_wkb::create_native(thd, name, item_list);
1855   }
1856 
1857   static Create_func_pointfromwkb_deprecated s_singleton;
1858 };
1859 Create_func_pointfromwkb_deprecated Create_func_pointfromwkb_deprecated::s_singleton;
1860 
1861 
1862 class Create_func_polyfromwkb_deprecated : public Create_func_geometry_from_wkb
1863 {
1864 public:
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)1865   virtual Item *create_native(THD *thd, LEX_STRING name,
1866                               PT_item_list *item_list)
1867   {
1868     push_deprecated_warn(thd, "POLYFROMWKB", "ST_POLYFROMWKB");
1869     return Create_func_geometry_from_wkb::create_native(thd, name, item_list);
1870   }
1871 
1872   static Create_func_polyfromwkb_deprecated s_singleton;
1873 };
1874 Create_func_polyfromwkb_deprecated Create_func_polyfromwkb_deprecated::s_singleton;
1875 
1876 
1877 class Create_func_polygonfromwkb_deprecated : public Create_func_geometry_from_wkb
1878 {
1879 public:
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)1880   virtual Item *create_native(THD *thd, LEX_STRING name,
1881                               PT_item_list *item_list)
1882   {
1883     push_deprecated_warn(thd, "POLYGONFROMWKB", "ST_POLYGONFROMWKB");
1884     return Create_func_geometry_from_wkb::create_native(thd, name, item_list);
1885   }
1886 
1887   static Create_func_polygonfromwkb_deprecated s_singleton;
1888 };
1889 Create_func_polygonfromwkb_deprecated Create_func_polygonfromwkb_deprecated::s_singleton;
1890 
1891 
1892 class Create_func_geometry_type : public Create_func_arg1
1893 {
1894 public:
1895   virtual Item *create(THD *thd, Item *arg1);
1896 
1897   static Create_func_geometry_type s_singleton;
1898 
1899 protected:
Create_func_geometry_type()1900   Create_func_geometry_type() {}
~Create_func_geometry_type()1901   virtual ~Create_func_geometry_type() {}
1902 };
1903 
1904 
1905 class Create_func_geometry_type_deprecated : public Create_func_geometry_type
1906 {
1907 public:
create(THD * thd,Item * arg1)1908   virtual Item *create(THD *thd, Item *arg1)
1909   {
1910     push_deprecated_warn(thd, "GEOMETRYTYPE", "ST_GEOMETRYTYPE");
1911     return Create_func_geometry_type::create(thd, arg1);
1912   }
1913 
1914   static Create_func_geometry_type_deprecated s_singleton;
1915 };
1916 Create_func_geometry_type_deprecated Create_func_geometry_type_deprecated::s_singleton;
1917 
1918 
1919 class Create_func_geometryn : public Create_func_arg2
1920 {
1921 public:
1922   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
1923 
1924   static Create_func_geometryn s_singleton;
1925 
1926 protected:
Create_func_geometryn()1927   Create_func_geometryn() {}
~Create_func_geometryn()1928   virtual ~Create_func_geometryn() {}
1929 };
1930 
1931 
1932 class Create_func_geometryn_deprecated : public Create_func_geometryn
1933 {
1934 public:
create(THD * thd,Item * arg1,Item * arg2)1935   virtual Item *create(THD *thd, Item *arg1, Item *arg2)
1936   {
1937     push_deprecated_warn(thd, "GEOMETRYN", "ST_GEOMETRYN");
1938     return Create_func_geometryn::create(thd, arg1, arg2);
1939   }
1940 
1941   static Create_func_geometryn_deprecated s_singleton;
1942 };
1943 Create_func_geometryn_deprecated Create_func_geometryn_deprecated::s_singleton;
1944 
1945 
1946 class Create_func_geomfromgeojson : public Create_native_func
1947 {
1948 public:
1949   virtual Item *create_native(THD *thd, LEX_STRING name,
1950                               PT_item_list *item_list);
1951 
1952   static Create_func_geomfromgeojson s_singleton;
1953 
1954 protected:
Create_func_geomfromgeojson()1955   Create_func_geomfromgeojson() {}
~Create_func_geomfromgeojson()1956   virtual ~Create_func_geomfromgeojson() {}
1957 };
1958 
1959 
1960 class Create_func_get_lock : public Create_func_arg2
1961 {
1962 public:
1963   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
1964 
1965   static Create_func_get_lock s_singleton;
1966 
1967 protected:
Create_func_get_lock()1968   Create_func_get_lock() {}
~Create_func_get_lock()1969   virtual ~Create_func_get_lock() {}
1970 };
1971 
1972 
1973 class Create_func_glength : public Create_func_arg1
1974 {
1975 public:
1976   virtual Item *create(THD *thd, Item *arg1);
1977 
1978   static Create_func_glength s_singleton;
1979 
1980 protected:
Create_func_glength()1981   Create_func_glength() {}
~Create_func_glength()1982   virtual ~Create_func_glength() {}
1983 };
1984 
1985 
1986 class Create_func_glength_deprecated : public Create_func_glength
1987 {
1988 public:
create(THD * thd,Item * arg1)1989   virtual Item *create(THD *thd, Item *arg1)
1990   {
1991     push_deprecated_warn(thd, "GLENGTH", "ST_LENGTH");
1992     return Create_func_glength::create(thd, arg1);
1993   }
1994 
1995   static Create_func_glength_deprecated s_singleton;
1996 };
1997 Create_func_glength_deprecated Create_func_glength_deprecated::s_singleton;
1998 
1999 
2000 class Create_func_greatest : public Create_native_func
2001 {
2002 public:
2003   virtual Item *create_native(THD *thd, LEX_STRING name,
2004                               PT_item_list *item_list);
2005 
2006   static Create_func_greatest s_singleton;
2007 
2008 protected:
Create_func_greatest()2009   Create_func_greatest() {}
~Create_func_greatest()2010   virtual ~Create_func_greatest() {}
2011 };
2012 
2013 
2014 class Create_func_gtid_subtract : public Create_func_arg2
2015 {
2016 public:
2017   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
2018 
2019   static Create_func_gtid_subtract s_singleton;
2020 
2021 protected:
Create_func_gtid_subtract()2022   Create_func_gtid_subtract() {}
~Create_func_gtid_subtract()2023   virtual ~Create_func_gtid_subtract() {}
2024 };
2025 
2026 
2027 class Create_func_gtid_subset : public Create_func_arg2
2028 {
2029 public:
2030   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
2031 
2032   static Create_func_gtid_subset s_singleton;
2033 
2034 protected:
Create_func_gtid_subset()2035   Create_func_gtid_subset() {}
~Create_func_gtid_subset()2036   virtual ~Create_func_gtid_subset() {}
2037 };
2038 
2039 
2040 class Create_func_hex : public Create_func_arg1
2041 {
2042 public:
2043   virtual Item *create(THD *thd, Item *arg1);
2044 
2045   static Create_func_hex s_singleton;
2046 
2047 protected:
Create_func_hex()2048   Create_func_hex() {}
~Create_func_hex()2049   virtual ~Create_func_hex() {}
2050 };
2051 
2052 
2053 class Create_func_ifnull : public Create_func_arg2
2054 {
2055 public:
2056   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
2057 
2058   static Create_func_ifnull s_singleton;
2059 
2060 protected:
Create_func_ifnull()2061   Create_func_ifnull() {}
~Create_func_ifnull()2062   virtual ~Create_func_ifnull() {}
2063 };
2064 
2065 
2066 class Create_func_inet_ntoa : public Create_func_arg1
2067 {
2068 public:
2069   virtual Item *create(THD *thd, Item *arg1);
2070 
2071   static Create_func_inet_ntoa s_singleton;
2072 
2073 protected:
Create_func_inet_ntoa()2074   Create_func_inet_ntoa() {}
~Create_func_inet_ntoa()2075   virtual ~Create_func_inet_ntoa() {}
2076 };
2077 
2078 
2079 class Create_func_inet_aton : public Create_func_arg1
2080 {
2081 public:
2082   virtual Item *create(THD *thd, Item *arg1);
2083 
2084   static Create_func_inet_aton s_singleton;
2085 
2086 protected:
Create_func_inet_aton()2087   Create_func_inet_aton() {}
~Create_func_inet_aton()2088   virtual ~Create_func_inet_aton() {}
2089 };
2090 
2091 
2092 class Create_func_inet6_aton : public Create_func_arg1
2093 {
2094 public:
2095   virtual Item *create(THD *thd, Item *arg1);
2096 
2097   static Create_func_inet6_aton s_singleton;
2098 
2099 protected:
Create_func_inet6_aton()2100   Create_func_inet6_aton() {}
~Create_func_inet6_aton()2101   virtual ~Create_func_inet6_aton() {}
2102 };
2103 
2104 
2105 class Create_func_inet6_ntoa : public Create_func_arg1
2106 {
2107 public:
2108   virtual Item *create(THD *thd, Item *arg1);
2109 
2110   static Create_func_inet6_ntoa s_singleton;
2111 
2112 protected:
Create_func_inet6_ntoa()2113   Create_func_inet6_ntoa() {}
~Create_func_inet6_ntoa()2114   virtual ~Create_func_inet6_ntoa() {}
2115 };
2116 
2117 
2118 class Create_func_is_ipv4 : public Create_func_arg1
2119 {
2120 public:
2121   virtual Item *create(THD *thd, Item *arg1);
2122 
2123   static Create_func_is_ipv4 s_singleton;
2124 
2125 protected:
Create_func_is_ipv4()2126   Create_func_is_ipv4() {}
~Create_func_is_ipv4()2127   virtual ~Create_func_is_ipv4() {}
2128 };
2129 
2130 
2131 class Create_func_is_ipv6 : public Create_func_arg1
2132 {
2133 public:
2134   virtual Item *create(THD *thd, Item *arg1);
2135 
2136   static Create_func_is_ipv6 s_singleton;
2137 
2138 protected:
Create_func_is_ipv6()2139   Create_func_is_ipv6() {}
~Create_func_is_ipv6()2140   virtual ~Create_func_is_ipv6() {}
2141 };
2142 
2143 
2144 class Create_func_is_ipv4_compat : public Create_func_arg1
2145 {
2146 public:
2147   virtual Item *create(THD *thd, Item *arg1);
2148 
2149   static Create_func_is_ipv4_compat s_singleton;
2150 
2151 protected:
Create_func_is_ipv4_compat()2152   Create_func_is_ipv4_compat() {}
~Create_func_is_ipv4_compat()2153   virtual ~Create_func_is_ipv4_compat() {}
2154 };
2155 
2156 
2157 class Create_func_is_ipv4_mapped : public Create_func_arg1
2158 {
2159 public:
2160   virtual Item *create(THD *thd, Item *arg1);
2161 
2162   static Create_func_is_ipv4_mapped s_singleton;
2163 
2164 protected:
Create_func_is_ipv4_mapped()2165   Create_func_is_ipv4_mapped() {}
~Create_func_is_ipv4_mapped()2166   virtual ~Create_func_is_ipv4_mapped() {}
2167 };
2168 
2169 
2170 class Create_func_instr : public Create_func_arg2
2171 {
2172 public:
2173   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
2174 
2175   static Create_func_instr s_singleton;
2176 
2177 protected:
Create_func_instr()2178   Create_func_instr() {}
~Create_func_instr()2179   virtual ~Create_func_instr() {}
2180 };
2181 
2182 
2183 class Create_func_interiorringn : public Create_func_arg2
2184 {
2185 public:
2186   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
2187 
2188   static Create_func_interiorringn s_singleton;
2189 
2190 protected:
Create_func_interiorringn()2191   Create_func_interiorringn() {}
~Create_func_interiorringn()2192   virtual ~Create_func_interiorringn() {}
2193 };
2194 
2195 
2196 class Create_func_interiorringn_deprecated : public Create_func_interiorringn
2197 {
2198 public:
create(THD * thd,Item * arg1,Item * arg2)2199   virtual Item *create(THD *thd, Item *arg1, Item *arg2)
2200   {
2201     push_deprecated_warn(thd, "INTERIORRINGN", "ST_INTERIORRINGN");
2202     return Create_func_interiorringn::create(thd, arg1, arg2);
2203   }
2204 
2205   static Create_func_interiorringn_deprecated s_singleton;
2206 };
2207 Create_func_interiorringn_deprecated Create_func_interiorringn_deprecated::s_singleton;
2208 
2209 
2210 class Create_func_mbr_intersects : public Create_func_arg2
2211 {
2212 public:
2213   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
2214 
2215   static Create_func_mbr_intersects s_singleton;
2216 
2217 protected:
Create_func_mbr_intersects()2218   Create_func_mbr_intersects() {}
~Create_func_mbr_intersects()2219   virtual ~Create_func_mbr_intersects() {}
2220 };
2221 
2222 
2223 class Create_func_intersects_deprecated : public Create_func_mbr_intersects
2224 {
2225 public:
create(THD * thd,Item * arg1,Item * arg2)2226   virtual Item *create(THD *thd, Item *arg1, Item *arg2)
2227   {
2228     push_deprecated_warn(thd, "INTERSECTS", "MBRINTERSECTS");
2229     return Create_func_mbr_intersects::create(thd, arg1, arg2);
2230   }
2231 
2232   static Create_func_intersects_deprecated s_singleton;
2233 };
2234 Create_func_intersects_deprecated Create_func_intersects_deprecated::s_singleton;
2235 
2236 
2237 class Create_func_intersects : public Create_func_arg2
2238 {
2239 public:
2240   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
2241 
2242   static Create_func_intersects s_singleton;
2243 
2244 protected:
Create_func_intersects()2245   Create_func_intersects() {}
~Create_func_intersects()2246   virtual ~Create_func_intersects() {}
2247 };
2248 
2249 
2250 class Create_func_intersection : public Create_func_arg2
2251 {
2252 public:
2253   virtual Item* create(THD *thd, Item *arg1, Item *arg2);
2254 
2255   static Create_func_intersection s_singleton;
2256 
2257 protected:
Create_func_intersection()2258   Create_func_intersection() {}
~Create_func_intersection()2259   virtual ~Create_func_intersection() {}
2260 };
2261 
2262 
2263 class Create_func_difference : public Create_func_arg2
2264 {
2265 public:
2266   virtual Item* create(THD *thd, Item *arg1, Item *arg2);
2267 
2268   static Create_func_difference s_singleton;
2269 
2270 protected:
Create_func_difference()2271   Create_func_difference() {}
~Create_func_difference()2272   virtual ~Create_func_difference() {}
2273 };
2274 
2275 
2276 class Create_func_union : public Create_func_arg2
2277 {
2278 public:
2279   virtual Item* create(THD *thd, Item *arg1, Item *arg2);
2280 
2281   static Create_func_union s_singleton;
2282 
2283 protected:
Create_func_union()2284   Create_func_union() {}
~Create_func_union()2285   virtual ~Create_func_union() {}
2286 };
2287 
2288 
2289 class Create_func_symdifference : public Create_func_arg2
2290 {
2291 public:
2292   virtual Item* create(THD *thd, Item *arg1, Item *arg2);
2293 
2294   static Create_func_symdifference s_singleton;
2295 
2296 protected:
Create_func_symdifference()2297   Create_func_symdifference() {}
~Create_func_symdifference()2298   virtual ~Create_func_symdifference() {}
2299 };
2300 
2301 
2302 class Create_func_buffer : public Create_native_func
2303 {
2304 public:
2305   virtual Item *create_native(THD *thd, LEX_STRING name,
2306                               PT_item_list *item_list);
2307 
2308   static Create_func_buffer s_singleton;
2309 
2310 protected:
Create_func_buffer()2311   Create_func_buffer() {}
~Create_func_buffer()2312   virtual ~Create_func_buffer() {}
2313 };
2314 
2315 
2316 class Create_func_buffer_deprecated : public Create_func_buffer
2317 {
2318 public:
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)2319   virtual Item *create_native(THD *thd, LEX_STRING name,
2320                               PT_item_list *item_list)
2321   {
2322     push_deprecated_warn(current_thd, "BUFFER", "ST_BUFFER");
2323     return Create_func_buffer::create_native(thd, name, item_list);
2324   }
2325 
2326   static Create_func_buffer_deprecated s_singleton;
2327 };
2328 Create_func_buffer_deprecated Create_func_buffer_deprecated::s_singleton;
2329 
2330 
2331 class Create_func_is_free_lock : public Create_func_arg1
2332 {
2333 public:
2334   virtual Item *create(THD *thd, Item *arg1);
2335 
2336   static Create_func_is_free_lock s_singleton;
2337 
2338 protected:
Create_func_is_free_lock()2339   Create_func_is_free_lock() {}
~Create_func_is_free_lock()2340   virtual ~Create_func_is_free_lock() {}
2341 };
2342 
2343 
2344 class Create_func_is_used_lock : public Create_func_arg1
2345 {
2346 public:
2347   virtual Item *create(THD *thd, Item *arg1);
2348 
2349   static Create_func_is_used_lock s_singleton;
2350 
2351 protected:
Create_func_is_used_lock()2352   Create_func_is_used_lock() {}
~Create_func_is_used_lock()2353   virtual ~Create_func_is_used_lock() {}
2354 };
2355 
2356 
2357 class Create_func_isclosed : public Create_func_arg1
2358 {
2359 public:
2360   virtual Item *create(THD *thd, Item *arg1);
2361 
2362   static Create_func_isclosed s_singleton;
2363 
2364 protected:
Create_func_isclosed()2365   Create_func_isclosed() {}
~Create_func_isclosed()2366   virtual ~Create_func_isclosed() {}
2367 };
2368 
2369 
2370 class Create_func_isclosed_deprecated : public Create_func_isclosed
2371 {
2372 public:
create(THD * thd,Item * arg1)2373   virtual Item *create(THD *thd, Item *arg1)
2374   {
2375     push_deprecated_warn(thd, "ISCLOSED", "ST_ISCLOSED");
2376     return Create_func_isclosed::create(thd, arg1);
2377   }
2378 
2379   static Create_func_isclosed_deprecated s_singleton;
2380 };
2381 Create_func_isclosed_deprecated Create_func_isclosed_deprecated::s_singleton;
2382 
2383 
2384 class Create_func_isempty : public Create_func_arg1
2385 {
2386 public:
2387   virtual Item *create(THD *thd, Item *arg1);
2388 
2389   static Create_func_isempty s_singleton;
2390 
2391 protected:
Create_func_isempty()2392   Create_func_isempty() {}
~Create_func_isempty()2393   virtual ~Create_func_isempty() {}
2394 };
2395 
2396 
2397 class Create_func_isempty_deprecated : public Create_func_isempty
2398 {
2399 public:
create(THD * thd,Item * arg1)2400   virtual Item *create(THD *thd, Item *arg1)
2401   {
2402     push_deprecated_warn(thd, "ISEMPTY", "ST_ISEMPTY");
2403     return Create_func_isempty::create(thd, arg1);
2404   }
2405 
2406   static Create_func_isempty_deprecated s_singleton;
2407 };
2408 Create_func_isempty_deprecated Create_func_isempty_deprecated::s_singleton;
2409 
2410 
2411 class Create_func_isnull : public Create_func_arg1
2412 {
2413 public:
2414   virtual Item *create(THD *thd, Item *arg1);
2415 
2416   static Create_func_isnull s_singleton;
2417 
2418 protected:
Create_func_isnull()2419   Create_func_isnull() {}
~Create_func_isnull()2420   virtual ~Create_func_isnull() {}
2421 };
2422 
2423 
2424 class Create_func_issimple : public Create_func_arg1
2425 {
2426 public:
2427   virtual Item *create(THD *thd, Item *arg1);
2428 
2429   static Create_func_issimple s_singleton;
2430 
2431 protected:
Create_func_issimple()2432   Create_func_issimple() {}
~Create_func_issimple()2433   virtual ~Create_func_issimple() {}
2434 };
2435 
2436 class Create_func_json_valid : public Create_func_arg1
2437 {
2438 public:
2439   virtual Item *create(THD *thd, Item *arg1);
2440 
2441   static Create_func_json_valid s_singleton;
2442 protected:
Create_func_json_valid()2443   Create_func_json_valid() {}
~Create_func_json_valid()2444   virtual ~Create_func_json_valid() {}
2445 };
2446 
2447 class Create_func_json_contains : public Create_native_func
2448 {
2449 public:
2450   virtual Item *create_native(THD *thd, LEX_STRING name, PT_item_list *item_list);
2451 
2452   static Create_func_json_contains s_singleton;
2453 protected:
Create_func_json_contains()2454   Create_func_json_contains() {}
~Create_func_json_contains()2455   virtual ~Create_func_json_contains() {}
2456 };
2457 
2458 class Create_func_json_contains_path : public Create_native_func
2459 {
2460 public:
2461   virtual Item *create_native(THD *thd, LEX_STRING name, PT_item_list *item_list);
2462 
2463   static Create_func_json_contains_path s_singleton;
2464 protected:
Create_func_json_contains_path()2465   Create_func_json_contains_path() {}
~Create_func_json_contains_path()2466   virtual ~Create_func_json_contains_path() {}
2467 };
2468 
2469 class Create_func_json_length : public Create_native_func
2470 {
2471 public:
2472   virtual Item *create_native(THD *thd, LEX_STRING name, PT_item_list *item_list);
2473 
2474   static Create_func_json_length s_singleton;
2475 
2476 protected:
Create_func_json_length()2477   Create_func_json_length() {}
~Create_func_json_length()2478   virtual ~Create_func_json_length() {}
2479 };
2480 
2481 class Create_func_json_depth : public Create_native_func
2482 {
2483 public:
2484   virtual Item *create_native(THD *thd, LEX_STRING name, PT_item_list *item_list);
2485 
2486   static Create_func_json_depth s_singleton;
2487 
2488 protected:
Create_func_json_depth()2489   Create_func_json_depth() {}
~Create_func_json_depth()2490   virtual ~Create_func_json_depth() {}
2491 };
2492 
2493 class Create_func_json_pretty : public Create_func_arg1
2494 {
2495 public:
2496   static Create_func_json_pretty s_singleton;
create(THD * thd,Item * arg1)2497   virtual Item *create(THD *thd, Item *arg1)
2498   {
2499     return new (thd->mem_root) Item_func_json_pretty(POS(), arg1);
2500   }
2501 };
2502 Create_func_json_pretty Create_func_json_pretty::s_singleton;
2503 
2504 class Create_func_json_type : public Create_func_arg1
2505 {
2506 public:
2507   virtual Item *create(THD *thd, Item *arg1);
2508 
2509   static Create_func_json_type s_singleton;
2510 protected:
Create_func_json_type()2511   Create_func_json_type() {}
~Create_func_json_type()2512   virtual ~Create_func_json_type() {}
2513 };
2514 
2515 class Create_func_json_keys : public Create_native_func
2516 {
2517 public:
2518   virtual Item *create_native(THD *thd, LEX_STRING name,
2519                               PT_item_list *item_list);
2520 
2521   static Create_func_json_keys s_singleton;
2522 protected:
Create_func_json_keys()2523   Create_func_json_keys() {}
~Create_func_json_keys()2524   virtual ~Create_func_json_keys() {}
2525 };
2526 
2527 class Create_func_json_extract : public Create_native_func
2528 {
2529 public:
2530   virtual Item *create_native(THD *thd, LEX_STRING name,
2531                               PT_item_list *item_list);
2532 
2533   static Create_func_json_extract s_singleton;
2534 protected:
Create_func_json_extract()2535   Create_func_json_extract() {}
~Create_func_json_extract()2536   virtual ~Create_func_json_extract() {}
2537 };
2538 
2539 class Create_func_json_array_append : public Create_native_func
2540 {
2541 public:
2542   virtual Item *create_native(THD *thd, LEX_STRING name,
2543                               PT_item_list *item_list);
2544 
2545   static Create_func_json_array_append s_singleton;
2546 
2547 protected:
Create_func_json_array_append()2548   Create_func_json_array_append() {}
~Create_func_json_array_append()2549   virtual ~Create_func_json_array_append() {}
2550 
2551 };
2552 
2553 class Create_func_json_insert : public Create_native_func
2554 {
2555 public:
2556   virtual Item *create_native(THD *thd, LEX_STRING name,
2557                               PT_item_list *item_list);
2558 
2559   static Create_func_json_insert s_singleton;
2560 
2561 protected:
Create_func_json_insert()2562   Create_func_json_insert() {}
~Create_func_json_insert()2563   virtual ~Create_func_json_insert() {}
2564 
2565 };
2566 
2567 class Create_func_json_array_insert : public Create_native_func
2568 {
2569 public:
2570   virtual Item *create_native(THD *thd, LEX_STRING name,
2571                               PT_item_list *item_list);
2572 
2573   static Create_func_json_array_insert s_singleton;
2574 
2575 protected:
Create_func_json_array_insert()2576   Create_func_json_array_insert() {}
~Create_func_json_array_insert()2577   virtual ~Create_func_json_array_insert() {}
2578 
2579 };
2580 
2581 class Create_func_json_row_object : public Create_native_func
2582 {
2583 public:
2584   virtual Item *create_native(THD *thd, LEX_STRING name,
2585                               PT_item_list *item_list);
2586 
2587   static Create_func_json_row_object s_singleton;
2588 
2589 protected:
Create_func_json_row_object()2590   Create_func_json_row_object() {}
~Create_func_json_row_object()2591   virtual ~Create_func_json_row_object() {}
2592 
2593 };
2594 
2595 class Create_func_json_search : public Create_native_func
2596 {
2597 public:
2598   virtual Item *create_native(THD *thd, LEX_STRING name,
2599                               PT_item_list *item_list);
2600 
2601   static Create_func_json_search s_singleton;
2602 
2603 protected:
Create_func_json_search()2604   Create_func_json_search() {}
~Create_func_json_search()2605   virtual ~Create_func_json_search() {}
2606 
2607 };
2608 
2609 class Create_func_json_set : public Create_native_func
2610 {
2611 public:
2612   virtual Item *create_native(THD *thd, LEX_STRING name,
2613                               PT_item_list *item_list);
2614 
2615   static Create_func_json_set s_singleton;
2616 
2617 protected:
Create_func_json_set()2618   Create_func_json_set() {}
~Create_func_json_set()2619   virtual ~Create_func_json_set() {}
2620 
2621 };
2622 
2623 class Create_func_json_replace : public Create_native_func
2624 {
2625 public:
2626   virtual Item *create_native(THD *thd, LEX_STRING name,
2627                               PT_item_list *item_list);
2628 
2629   static Create_func_json_replace s_singleton;
2630 
2631 protected:
Create_func_json_replace()2632   Create_func_json_replace() {}
~Create_func_json_replace()2633   virtual ~Create_func_json_replace() {}
2634 
2635 };
2636 
2637 class Create_func_json_array : public Create_native_func
2638 {
2639 public:
2640   virtual Item *create_native(THD *thd, LEX_STRING name,
2641                               PT_item_list *item_list);
2642 
2643   static Create_func_json_array s_singleton;
2644 
2645 protected:
Create_func_json_array()2646   Create_func_json_array() {}
~Create_func_json_array()2647   virtual ~Create_func_json_array() {}
2648 
2649 };
2650 
2651 class Create_func_json_remove : public Create_native_func
2652 {
2653 public:
2654   virtual Item *create_native(THD *thd, LEX_STRING name,
2655                               PT_item_list *item_list);
2656 
2657   static Create_func_json_remove s_singleton;
2658 
2659 protected:
Create_func_json_remove()2660   Create_func_json_remove() {}
~Create_func_json_remove()2661   virtual ~Create_func_json_remove() {}
2662 };
2663 
2664 class Create_func_isvalid : public Create_func_arg1
2665 {
2666 public:
2667   virtual Item *create(THD *thd, Item *arg1);
2668 
2669   static Create_func_isvalid s_singleton;
2670 
2671 protected:
Create_func_isvalid()2672   Create_func_isvalid() {}
~Create_func_isvalid()2673   virtual ~Create_func_isvalid() {}
2674 };
2675 
2676 
2677 class Create_func_validate : public Create_func_arg1
2678 {
2679 public:
2680   virtual Item* create(THD *thd, Item *arg1);
2681 
2682   static Create_func_validate s_singleton;
2683 
2684 protected:
Create_func_validate()2685   Create_func_validate() {}
~Create_func_validate()2686   virtual ~Create_func_validate() {}
2687 };
2688 
2689 
2690 class Create_func_issimple_deprecated : public Create_func_issimple
2691 {
2692 public:
create(THD * thd,Item * arg1)2693   virtual Item *create(THD *thd, Item *arg1)
2694   {
2695     push_deprecated_warn(thd, "ISSIMPLE", "ST_ISSIMPLE");
2696     return Create_func_issimple::create(thd, arg1);
2697   }
2698 
2699   static Create_func_issimple_deprecated s_singleton;
2700 };
2701 Create_func_issimple_deprecated Create_func_issimple_deprecated::s_singleton;
2702 
2703 class Create_func_json_merge_patch : public Create_native_func
2704 {
2705 public:
2706   virtual Item *create_native(THD *thd, LEX_STRING name,
2707                               PT_item_list *item_list);
2708 
2709   static Create_func_json_merge_patch s_singleton;
2710 };
2711 Create_func_json_merge_patch Create_func_json_merge_patch::s_singleton;
2712 
2713 class Create_func_json_merge_preserve : public Create_native_func
2714 {
2715 public:
2716   virtual Item *create_native(THD *thd, LEX_STRING name,
2717                               PT_item_list *item_list);
2718 
2719   static Create_func_json_merge_preserve s_singleton;
2720 
2721 protected:
Create_func_json_merge_preserve()2722   Create_func_json_merge_preserve() {}
~Create_func_json_merge_preserve()2723   virtual ~Create_func_json_merge_preserve() {}
2724 };
2725 Create_func_json_merge_preserve Create_func_json_merge_preserve::s_singleton;
2726 
2727 class Create_func_json_merge : public Create_func_json_merge_preserve
2728 {
2729 public:
2730   static Create_func_json_merge s_singleton;
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)2731   virtual Item *create_native(THD *thd, LEX_STRING name,
2732                               PT_item_list *item_list)
2733   {
2734     Item *func= Create_func_json_merge_preserve::create_native(thd, name,
2735                                                                item_list);
2736     /*
2737       JSON_MERGE is a deprecated alias for JSON_MERGE_PRESERVE. Warn
2738       the users and recommend that they specify explicitly what kind
2739       of merge operation they want.
2740     */
2741     if (func != NULL)
2742       push_deprecated_warn(thd, "JSON_MERGE",
2743                            "JSON_MERGE_PRESERVE/JSON_MERGE_PATCH");
2744 
2745     return func;
2746   }
2747 };
2748 Create_func_json_merge Create_func_json_merge::s_singleton;
2749 
2750 class Create_func_json_quote : public Create_native_func
2751 {
2752 public:
2753   virtual Item *create_native(THD *thd, LEX_STRING name,
2754                               PT_item_list *item_list);
2755 
2756   static Create_func_json_quote s_singleton;
2757 
2758 protected:
Create_func_json_quote()2759   Create_func_json_quote() {}
~Create_func_json_quote()2760   virtual ~Create_func_json_quote() {}
2761 };
2762 
2763 class Create_func_json_storage_size : public Create_func_arg1
2764 {
2765 public:
2766   static Create_func_json_storage_size s_singleton;
create(THD * thd,Item * arg1)2767   virtual Item *create(THD *thd, Item *arg1)
2768   {
2769     return new (thd->mem_root) Item_func_json_storage_size(POS(), arg1);
2770   }
2771 };
2772 Create_func_json_storage_size Create_func_json_storage_size::s_singleton;
2773 
2774 class Create_func_json_unquote : public Create_native_func
2775 {
2776 public:
2777   virtual Item *create_native(THD *thd, LEX_STRING name,
2778                               PT_item_list *item_list);
2779 
2780   static Create_func_json_unquote s_singleton;
2781 
2782 protected:
Create_func_json_unquote()2783   Create_func_json_unquote() {}
~Create_func_json_unquote()2784   virtual ~Create_func_json_unquote() {}
2785 };
2786 
2787 class Create_func_latfromgeohash : public Create_func_arg1
2788 {
2789 public:
2790   virtual Item *create(THD *thd, Item *arg1);
2791 
2792   static Create_func_latfromgeohash s_singleton;
2793 
2794 protected:
Create_func_latfromgeohash()2795   Create_func_latfromgeohash() {}
~Create_func_latfromgeohash()2796   virtual ~Create_func_latfromgeohash() {}
2797 };
2798 
2799 
2800 class Create_func_longfromgeohash : public Create_func_arg1
2801 {
2802 public:
2803   virtual Item *create(THD *thd, Item *arg1);
2804 
2805   static Create_func_longfromgeohash s_singleton;
2806 
2807 protected:
Create_func_longfromgeohash()2808   Create_func_longfromgeohash() {}
~Create_func_longfromgeohash()2809   virtual ~Create_func_longfromgeohash() {}
2810 };
2811 
2812 
2813 class Create_func_last_day : public Create_func_arg1
2814 {
2815 public:
2816   virtual Item *create(THD *thd, Item *arg1);
2817 
2818   static Create_func_last_day s_singleton;
2819 
2820 protected:
Create_func_last_day()2821   Create_func_last_day() {}
~Create_func_last_day()2822   virtual ~Create_func_last_day() {}
2823 };
2824 
2825 
2826 class Create_func_last_insert_id : public Create_native_func
2827 {
2828 public:
2829   virtual Item *create_native(THD *thd, LEX_STRING name,
2830                               PT_item_list *item_list);
2831 
2832   static Create_func_last_insert_id s_singleton;
2833 
2834 protected:
Create_func_last_insert_id()2835   Create_func_last_insert_id() {}
~Create_func_last_insert_id()2836   virtual ~Create_func_last_insert_id() {}
2837 };
2838 
2839 
2840 class Create_func_lower : public Create_func_arg1
2841 {
2842 public:
2843   virtual Item *create(THD *thd, Item *arg1);
2844 
2845   static Create_func_lower s_singleton;
2846 
2847 protected:
Create_func_lower()2848   Create_func_lower() {}
~Create_func_lower()2849   virtual ~Create_func_lower() {}
2850 };
2851 
2852 
2853 class Create_func_least : public Create_native_func
2854 {
2855 public:
2856   virtual Item *create_native(THD *thd, LEX_STRING name,
2857                               PT_item_list *item_list);
2858 
2859   static Create_func_least s_singleton;
2860 
2861 protected:
Create_func_least()2862   Create_func_least() {}
~Create_func_least()2863   virtual ~Create_func_least() {}
2864 };
2865 
2866 
2867 class Create_func_length : public Create_func_arg1
2868 {
2869 public:
2870   virtual Item *create(THD *thd, Item *arg1);
2871 
2872   static Create_func_length s_singleton;
2873 
2874 protected:
Create_func_length()2875   Create_func_length() {}
~Create_func_length()2876   virtual ~Create_func_length() {}
2877 };
2878 
2879 
2880 #ifndef NDEBUG
2881 class Create_func_like_range_min : public Create_func_arg2
2882 {
2883 public:
2884   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
2885 
2886   static Create_func_like_range_min s_singleton;
2887 
2888 protected:
Create_func_like_range_min()2889   Create_func_like_range_min() {}
~Create_func_like_range_min()2890   virtual ~Create_func_like_range_min() {}
2891 };
2892 
2893 
2894 class Create_func_like_range_max : public Create_func_arg2
2895 {
2896 public:
2897   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
2898 
2899   static Create_func_like_range_max s_singleton;
2900 
2901 protected:
Create_func_like_range_max()2902   Create_func_like_range_max() {}
~Create_func_like_range_max()2903   virtual ~Create_func_like_range_max() {}
2904 };
2905 #endif
2906 
2907 
2908 class Create_func_ln : public Create_func_arg1
2909 {
2910 public:
2911   virtual Item *create(THD *thd, Item *arg1);
2912 
2913   static Create_func_ln s_singleton;
2914 
2915 protected:
Create_func_ln()2916   Create_func_ln() {}
~Create_func_ln()2917   virtual ~Create_func_ln() {}
2918 };
2919 
2920 
2921 class Create_func_load_file : public Create_func_arg1
2922 {
2923 public:
2924   virtual Item *create(THD *thd, Item *arg1);
2925 
2926   static Create_func_load_file s_singleton;
2927 
2928 protected:
Create_func_load_file()2929   Create_func_load_file() {}
~Create_func_load_file()2930   virtual ~Create_func_load_file() {}
2931 };
2932 
2933 
2934 class Create_func_locate : public Create_native_func
2935 {
2936 public:
2937   virtual Item *create_native(THD *thd, LEX_STRING name,
2938                               PT_item_list *item_list);
2939 
2940   static Create_func_locate s_singleton;
2941 
2942 protected:
Create_func_locate()2943   Create_func_locate() {}
~Create_func_locate()2944   virtual ~Create_func_locate() {}
2945 };
2946 
2947 
2948 class Create_func_log : public Create_native_func
2949 {
2950 public:
2951   virtual Item *create_native(THD *thd, LEX_STRING name,
2952                               PT_item_list *item_list);
2953 
2954   static Create_func_log s_singleton;
2955 
2956 protected:
Create_func_log()2957   Create_func_log() {}
~Create_func_log()2958   virtual ~Create_func_log() {}
2959 };
2960 
2961 
2962 class Create_func_log10 : public Create_func_arg1
2963 {
2964 public:
2965   virtual Item *create(THD *thd, Item *arg1);
2966 
2967   static Create_func_log10 s_singleton;
2968 
2969 protected:
Create_func_log10()2970   Create_func_log10() {}
~Create_func_log10()2971   virtual ~Create_func_log10() {}
2972 };
2973 
2974 
2975 class Create_func_log2 : public Create_func_arg1
2976 {
2977 public:
2978   virtual Item *create(THD *thd, Item *arg1);
2979 
2980   static Create_func_log2 s_singleton;
2981 
2982 protected:
Create_func_log2()2983   Create_func_log2() {}
~Create_func_log2()2984   virtual ~Create_func_log2() {}
2985 };
2986 
2987 
2988 class Create_func_lpad : public Create_func_arg3
2989 {
2990 public:
2991   virtual Item *create(THD *thd, Item *arg1, Item *arg2, Item *arg3);
2992 
2993   static Create_func_lpad s_singleton;
2994 
2995 protected:
Create_func_lpad()2996   Create_func_lpad() {}
~Create_func_lpad()2997   virtual ~Create_func_lpad() {}
2998 };
2999 
3000 
3001 class Create_func_ltrim : public Create_func_arg1
3002 {
3003 public:
3004   virtual Item *create(THD *thd, Item *arg1);
3005 
3006   static Create_func_ltrim s_singleton;
3007 
3008 protected:
Create_func_ltrim()3009   Create_func_ltrim() {}
~Create_func_ltrim()3010   virtual ~Create_func_ltrim() {}
3011 };
3012 
3013 
3014 class Create_func_makedate : public Create_func_arg2
3015 {
3016 public:
3017   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
3018 
3019   static Create_func_makedate s_singleton;
3020 
3021 protected:
Create_func_makedate()3022   Create_func_makedate() {}
~Create_func_makedate()3023   virtual ~Create_func_makedate() {}
3024 };
3025 
3026 
3027 class Create_func_make_envelope : public Create_func_arg2
3028 {
3029 public:
3030   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
3031 
3032   static Create_func_make_envelope s_singleton;
3033 
3034 protected:
Create_func_make_envelope()3035   Create_func_make_envelope() {}
~Create_func_make_envelope()3036   virtual ~Create_func_make_envelope() {}
3037 };
3038 
3039 
3040 class Create_func_maketime : public Create_func_arg3
3041 {
3042 public:
3043   virtual Item *create(THD *thd, Item *arg1, Item *arg2, Item *arg3);
3044 
3045   static Create_func_maketime s_singleton;
3046 
3047 protected:
Create_func_maketime()3048   Create_func_maketime() {}
~Create_func_maketime()3049   virtual ~Create_func_maketime() {}
3050 };
3051 
3052 
3053 class Create_func_make_set : public Create_native_func
3054 {
3055 public:
3056   virtual Item *create_native(THD *thd, LEX_STRING name,
3057                               PT_item_list *item_list);
3058 
3059   static Create_func_make_set s_singleton;
3060 
3061 protected:
Create_func_make_set()3062   Create_func_make_set() {}
~Create_func_make_set()3063   virtual ~Create_func_make_set() {}
3064 };
3065 
3066 
3067 class Create_func_master_pos_wait : public Create_native_func
3068 {
3069 public:
3070   virtual Item *create_native(THD *thd, LEX_STRING name,
3071                               PT_item_list *item_list);
3072 
3073   static Create_func_master_pos_wait s_singleton;
3074 
3075 protected:
Create_func_master_pos_wait()3076   Create_func_master_pos_wait() {}
~Create_func_master_pos_wait()3077   virtual ~Create_func_master_pos_wait() {}
3078 };
3079 
3080 class Create_func_executed_gtid_set_wait : public Create_native_func
3081 {
3082 public:
3083   virtual Item *create_native(THD *thd, LEX_STRING name,
3084                               PT_item_list *item_list);
3085 
3086   static Create_func_executed_gtid_set_wait s_singleton;
3087 
3088 protected:
Create_func_executed_gtid_set_wait()3089   Create_func_executed_gtid_set_wait() {}
~Create_func_executed_gtid_set_wait()3090   virtual ~Create_func_executed_gtid_set_wait() {}
3091 };
3092 
3093 class Create_func_master_gtid_set_wait : public Create_native_func
3094 {
3095 public:
3096   virtual Item *create_native(THD *thd, LEX_STRING name,
3097                               PT_item_list *item_list);
3098 
3099   static Create_func_master_gtid_set_wait s_singleton;
3100 
3101 protected:
Create_func_master_gtid_set_wait()3102   Create_func_master_gtid_set_wait() {}
~Create_func_master_gtid_set_wait()3103   virtual ~Create_func_master_gtid_set_wait() {}
3104 };
3105 
3106 class Create_func_md5 : public Create_func_arg1
3107 {
3108 public:
3109   virtual Item *create(THD *thd, Item *arg1);
3110 
3111   static Create_func_md5 s_singleton;
3112 
3113 protected:
Create_func_md5()3114   Create_func_md5() {}
~Create_func_md5()3115   virtual ~Create_func_md5() {}
3116 };
3117 
3118 
3119 class Create_func_monthname : public Create_func_arg1
3120 {
3121 public:
3122   virtual Item *create(THD *thd, Item *arg1);
3123 
3124   static Create_func_monthname s_singleton;
3125 
3126 protected:
Create_func_monthname()3127   Create_func_monthname() {}
~Create_func_monthname()3128   virtual ~Create_func_monthname() {}
3129 };
3130 
3131 
3132 class Create_func_name_const : public Create_func_arg2
3133 {
3134 public:
3135   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
3136 
3137   static Create_func_name_const s_singleton;
3138 
3139 protected:
Create_func_name_const()3140   Create_func_name_const() {}
~Create_func_name_const()3141   virtual ~Create_func_name_const() {}
3142 };
3143 
3144 
3145 class Create_func_nullif : public Create_func_arg2
3146 {
3147 public:
3148   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
3149 
3150   static Create_func_nullif s_singleton;
3151 
3152 protected:
Create_func_nullif()3153   Create_func_nullif() {}
~Create_func_nullif()3154   virtual ~Create_func_nullif() {}
3155 };
3156 
3157 
3158 class Create_func_numgeometries : public Create_func_arg1
3159 {
3160 public:
3161   virtual Item *create(THD *thd, Item *arg1);
3162 
3163   static Create_func_numgeometries s_singleton;
3164 
3165 protected:
Create_func_numgeometries()3166   Create_func_numgeometries() {}
~Create_func_numgeometries()3167   virtual ~Create_func_numgeometries() {}
3168 };
3169 
3170 
3171 class Create_func_numgeometries_deprecated : public Create_func_numgeometries
3172 {
3173 public:
create(THD * thd,Item * arg1)3174   virtual Item *create(THD *thd, Item *arg1)
3175   {
3176     push_deprecated_warn(thd, "NUMGEOMETRIES", "ST_NUMGEOMETRIES");
3177     return Create_func_numgeometries::create(thd, arg1);
3178   }
3179 
3180   static Create_func_numgeometries_deprecated s_singleton;
3181 };
3182 Create_func_numgeometries_deprecated Create_func_numgeometries_deprecated::s_singleton;
3183 
3184 
3185 class Create_func_numinteriorring : public Create_func_arg1
3186 {
3187 public:
3188   virtual Item *create(THD *thd, Item *arg1);
3189 
3190   static Create_func_numinteriorring s_singleton;
3191 
3192 protected:
Create_func_numinteriorring()3193   Create_func_numinteriorring() {}
~Create_func_numinteriorring()3194   virtual ~Create_func_numinteriorring() {}
3195 };
3196 
3197 
3198 class Create_func_numinteriorring_deprecated : public Create_func_numinteriorring
3199 {
3200 public:
create(THD * thd,Item * arg1)3201   virtual Item *create(THD *thd, Item *arg1)
3202   {
3203     push_deprecated_warn(thd, "NUMINTERIORRINGS", "ST_NUMINTERIORRINGS");
3204     return Create_func_numinteriorring::create(thd, arg1);
3205   }
3206 
3207   static Create_func_numinteriorring_deprecated s_singleton;
3208 };
3209 Create_func_numinteriorring_deprecated Create_func_numinteriorring_deprecated::s_singleton;
3210 
3211 
3212 class Create_func_numpoints : public Create_func_arg1
3213 {
3214 public:
3215   virtual Item *create(THD *thd, Item *arg1);
3216 
3217   static Create_func_numpoints s_singleton;
3218 
3219 protected:
Create_func_numpoints()3220   Create_func_numpoints() {}
~Create_func_numpoints()3221   virtual ~Create_func_numpoints() {}
3222 };
3223 
3224 
3225 class Create_func_numpoints_deprecated : public Create_func_numpoints
3226 {
3227 public:
create(THD * thd,Item * arg1)3228   virtual Item *create(THD *thd, Item *arg1)
3229   {
3230     push_deprecated_warn(thd, "NUMPOINTS", "ST_NUMPOINTS");
3231     return Create_func_numpoints::create(thd, arg1);
3232   }
3233 
3234   static Create_func_numpoints_deprecated s_singleton;
3235 };
3236 Create_func_numpoints_deprecated Create_func_numpoints_deprecated::s_singleton;
3237 
3238 
3239 class Create_func_oct : public Create_func_arg1
3240 {
3241 public:
3242   virtual Item *create(THD *thd, Item *arg1);
3243 
3244   static Create_func_oct s_singleton;
3245 
3246 protected:
Create_func_oct()3247   Create_func_oct() {}
~Create_func_oct()3248   virtual ~Create_func_oct() {}
3249 };
3250 
3251 
3252 class Create_func_ord : public Create_func_arg1
3253 {
3254 public:
3255   virtual Item *create(THD *thd, Item *arg1);
3256 
3257   static Create_func_ord s_singleton;
3258 
3259 protected:
Create_func_ord()3260   Create_func_ord() {}
~Create_func_ord()3261   virtual ~Create_func_ord() {}
3262 };
3263 
3264 
3265 class Create_func_mbr_overlaps : public Create_func_arg2
3266 {
3267 public:
3268   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
3269 
3270   static Create_func_mbr_overlaps s_singleton;
3271 
3272 protected:
Create_func_mbr_overlaps()3273   Create_func_mbr_overlaps() {}
~Create_func_mbr_overlaps()3274   virtual ~Create_func_mbr_overlaps() {}
3275 };
3276 
3277 
3278 class Create_func_mbr_overlaps_deprecated : public Create_func_mbr_overlaps
3279 {
3280 public:
create(THD * thd,Item * arg1,Item * arg2)3281   virtual Item *create(THD *thd, Item *arg1, Item *arg2)
3282   {
3283     push_deprecated_warn(thd, "OVERLAPS", "MBROVERLAPS");
3284     return Create_func_mbr_overlaps::create(thd, arg1, arg2);
3285   }
3286 
3287   static Create_func_mbr_overlaps_deprecated s_singleton;
3288 };
3289 Create_func_mbr_overlaps_deprecated Create_func_mbr_overlaps_deprecated::s_singleton;
3290 
3291 
3292 class Create_func_overlaps : public Create_func_arg2
3293 {
3294 public:
3295   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
3296 
3297   static Create_func_overlaps s_singleton;
3298 
3299 protected:
Create_func_overlaps()3300   Create_func_overlaps() {}
~Create_func_overlaps()3301   virtual ~Create_func_overlaps() {}
3302 };
3303 
3304 
3305 class Create_func_period_add : public Create_func_arg2
3306 {
3307 public:
3308   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
3309 
3310   static Create_func_period_add s_singleton;
3311 
3312 protected:
Create_func_period_add()3313   Create_func_period_add() {}
~Create_func_period_add()3314   virtual ~Create_func_period_add() {}
3315 };
3316 
3317 
3318 class Create_func_period_diff : public Create_func_arg2
3319 {
3320 public:
3321   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
3322 
3323   static Create_func_period_diff s_singleton;
3324 
3325 protected:
Create_func_period_diff()3326   Create_func_period_diff() {}
~Create_func_period_diff()3327   virtual ~Create_func_period_diff() {}
3328 };
3329 
3330 
3331 class Create_func_pi : public Create_func_arg0
3332 {
3333 public:
3334   virtual Item *create(THD *thd);
3335 
3336   static Create_func_pi s_singleton;
3337 
3338 protected:
Create_func_pi()3339   Create_func_pi() {}
~Create_func_pi()3340   virtual ~Create_func_pi() {}
3341 };
3342 
3343 
3344 class Create_func_pointfromgeohash : public Create_func_arg2
3345 {
3346 public:
3347   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
3348 
3349   static Create_func_pointfromgeohash s_singleton;
3350 
3351 protected:
Create_func_pointfromgeohash()3352   Create_func_pointfromgeohash() {}
~Create_func_pointfromgeohash()3353   virtual ~Create_func_pointfromgeohash() {}
3354 };
3355 
3356 
3357 class Create_func_pointn : public Create_func_arg2
3358 {
3359 public:
3360   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
3361 
3362   static Create_func_pointn s_singleton;
3363 
3364 protected:
Create_func_pointn()3365   Create_func_pointn() {}
~Create_func_pointn()3366   virtual ~Create_func_pointn() {}
3367 };
3368 
3369 
3370 class Create_func_pointn_deprecated : public Create_func_pointn
3371 {
3372 public:
create(THD * thd,Item * arg1,Item * arg2)3373   virtual Item *create(THD *thd, Item *arg1, Item *arg2)
3374   {
3375     push_deprecated_warn(thd, "POINTN", "ST_POINTN");
3376     return Create_func_pointn::create(thd, arg1, arg2);
3377   }
3378 
3379   static Create_func_pointn_deprecated s_singleton;
3380 };
3381 Create_func_pointn_deprecated Create_func_pointn_deprecated::s_singleton;
3382 
3383 
3384 class Create_func_pow : public Create_func_arg2
3385 {
3386 public:
3387   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
3388 
3389   static Create_func_pow s_singleton;
3390 
3391 protected:
Create_func_pow()3392   Create_func_pow() {}
~Create_func_pow()3393   virtual ~Create_func_pow() {}
3394 };
3395 
3396 
3397 class Create_func_quote : public Create_func_arg1
3398 {
3399 public:
3400   virtual Item *create(THD *thd, Item *arg1);
3401 
3402   static Create_func_quote s_singleton;
3403 
3404 protected:
Create_func_quote()3405   Create_func_quote() {}
~Create_func_quote()3406   virtual ~Create_func_quote() {}
3407 };
3408 
3409 
3410 class Create_func_radians : public Create_func_arg1
3411 {
3412 public:
3413   virtual Item *create(THD *thd, Item *arg1);
3414 
3415   static Create_func_radians s_singleton;
3416 
3417 protected:
Create_func_radians()3418   Create_func_radians() {}
~Create_func_radians()3419   virtual ~Create_func_radians() {}
3420 };
3421 
3422 
3423 class Create_func_rand : public Create_native_func
3424 {
3425 public:
3426   virtual Item *create_native(THD *thd, LEX_STRING name,
3427                               PT_item_list *item_list);
3428 
3429   static Create_func_rand s_singleton;
3430 
3431 protected:
Create_func_rand()3432   Create_func_rand() {}
~Create_func_rand()3433   virtual ~Create_func_rand() {}
3434 };
3435 
3436 
3437 class Create_func_release_all_locks : public Create_func_arg0
3438 {
3439 public:
3440   virtual Item *create(THD *thd);
3441 
3442   static Create_func_release_all_locks s_singleton;
3443 
3444 protected:
Create_func_release_all_locks()3445   Create_func_release_all_locks() {}
~Create_func_release_all_locks()3446   virtual ~Create_func_release_all_locks() {}
3447 };
3448 
3449 
3450 class Create_func_release_lock : public Create_func_arg1
3451 {
3452 public:
3453   virtual Item *create(THD *thd, Item *arg1);
3454 
3455   static Create_func_release_lock s_singleton;
3456 
3457 protected:
Create_func_release_lock()3458   Create_func_release_lock() {}
~Create_func_release_lock()3459   virtual ~Create_func_release_lock() {}
3460 };
3461 
3462 
3463 class Create_func_reverse : public Create_func_arg1
3464 {
3465 public:
3466   virtual Item *create(THD *thd, Item *arg1);
3467 
3468   static Create_func_reverse s_singleton;
3469 
3470 protected:
Create_func_reverse()3471   Create_func_reverse() {}
~Create_func_reverse()3472   virtual ~Create_func_reverse() {}
3473 };
3474 
3475 
3476 class Create_func_round : public Create_native_func
3477 {
3478 public:
3479   virtual Item *create_native(THD *thd, LEX_STRING name,
3480                               PT_item_list *item_list);
3481 
3482   static Create_func_round s_singleton;
3483 
3484 protected:
Create_func_round()3485   Create_func_round() {}
~Create_func_round()3486   virtual ~Create_func_round() {}
3487 };
3488 
3489 
3490 class Create_func_rpad : public Create_func_arg3
3491 {
3492 public:
3493   virtual Item *create(THD *thd, Item *arg1, Item *arg2, Item *arg3);
3494 
3495   static Create_func_rpad s_singleton;
3496 
3497 protected:
Create_func_rpad()3498   Create_func_rpad() {}
~Create_func_rpad()3499   virtual ~Create_func_rpad() {}
3500 };
3501 
3502 
3503 class Create_func_rtrim : public Create_func_arg1
3504 {
3505 public:
3506   virtual Item *create(THD *thd, Item *arg1);
3507 
3508   static Create_func_rtrim s_singleton;
3509 
3510 protected:
Create_func_rtrim()3511   Create_func_rtrim() {}
~Create_func_rtrim()3512   virtual ~Create_func_rtrim() {}
3513 };
3514 
3515 
3516 class Create_func_sec_to_time : public Create_func_arg1
3517 {
3518 public:
3519   virtual Item *create(THD *thd, Item *arg1);
3520 
3521   static Create_func_sec_to_time s_singleton;
3522 
3523 protected:
Create_func_sec_to_time()3524   Create_func_sec_to_time() {}
~Create_func_sec_to_time()3525   virtual ~Create_func_sec_to_time() {}
3526 };
3527 
3528 
3529 class Create_func_sha : public Create_func_arg1
3530 {
3531 public:
3532   virtual Item *create(THD *thd, Item *arg1);
3533 
3534   static Create_func_sha s_singleton;
3535 
3536 protected:
Create_func_sha()3537   Create_func_sha() {}
~Create_func_sha()3538   virtual ~Create_func_sha() {}
3539 };
3540 
3541 
3542 class Create_func_sha2 : public Create_func_arg2
3543 {
3544 public:
3545   virtual Item* create(THD *thd, Item *arg1, Item *arg2);
3546 
3547   static Create_func_sha2 s_singleton;
3548 
3549 protected:
Create_func_sha2()3550   Create_func_sha2() {}
~Create_func_sha2()3551   virtual ~Create_func_sha2() {}
3552 };
3553 
3554 
3555 class Create_func_sign : public Create_func_arg1
3556 {
3557 public:
3558   virtual Item *create(THD *thd, Item *arg1);
3559 
3560   static Create_func_sign s_singleton;
3561 
3562 protected:
Create_func_sign()3563   Create_func_sign() {}
~Create_func_sign()3564   virtual ~Create_func_sign() {}
3565 };
3566 
3567 
3568 class Create_func_sin : public Create_func_arg1
3569 {
3570 public:
3571   virtual Item *create(THD *thd, Item *arg1);
3572 
3573   static Create_func_sin s_singleton;
3574 
3575 protected:
Create_func_sin()3576   Create_func_sin() {}
~Create_func_sin()3577   virtual ~Create_func_sin() {}
3578 };
3579 
3580 
3581 class Create_func_sleep : public Create_func_arg1
3582 {
3583 public:
3584   virtual Item *create(THD *thd, Item *arg1);
3585 
3586   static Create_func_sleep s_singleton;
3587 
3588 protected:
Create_func_sleep()3589   Create_func_sleep() {}
~Create_func_sleep()3590   virtual ~Create_func_sleep() {}
3591 };
3592 
3593 
3594 class Create_func_soundex : public Create_func_arg1
3595 {
3596 public:
3597   virtual Item *create(THD *thd, Item *arg1);
3598 
3599   static Create_func_soundex s_singleton;
3600 
3601 protected:
Create_func_soundex()3602   Create_func_soundex() {}
~Create_func_soundex()3603   virtual ~Create_func_soundex() {}
3604 };
3605 
3606 
3607 class Create_func_space : public Create_func_arg1
3608 {
3609 public:
3610   virtual Item *create(THD *thd, Item *arg1);
3611 
3612   static Create_func_space s_singleton;
3613 
3614 protected:
Create_func_space()3615   Create_func_space() {}
~Create_func_space()3616   virtual ~Create_func_space() {}
3617 };
3618 
3619 
3620 class Create_func_sqrt : public Create_func_arg1
3621 {
3622 public:
3623   virtual Item *create(THD *thd, Item *arg1);
3624 
3625   static Create_func_sqrt s_singleton;
3626 
3627 protected:
Create_func_sqrt()3628   Create_func_sqrt() {}
~Create_func_sqrt()3629   virtual ~Create_func_sqrt() {}
3630 };
3631 
3632 
3633 class Create_func_simplify : public Create_func_arg2
3634 {
3635 public:
3636   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
3637 
3638   static Create_func_simplify s_singleton;
3639 
3640 protected:
Create_func_simplify()3641   Create_func_simplify() {}
~Create_func_simplify()3642   virtual ~Create_func_simplify() {}
3643 };
3644 
3645 
3646 class Create_func_srid : public Create_func_arg1
3647 {
3648 public:
3649   virtual Item *create(THD *thd, Item *arg1);
3650 
3651   static Create_func_srid s_singleton;
3652 
3653 protected:
Create_func_srid()3654   Create_func_srid() {}
~Create_func_srid()3655   virtual ~Create_func_srid() {}
3656 };
3657 
3658 
3659 class Create_func_srid_deprecated : public Create_func_srid
3660 {
3661 public:
create(THD * thd,Item * arg1)3662   virtual Item *create(THD *thd, Item *arg1)
3663   {
3664     push_deprecated_warn(thd, "SRID", "ST_SRID");
3665     return Create_func_srid::create(thd, arg1);
3666   }
3667 
3668   static Create_func_srid_deprecated s_singleton;
3669 };
3670 Create_func_srid_deprecated Create_func_srid_deprecated::s_singleton;
3671 
3672 
3673 class Create_func_startpoint : public Create_func_arg1
3674 {
3675 public:
3676   virtual Item *create(THD *thd, Item *arg1);
3677 
3678   static Create_func_startpoint s_singleton;
3679 
3680 protected:
Create_func_startpoint()3681   Create_func_startpoint() {}
~Create_func_startpoint()3682   virtual ~Create_func_startpoint() {}
3683 };
3684 
3685 
3686 class Create_func_startpoint_deprecated : public Create_func_startpoint
3687 {
3688 public:
create(THD * thd,Item * arg1)3689   virtual Item *create(THD *thd, Item *arg1)
3690   {
3691     push_deprecated_warn(thd, "STARTPOINT", "ST_STARTPOINT");
3692     return Create_func_startpoint::create(thd, arg1);
3693   }
3694 
3695   static Create_func_startpoint_deprecated s_singleton;
3696 };
3697 Create_func_startpoint_deprecated Create_func_startpoint_deprecated::s_singleton;
3698 
3699 
3700 class Create_func_str_to_date : public Create_func_arg2
3701 {
3702 public:
3703   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
3704 
3705   static Create_func_str_to_date s_singleton;
3706 
3707 protected:
Create_func_str_to_date()3708   Create_func_str_to_date() {}
~Create_func_str_to_date()3709   virtual ~Create_func_str_to_date() {}
3710 };
3711 
3712 
3713 class Create_func_strcmp : public Create_func_arg2
3714 {
3715 public:
3716   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
3717 
3718   static Create_func_strcmp s_singleton;
3719 
3720 protected:
Create_func_strcmp()3721   Create_func_strcmp() {}
~Create_func_strcmp()3722   virtual ~Create_func_strcmp() {}
3723 };
3724 
3725 
3726 class Create_func_substr_index : public Create_func_arg3
3727 {
3728 public:
3729   virtual Item *create(THD *thd, Item *arg1, Item *arg2, Item *arg3);
3730 
3731   static Create_func_substr_index s_singleton;
3732 
3733 protected:
Create_func_substr_index()3734   Create_func_substr_index() {}
~Create_func_substr_index()3735   virtual ~Create_func_substr_index() {}
3736 };
3737 
3738 
3739 class Create_func_subtime : public Create_func_arg2
3740 {
3741 public:
3742   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
3743 
3744   static Create_func_subtime s_singleton;
3745 
3746 protected:
Create_func_subtime()3747   Create_func_subtime() {}
~Create_func_subtime()3748   virtual ~Create_func_subtime() {}
3749 };
3750 
3751 
3752 class Create_func_tan : public Create_func_arg1
3753 {
3754 public:
3755   virtual Item *create(THD *thd, Item *arg1);
3756 
3757   static Create_func_tan s_singleton;
3758 
3759 protected:
Create_func_tan()3760   Create_func_tan() {}
~Create_func_tan()3761   virtual ~Create_func_tan() {}
3762 };
3763 
3764 
3765 class Create_func_time_format : public Create_func_arg2
3766 {
3767 public:
3768   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
3769 
3770   static Create_func_time_format s_singleton;
3771 
3772 protected:
Create_func_time_format()3773   Create_func_time_format() {}
~Create_func_time_format()3774   virtual ~Create_func_time_format() {}
3775 };
3776 
3777 
3778 class Create_func_time_to_sec : public Create_func_arg1
3779 {
3780 public:
3781   virtual Item *create(THD *thd, Item *arg1);
3782 
3783   static Create_func_time_to_sec s_singleton;
3784 
3785 protected:
Create_func_time_to_sec()3786   Create_func_time_to_sec() {}
~Create_func_time_to_sec()3787   virtual ~Create_func_time_to_sec() {}
3788 };
3789 
3790 
3791 class Create_func_timediff : public Create_func_arg2
3792 {
3793 public:
3794   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
3795 
3796   static Create_func_timediff s_singleton;
3797 
3798 protected:
Create_func_timediff()3799   Create_func_timediff() {}
~Create_func_timediff()3800   virtual ~Create_func_timediff() {}
3801 };
3802 
3803 
3804 class Create_func_to_base64 : public Create_func_arg1
3805 {
3806 public:
3807   virtual Item *create(THD *thd, Item *arg1);
3808 
3809   static Create_func_to_base64 s_singleton;
3810 
3811 protected:
Create_func_to_base64()3812   Create_func_to_base64() {}
~Create_func_to_base64()3813   virtual ~Create_func_to_base64() {}
3814 };
3815 
3816 
3817 class Create_func_to_days : public Create_func_arg1
3818 {
3819 public:
3820   virtual Item *create(THD *thd, Item *arg1);
3821 
3822   static Create_func_to_days s_singleton;
3823 
3824 protected:
Create_func_to_days()3825   Create_func_to_days() {}
~Create_func_to_days()3826   virtual ~Create_func_to_days() {}
3827 };
3828 
3829 class Create_func_to_seconds : public Create_func_arg1
3830 {
3831 public:
3832   virtual Item* create(THD *thd, Item *arg1);
3833 
3834   static Create_func_to_seconds s_singleton;
3835 
3836 protected:
Create_func_to_seconds()3837   Create_func_to_seconds() {}
~Create_func_to_seconds()3838   virtual ~Create_func_to_seconds() {}
3839 };
3840 
3841 
3842 class Create_func_touches : public Create_func_arg2
3843 {
3844 public:
3845   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
3846 
3847   static Create_func_touches s_singleton;
3848 
3849 protected:
Create_func_touches()3850   Create_func_touches() {}
~Create_func_touches()3851   virtual ~Create_func_touches() {}
3852 };
3853 
3854 
3855 class Create_func_mbr_touches : public Create_func_arg2
3856 {
3857 public:
3858   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
3859 
3860   static Create_func_mbr_touches s_singleton;
3861 
3862 protected:
Create_func_mbr_touches()3863   Create_func_mbr_touches() {}
~Create_func_mbr_touches()3864   virtual ~Create_func_mbr_touches() {}
3865 };
3866 
3867 
3868 class Create_func_touches_deprecated : public Create_func_touches
3869 {
3870 public:
create(THD * thd,Item * arg1,Item * arg2)3871   virtual Item *create(THD *thd, Item *arg1, Item *arg2)
3872   {
3873     push_deprecated_warn(thd, "TOUCHES", "ST_TOUCHES");
3874     return Create_func_touches::create(thd, arg1, arg2);
3875   }
3876 
3877   static Create_func_touches_deprecated s_singleton;
3878 };
3879 Create_func_touches_deprecated Create_func_touches_deprecated::s_singleton;
3880 
3881 
3882 class Create_func_upper : public Create_func_arg1
3883 {
3884 public:
3885   virtual Item *create(THD *thd, Item *arg1);
3886 
3887   static Create_func_upper s_singleton;
3888 
3889 protected:
Create_func_upper()3890   Create_func_upper() {}
~Create_func_upper()3891   virtual ~Create_func_upper() {}
3892 };
3893 
3894 
3895 class Create_func_uncompress : public Create_func_arg1
3896 {
3897 public:
3898   virtual Item *create(THD *thd, Item *arg1);
3899 
3900   static Create_func_uncompress s_singleton;
3901 
3902 protected:
Create_func_uncompress()3903   Create_func_uncompress() {}
~Create_func_uncompress()3904   virtual ~Create_func_uncompress() {}
3905 };
3906 
3907 
3908 class Create_func_uncompressed_length : public Create_func_arg1
3909 {
3910 public:
3911   virtual Item *create(THD *thd, Item *arg1);
3912 
3913   static Create_func_uncompressed_length s_singleton;
3914 
3915 protected:
Create_func_uncompressed_length()3916   Create_func_uncompressed_length() {}
~Create_func_uncompressed_length()3917   virtual ~Create_func_uncompressed_length() {}
3918 };
3919 
3920 
3921 class Create_func_unhex : public Create_func_arg1
3922 {
3923 public:
3924   virtual Item *create(THD *thd, Item *arg1);
3925 
3926   static Create_func_unhex s_singleton;
3927 
3928 protected:
Create_func_unhex()3929   Create_func_unhex() {}
~Create_func_unhex()3930   virtual ~Create_func_unhex() {}
3931 };
3932 
3933 
3934 class Create_func_unix_timestamp : public Create_native_func
3935 {
3936 public:
3937   virtual Item *create_native(THD *thd, LEX_STRING name,
3938                               PT_item_list *item_list);
3939 
3940   static Create_func_unix_timestamp s_singleton;
3941 
3942 protected:
Create_func_unix_timestamp()3943   Create_func_unix_timestamp() {}
~Create_func_unix_timestamp()3944   virtual ~Create_func_unix_timestamp() {}
3945 };
3946 
3947 
3948 class Create_func_uuid : public Create_func_arg0
3949 {
3950 public:
3951   virtual Item *create(THD *thd);
3952 
3953   static Create_func_uuid s_singleton;
3954 
3955 protected:
Create_func_uuid()3956   Create_func_uuid() {}
~Create_func_uuid()3957   virtual ~Create_func_uuid() {}
3958 };
3959 
3960 
3961 class Create_func_uuid_short : public Create_func_arg0
3962 {
3963 public:
3964   virtual Item *create(THD *thd);
3965 
3966   static Create_func_uuid_short s_singleton;
3967 
3968 protected:
Create_func_uuid_short()3969   Create_func_uuid_short() {}
~Create_func_uuid_short()3970   virtual ~Create_func_uuid_short() {}
3971 };
3972 
3973 
3974 class Create_func_validate_password_strength : public Create_func_arg1
3975 {
3976 public:
3977   virtual Item *create(THD *thd, Item *arg1);
3978 
3979   static Create_func_validate_password_strength s_singleton;
3980 
3981 protected:
Create_func_validate_password_strength()3982   Create_func_validate_password_strength() {}
~Create_func_validate_password_strength()3983   virtual ~Create_func_validate_password_strength() {}
3984 };
3985 
3986 
3987 class Create_func_version : public Create_func_arg0
3988 {
3989 public:
3990   virtual Item *create(THD *thd);
3991 
3992   static Create_func_version s_singleton;
3993 
3994 protected:
Create_func_version()3995   Create_func_version() {}
~Create_func_version()3996   virtual ~Create_func_version() {}
3997 };
3998 
3999 
4000 class Create_func_weekday : public Create_func_arg1
4001 {
4002 public:
4003   virtual Item *create(THD *thd, Item *arg1);
4004 
4005   static Create_func_weekday s_singleton;
4006 
4007 protected:
Create_func_weekday()4008   Create_func_weekday() {}
~Create_func_weekday()4009   virtual ~Create_func_weekday() {}
4010 };
4011 
4012 
4013 class Create_func_weekofyear : public Create_func_arg1
4014 {
4015 public:
4016   virtual Item *create(THD *thd, Item *arg1);
4017 
4018   static Create_func_weekofyear s_singleton;
4019 
4020 protected:
Create_func_weekofyear()4021   Create_func_weekofyear() {}
~Create_func_weekofyear()4022   virtual ~Create_func_weekofyear() {}
4023 };
4024 
4025 
4026 class Create_func_mbr_within : public Create_func_arg2
4027 {
4028 public:
4029   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
4030 
4031   static Create_func_mbr_within s_singleton;
4032 
4033 protected:
Create_func_mbr_within()4034   Create_func_mbr_within() {}
~Create_func_mbr_within()4035   virtual ~Create_func_mbr_within() {}
4036 };
4037 
4038 
4039 class Create_func_within_deprecated : public Create_func_mbr_within
4040 {
4041 public:
create(THD * thd,Item * arg1,Item * arg2)4042   virtual Item *create(THD *thd, Item *arg1, Item *arg2)
4043   {
4044     push_deprecated_warn(thd, "WITHIN", "MBRWITHIN");
4045     return Create_func_mbr_within::create(thd, arg1, arg2);
4046   }
4047 
4048   static Create_func_within_deprecated s_singleton;
4049 };
4050 Create_func_within_deprecated Create_func_within_deprecated::s_singleton;
4051 
4052 
4053 class Create_func_within : public Create_func_arg2
4054 {
4055 public:
4056   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
4057 
4058   static Create_func_within s_singleton;
4059 
4060 protected:
Create_func_within()4061   Create_func_within() {}
~Create_func_within()4062   virtual ~Create_func_within() {}
4063 };
4064 
4065 
4066 class Create_func_x : public Create_func_arg1
4067 {
4068 public:
4069   virtual Item *create(THD *thd, Item *arg1);
4070 
4071   static Create_func_x s_singleton;
4072 
4073 protected:
Create_func_x()4074   Create_func_x() {}
~Create_func_x()4075   virtual ~Create_func_x() {}
4076 };
4077 
4078 
4079 class Create_func_x_deprecated : public Create_func_x
4080 {
4081 public:
create(THD * thd,Item * arg1)4082   virtual Item *create(THD *thd, Item *arg1)
4083   {
4084     push_deprecated_warn(thd, "X", "ST_X");
4085     return Create_func_x::create(thd, arg1);
4086   }
4087 
4088   static Create_func_x_deprecated s_singleton;
4089 };
4090 Create_func_x_deprecated Create_func_x_deprecated::s_singleton;
4091 
4092 
4093 class Create_func_xml_extractvalue : public Create_func_arg2
4094 {
4095 public:
4096   virtual Item *create(THD *thd, Item *arg1, Item *arg2);
4097 
4098   static Create_func_xml_extractvalue s_singleton;
4099 
4100 protected:
Create_func_xml_extractvalue()4101   Create_func_xml_extractvalue() {}
~Create_func_xml_extractvalue()4102   virtual ~Create_func_xml_extractvalue() {}
4103 };
4104 
4105 
4106 class Create_func_xml_update : public Create_func_arg3
4107 {
4108 public:
4109   virtual Item *create(THD *thd, Item *arg1, Item *arg2, Item *arg3);
4110 
4111   static Create_func_xml_update s_singleton;
4112 
4113 protected:
Create_func_xml_update()4114   Create_func_xml_update() {}
~Create_func_xml_update()4115   virtual ~Create_func_xml_update() {}
4116 };
4117 
4118 
4119 class Create_func_y : public Create_func_arg1
4120 {
4121 public:
4122   virtual Item *create(THD *thd, Item *arg1);
4123 
4124   static Create_func_y s_singleton;
4125 
4126 protected:
Create_func_y()4127   Create_func_y() {}
~Create_func_y()4128   virtual ~Create_func_y() {}
4129 };
4130 
4131 
4132 class Create_func_y_deprecated : public Create_func_y
4133 {
4134 public:
create(THD * thd,Item * arg1)4135   virtual Item *create(THD *thd, Item *arg1)
4136   {
4137     push_deprecated_warn(thd, "Y", "ST_Y");
4138     return Create_func_y::create(thd, arg1);
4139   }
4140 
4141   static Create_func_y_deprecated s_singleton;
4142 };
4143 Create_func_y_deprecated Create_func_y_deprecated::s_singleton;
4144 
4145 
4146 class Create_func_year_week : public Create_native_func
4147 {
4148 public:
4149   virtual Item *create_native(THD *thd, LEX_STRING name,
4150                               PT_item_list *item_list);
4151 
4152   static Create_func_year_week s_singleton;
4153 
4154 protected:
Create_func_year_week()4155   Create_func_year_week() {}
~Create_func_year_week()4156   virtual ~Create_func_year_week() {}
4157 };
4158 
4159 
4160 /*
4161 =============================================================================
4162   IMPLEMENTATION
4163 =============================================================================
4164 */
4165 
4166 Item*
create_func(THD * thd,LEX_STRING name,PT_item_list * item_list)4167 Create_qfunc::create_func(THD *thd, LEX_STRING name, PT_item_list *item_list)
4168 {
4169   LEX_STRING db= NULL_STR;
4170   if (thd->lex->copy_db_to(&db.str, &db.length))
4171     return NULL;
4172 
4173   return create(thd, db, name, false, item_list);
4174 }
4175 
4176 
4177 #ifdef HAVE_DLOPEN
4178 Create_udf_func Create_udf_func::s_singleton;
4179 
4180 Item*
create_func(THD * thd,LEX_STRING name,PT_item_list * item_list)4181 Create_udf_func::create_func(THD *thd, LEX_STRING name, PT_item_list *item_list)
4182 {
4183   udf_func *udf= find_udf(name.str, name.length);
4184   assert(udf);
4185   return create(thd, udf, item_list);
4186 }
4187 
4188 
4189 Item*
create(THD * thd,udf_func * udf,PT_item_list * item_list)4190 Create_udf_func::create(THD *thd, udf_func *udf, PT_item_list *item_list)
4191 {
4192   DBUG_ENTER("Create_udf_func::create");
4193 
4194   assert(   (udf->type == UDFTYPE_FUNCTION)
4195             || (udf->type == UDFTYPE_AGGREGATE));
4196 
4197   Item *func= NULL;
4198   POS pos;
4199 
4200   switch(udf->returns) {
4201   case STRING_RESULT:
4202     if (udf->type == UDFTYPE_FUNCTION)
4203       func= new (thd->mem_root) Item_func_udf_str(pos, udf, item_list);
4204     else
4205       func= new (thd->mem_root) Item_sum_udf_str(pos, udf, item_list);
4206     break;
4207   case REAL_RESULT:
4208     if (udf->type == UDFTYPE_FUNCTION)
4209       func= new (thd->mem_root) Item_func_udf_float(pos, udf, item_list);
4210     else
4211       func= new (thd->mem_root) Item_sum_udf_float(pos, udf, item_list);
4212     break;
4213   case INT_RESULT:
4214     if (udf->type == UDFTYPE_FUNCTION)
4215       func= new (thd->mem_root) Item_func_udf_int(pos, udf, item_list);
4216     else
4217       func= new (thd->mem_root) Item_sum_udf_int(pos, udf, item_list);
4218     break;
4219   case DECIMAL_RESULT:
4220     if (udf->type == UDFTYPE_FUNCTION)
4221       func= new (thd->mem_root) Item_func_udf_decimal(pos, udf, item_list);
4222     else
4223       func= new (thd->mem_root) Item_sum_udf_decimal(pos, udf, item_list);
4224     break;
4225   default:
4226     my_error(ER_NOT_SUPPORTED_YET, MYF(0), "UDF return type");
4227   }
4228   DBUG_RETURN(func);
4229 }
4230 #endif /* HAVE_DLOPEN */
4231 
4232 
4233 Create_sp_func Create_sp_func::s_singleton;
4234 
4235 Item*
create(THD * thd,LEX_STRING db,LEX_STRING name,bool use_explicit_name,PT_item_list * item_list)4236 Create_sp_func::create(THD *thd, LEX_STRING db, LEX_STRING name,
4237                        bool use_explicit_name, PT_item_list *item_list)
4238 {
4239 
4240   return new (thd->mem_root) Item_func_sp(POS(), db, name,
4241                                           use_explicit_name, item_list);
4242 }
4243 
4244 
4245 Item*
create_func(THD * thd,LEX_STRING name,PT_item_list * item_list)4246 Create_native_func::create_func(THD *thd, LEX_STRING name,
4247                                 PT_item_list *item_list)
4248 {
4249   return create_native(thd, name, item_list);
4250 }
4251 
4252 
4253 Item*
create_func(THD * thd,LEX_STRING name,PT_item_list * item_list)4254 Create_func_arg0::create_func(THD *thd, LEX_STRING name,
4255                               PT_item_list *item_list)
4256 {
4257   if (item_list != NULL)
4258   {
4259     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
4260     return NULL;
4261   }
4262 
4263   return create(thd);
4264 }
4265 
4266 
4267 Item*
create_func(THD * thd,LEX_STRING name,PT_item_list * item_list)4268 Create_func_arg1::create_func(THD *thd, LEX_STRING name,
4269                               PT_item_list *item_list)
4270 {
4271   int arg_count= 0;
4272 
4273   if (item_list)
4274     arg_count= item_list->elements();
4275 
4276   if (arg_count != 1)
4277   {
4278     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
4279     return NULL;
4280   }
4281 
4282   Item *param_1= item_list->pop_front();
4283   return create(thd, param_1);
4284 }
4285 
4286 
4287 Item*
create_func(THD * thd,LEX_STRING name,PT_item_list * item_list)4288 Create_func_arg2::create_func(THD *thd, LEX_STRING name,
4289                               PT_item_list *item_list)
4290 {
4291   int arg_count= 0;
4292 
4293   if (item_list)
4294     arg_count= item_list->elements();
4295 
4296   if (arg_count != 2)
4297   {
4298     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
4299     return NULL;
4300   }
4301 
4302   Item *param_1= item_list->pop_front();
4303   Item *param_2= item_list->pop_front();
4304   return create(thd, param_1, param_2);
4305 }
4306 
4307 
4308 Item*
create_func(THD * thd,LEX_STRING name,PT_item_list * item_list)4309 Create_func_arg3::create_func(THD *thd, LEX_STRING name,
4310                               PT_item_list *item_list)
4311 {
4312   int arg_count= 0;
4313 
4314   if (item_list)
4315     arg_count= item_list->elements();
4316 
4317   if (arg_count != 3)
4318   {
4319     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
4320     return NULL;
4321   }
4322 
4323   Item *param_1= item_list->pop_front();
4324   Item *param_2= item_list->pop_front();
4325   Item *param_3= item_list->pop_front();
4326   return create(thd, param_1, param_2, param_3);
4327 }
4328 
4329 
4330 Create_func_abs Create_func_abs::s_singleton;
4331 
4332 Item*
create(THD * thd,Item * arg1)4333 Create_func_abs::create(THD *thd, Item *arg1)
4334 {
4335   return new (thd->mem_root) Item_func_abs(POS(), arg1);
4336 }
4337 
4338 
4339 Create_func_acos Create_func_acos::s_singleton;
4340 
4341 Item*
create(THD * thd,Item * arg1)4342 Create_func_acos::create(THD *thd, Item *arg1)
4343 {
4344   return new (thd->mem_root) Item_func_acos(POS(), arg1);
4345 }
4346 
4347 
4348 Create_func_addtime Create_func_addtime::s_singleton;
4349 
4350 Item*
create(THD * thd,Item * arg1,Item * arg2)4351 Create_func_addtime::create(THD *thd, Item *arg1, Item *arg2)
4352 {
4353   return new (thd->mem_root) Item_func_add_time(POS(), arg1, arg2, 0, 0);
4354 }
4355 
4356 
4357 Create_func_aes_encrypt Create_func_aes_encrypt::s_singleton;
4358 
4359 
4360 Create_func_aes_decrypt Create_func_aes_decrypt::s_singleton;
4361 
4362 
4363 Create_func_random_bytes Create_func_random_bytes::s_singleton;
4364 
4365 
4366 Create_func_any_value Create_func_any_value::s_singleton;
4367 
4368 Create_func_area Create_func_area::s_singleton;
4369 
4370 Item*
create(THD * thd,Item * arg1)4371 Create_func_area::create(THD *thd, Item *arg1)
4372 {
4373   return new (thd->mem_root) Item_func_area(POS(), arg1);
4374 }
4375 
4376 
4377 Create_func_as_geojson Create_func_as_geojson::s_singleton;
4378 
4379 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)4380 Create_func_as_geojson::create_native(THD *thd, LEX_STRING name,
4381                                       PT_item_list *item_list)
4382 {
4383   Item* func= NULL;
4384   int arg_count= 0;
4385 
4386   if (item_list != NULL)
4387     arg_count= item_list->elements();
4388 
4389   switch (arg_count)
4390   {
4391   case 1:
4392     {
4393       Item *geometry= item_list->pop_front();
4394       func= new (thd->mem_root) Item_func_as_geojson(thd, POS(), geometry);
4395       break;
4396     }
4397   case 2:
4398     {
4399       Item *geometry= item_list->pop_front();
4400       Item *maxdecimaldigits= item_list->pop_front();
4401       func= new (thd->mem_root) Item_func_as_geojson(thd, POS(), geometry,
4402                                                      maxdecimaldigits);
4403       break;
4404     }
4405   case 3:
4406     {
4407       Item *geometry= item_list->pop_front();
4408       Item *maxdecimaldigits= item_list->pop_front();
4409       Item *options= item_list->pop_front();
4410       func= new (thd->mem_root) Item_func_as_geojson(thd, POS(), geometry,
4411                                                      maxdecimaldigits, options);
4412       break;
4413     }
4414   default:
4415     {
4416       my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
4417       break;
4418     }
4419   }
4420 
4421   return func;
4422 }
4423 
4424 
4425 Create_func_as_wkb Create_func_as_wkb::s_singleton;
4426 
4427 Item*
create(THD * thd,Item * arg1)4428 Create_func_as_wkb::create(THD *thd, Item *arg1)
4429 {
4430   return new (thd->mem_root) Item_func_as_wkb(POS(), arg1);
4431 }
4432 
4433 
4434 Create_func_as_wkt Create_func_as_wkt::s_singleton;
4435 
4436 Item*
create(THD * thd,Item * arg1)4437 Create_func_as_wkt::create(THD *thd, Item *arg1)
4438 {
4439   return new (thd->mem_root) Item_func_as_wkt(POS(), arg1);
4440 }
4441 
4442 
4443 Create_func_asin Create_func_asin::s_singleton;
4444 
4445 Item*
create(THD * thd,Item * arg1)4446 Create_func_asin::create(THD *thd, Item *arg1)
4447 {
4448   return new (thd->mem_root) Item_func_asin(POS(), arg1);
4449 }
4450 
4451 
4452 Create_func_atan Create_func_atan::s_singleton;
4453 
4454 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)4455 Create_func_atan::create_native(THD *thd, LEX_STRING name,
4456                                 PT_item_list *item_list)
4457 {
4458   Item* func= NULL;
4459   int arg_count= 0;
4460 
4461   if (item_list != NULL)
4462     arg_count= item_list->elements();
4463 
4464   switch (arg_count) {
4465   case 1:
4466   {
4467     Item *param_1= item_list->pop_front();
4468     func= new (thd->mem_root) Item_func_atan(POS(), param_1);
4469     break;
4470   }
4471   case 2:
4472   {
4473     Item *param_1= item_list->pop_front();
4474     Item *param_2= item_list->pop_front();
4475     func= new (thd->mem_root) Item_func_atan(POS(), param_1, param_2);
4476     break;
4477   }
4478   default:
4479   {
4480     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
4481     break;
4482   }
4483   }
4484 
4485   return func;
4486 }
4487 
4488 
4489 Create_func_benchmark Create_func_benchmark::s_singleton;
4490 
4491 Item*
create(THD * thd,Item * arg1,Item * arg2)4492 Create_func_benchmark::create(THD *thd, Item *arg1, Item *arg2)
4493 {
4494   return new (thd->mem_root) Item_func_benchmark(POS(), arg1, arg2);
4495 }
4496 
4497 
4498 Create_func_bin Create_func_bin::s_singleton;
4499 
4500 Item*
create(THD * thd,Item * arg1)4501 Create_func_bin::create(THD *thd, Item *arg1)
4502 {
4503   POS pos;
4504   Item *i10= new (thd->mem_root) Item_int(pos, 10, 2);
4505   Item *i2= new (thd->mem_root) Item_int(pos, 2, 1);
4506   return new (thd->mem_root) Item_func_conv(pos, arg1, i10, i2);
4507 }
4508 
4509 
4510 Create_func_bit_count Create_func_bit_count::s_singleton;
4511 
4512 Item*
create(THD * thd,Item * arg1)4513 Create_func_bit_count::create(THD *thd, Item *arg1)
4514 {
4515   return new (thd->mem_root) Item_func_bit_count(POS(), arg1);
4516 }
4517 
4518 
4519 Create_func_bit_length Create_func_bit_length::s_singleton;
4520 
4521 Item*
create(THD * thd,Item * arg1)4522 Create_func_bit_length::create(THD *thd, Item *arg1)
4523 {
4524   return new (thd->mem_root) Item_func_bit_length(POS(), arg1);
4525 }
4526 
4527 
4528 Create_func_buffer_strategy Create_func_buffer_strategy::s_singleton;
4529 
4530 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)4531 Create_func_buffer_strategy::create_native(THD *thd, LEX_STRING name,
4532                                            PT_item_list *item_list)
4533 {
4534   int arg_count= 0;
4535 
4536   if (item_list != NULL)
4537     arg_count= item_list->elements();
4538 
4539   if (arg_count < 1 || arg_count > 2)
4540   {
4541     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
4542     return NULL;
4543   }
4544 
4545   return new (thd->mem_root) Item_func_buffer_strategy(POS(), item_list);
4546 }
4547 
4548 
4549 Create_func_ceiling Create_func_ceiling::s_singleton;
4550 
4551 Item*
create(THD * thd,Item * arg1)4552 Create_func_ceiling::create(THD *thd, Item *arg1)
4553 {
4554   return new (thd->mem_root) Item_func_ceiling(POS(), arg1);
4555 }
4556 
4557 
4558 Create_func_centroid Create_func_centroid::s_singleton;
4559 
4560 Item*
create(THD * thd,Item * arg1)4561 Create_func_centroid::create(THD *thd, Item *arg1)
4562 {
4563   return new (thd->mem_root) Item_func_centroid(POS(), arg1);
4564 }
4565 
4566 
4567 Create_func_convex_hull Create_func_convex_hull::s_singleton;
4568 
4569 Item*
create(THD * thd,Item * arg1)4570 Create_func_convex_hull::create(THD *thd, Item *arg1)
4571 {
4572   return new (thd->mem_root) Item_func_convex_hull(POS(), arg1);
4573 }
4574 
4575 Create_func_char_length Create_func_char_length::s_singleton;
4576 
4577 Item*
create(THD * thd,Item * arg1)4578 Create_func_char_length::create(THD *thd, Item *arg1)
4579 {
4580   return new (thd->mem_root) Item_func_char_length(POS(), arg1);
4581 }
4582 
4583 
4584 Create_func_coercibility Create_func_coercibility::s_singleton;
4585 
4586 Item*
create(THD * thd,Item * arg1)4587 Create_func_coercibility::create(THD *thd, Item *arg1)
4588 {
4589   return new (thd->mem_root) Item_func_coercibility(POS(), arg1);
4590 }
4591 
4592 
4593 Create_func_concat Create_func_concat::s_singleton;
4594 
4595 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)4596 Create_func_concat::create_native(THD *thd, LEX_STRING name,
4597                                   PT_item_list *item_list)
4598 {
4599   int arg_count= 0;
4600 
4601   if (item_list != NULL)
4602     arg_count= item_list->elements();
4603 
4604   if (arg_count < 1)
4605   {
4606     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
4607     return NULL;
4608   }
4609 
4610   return new (thd->mem_root) Item_func_concat(POS(), item_list);
4611 }
4612 
4613 
4614 Create_func_concat_ws Create_func_concat_ws::s_singleton;
4615 
4616 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)4617 Create_func_concat_ws::create_native(THD *thd, LEX_STRING name,
4618                                      PT_item_list *item_list)
4619 {
4620   int arg_count= 0;
4621 
4622   if (item_list != NULL)
4623     arg_count= item_list->elements();
4624 
4625   /* "WS" stands for "With Separator": this function takes 2+ arguments */
4626   if (arg_count < 2)
4627   {
4628     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
4629     return NULL;
4630   }
4631 
4632   return new (thd->mem_root) Item_func_concat_ws(POS(), item_list);
4633 }
4634 
4635 
4636 Create_func_compress Create_func_compress::s_singleton;
4637 
4638 Item*
create(THD * thd,Item * arg1)4639 Create_func_compress::create(THD *thd, Item *arg1)
4640 {
4641   return new (thd->mem_root) Item_func_compress(POS(), arg1);
4642 }
4643 
4644 
4645 Create_func_connection_id Create_func_connection_id::s_singleton;
4646 
4647 Item*
create(THD * thd)4648 Create_func_connection_id::create(THD *thd)
4649 {
4650   return new (thd->mem_root) Item_func_connection_id(POS());
4651 }
4652 
4653 
4654 Create_func_mbr_covered_by Create_func_mbr_covered_by::s_singleton;
4655 
4656 Item*
create(THD * thd,Item * arg1,Item * arg2)4657 Create_func_mbr_covered_by::create(THD *thd, Item *arg1, Item *arg2)
4658 {
4659   return new (thd->mem_root)
4660     Item_func_spatial_mbr_rel(POS(), arg1, arg2, Item_func::SP_COVEREDBY_FUNC);
4661 }
4662 
4663 
4664 Create_func_mbr_covers Create_func_mbr_covers::s_singleton;
4665 
4666 Item*
create(THD * thd,Item * arg1,Item * arg2)4667 Create_func_mbr_covers::create(THD *thd, Item *arg1, Item *arg2)
4668 {
4669   return new (thd->mem_root)
4670     Item_func_spatial_mbr_rel(POS(), arg1, arg2, Item_func::SP_COVERS_FUNC);
4671 }
4672 
4673 
4674 Create_func_mbr_contains Create_func_mbr_contains::s_singleton;
4675 
4676 Item*
create(THD * thd,Item * arg1,Item * arg2)4677 Create_func_mbr_contains::create(THD *thd, Item *arg1, Item *arg2)
4678 {
4679   return new (thd->mem_root) Item_func_spatial_mbr_rel(POS(), arg1, arg2,
4680                                Item_func::SP_CONTAINS_FUNC);
4681 }
4682 
4683 
4684 Create_func_contains Create_func_contains::s_singleton;
4685 
4686 Item*
create(THD * thd,Item * arg1,Item * arg2)4687 Create_func_contains::create(THD *thd, Item *arg1, Item *arg2)
4688 {
4689   return new (thd->mem_root) Item_func_spatial_rel(POS(), arg1, arg2,
4690                                                    Item_func::SP_CONTAINS_FUNC);
4691 }
4692 
4693 
4694 Create_func_conv Create_func_conv::s_singleton;
4695 
4696 Item*
create(THD * thd,Item * arg1,Item * arg2,Item * arg3)4697 Create_func_conv::create(THD *thd, Item *arg1, Item *arg2, Item *arg3)
4698 {
4699   return new (thd->mem_root) Item_func_conv(POS(), arg1, arg2, arg3);
4700 }
4701 
4702 
4703 Create_func_convert_tz Create_func_convert_tz::s_singleton;
4704 
4705 Item*
create(THD * thd,Item * arg1,Item * arg2,Item * arg3)4706 Create_func_convert_tz::create(THD *thd, Item *arg1, Item *arg2, Item *arg3)
4707 {
4708   return new (thd->mem_root) Item_func_convert_tz(POS(), arg1, arg2, arg3);
4709 }
4710 
4711 
4712 Create_func_cos Create_func_cos::s_singleton;
4713 
4714 Item*
create(THD * thd,Item * arg1)4715 Create_func_cos::create(THD *thd, Item *arg1)
4716 {
4717   return new (thd->mem_root) Item_func_cos(POS(), arg1);
4718 }
4719 
4720 
4721 Create_func_cot Create_func_cot::s_singleton;
4722 
4723 Item*
create(THD * thd,Item * arg1)4724 Create_func_cot::create(THD *thd, Item *arg1)
4725 {
4726   return new (thd->mem_root) Item_func_cot(POS(), arg1);
4727 }
4728 
4729 
4730 Create_func_crc32 Create_func_crc32::s_singleton;
4731 
4732 Item*
create(THD * thd,Item * arg1)4733 Create_func_crc32::create(THD *thd, Item *arg1)
4734 {
4735   return new (thd->mem_root) Item_func_crc32(POS(), arg1);
4736 }
4737 
4738 
4739 Create_func_crosses Create_func_crosses::s_singleton;
4740 
4741 Item*
create(THD * thd,Item * arg1,Item * arg2)4742 Create_func_crosses::create(THD *thd, Item *arg1, Item *arg2)
4743 {
4744   return new (thd->mem_root) Item_func_spatial_rel(POS(), arg1, arg2,
4745                                                    Item_func::SP_CROSSES_FUNC);
4746 }
4747 
4748 
4749 Create_func_date_format Create_func_date_format::s_singleton;
4750 
4751 Item*
create(THD * thd,Item * arg1,Item * arg2)4752 Create_func_date_format::create(THD *thd, Item *arg1, Item *arg2)
4753 {
4754   return new (thd->mem_root) Item_func_date_format(POS(), arg1, arg2, 0);
4755 }
4756 
4757 
4758 Create_func_datediff Create_func_datediff::s_singleton;
4759 
4760 Item*
create(THD * thd,Item * arg1,Item * arg2)4761 Create_func_datediff::create(THD *thd, Item *arg1, Item *arg2)
4762 {
4763   Item *i1= new (thd->mem_root) Item_func_to_days(POS(), arg1);
4764   Item *i2= new (thd->mem_root) Item_func_to_days(POS(), arg2);
4765 
4766   return new (thd->mem_root) Item_func_minus(POS(), i1, i2);
4767 }
4768 
4769 
4770 Create_func_dayname Create_func_dayname::s_singleton;
4771 
4772 Item*
create(THD * thd,Item * arg1)4773 Create_func_dayname::create(THD *thd, Item *arg1)
4774 {
4775   return new (thd->mem_root) Item_func_dayname(POS(), arg1);
4776 }
4777 
4778 
4779 Create_func_dayofmonth Create_func_dayofmonth::s_singleton;
4780 
4781 Item*
create(THD * thd,Item * arg1)4782 Create_func_dayofmonth::create(THD *thd, Item *arg1)
4783 {
4784   return new (thd->mem_root) Item_func_dayofmonth(POS(), arg1);
4785 }
4786 
4787 
4788 Create_func_dayofweek Create_func_dayofweek::s_singleton;
4789 
4790 Item*
create(THD * thd,Item * arg1)4791 Create_func_dayofweek::create(THD *thd, Item *arg1)
4792 {
4793   return new (thd->mem_root) Item_func_weekday(POS(), arg1, 1);
4794 }
4795 
4796 
4797 Create_func_dayofyear Create_func_dayofyear::s_singleton;
4798 
4799 Item*
create(THD * thd,Item * arg1)4800 Create_func_dayofyear::create(THD *thd, Item *arg1)
4801 {
4802   return new (thd->mem_root) Item_func_dayofyear(POS(), arg1);
4803 }
4804 
4805 
4806 Create_func_decode Create_func_decode::s_singleton;
4807 
4808 Item*
create(THD * thd,Item * arg1,Item * arg2)4809 Create_func_decode::create(THD *thd, Item *arg1, Item *arg2)
4810 {
4811   return new (thd->mem_root) Item_func_decode(POS(), arg1, arg2);
4812 }
4813 
4814 
4815 Create_func_degrees Create_func_degrees::s_singleton;
4816 
4817 Item*
create(THD * thd,Item * arg1)4818 Create_func_degrees::create(THD *thd, Item *arg1)
4819 {
4820   return new (thd->mem_root) Item_func_units(POS(), (char*) "degrees", arg1,
4821                                              180/M_PI, 0.0);
4822 }
4823 
4824 
4825 Create_func_des_decrypt Create_func_des_decrypt::s_singleton;
4826 
4827 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)4828 Create_func_des_decrypt::create_native(THD *thd, LEX_STRING name,
4829                                        PT_item_list *item_list)
4830 {
4831   Item *func= NULL;
4832   int arg_count= 0;
4833 
4834   if (item_list != NULL)
4835     arg_count= item_list->elements();
4836 
4837   switch (arg_count) {
4838   case 1:
4839   {
4840     Item *param_1= item_list->pop_front();
4841     func= new (thd->mem_root) Item_func_des_decrypt(POS(), param_1);
4842     break;
4843   }
4844   case 2:
4845   {
4846     Item *param_1= item_list->pop_front();
4847     Item *param_2= item_list->pop_front();
4848     func= new (thd->mem_root) Item_func_des_decrypt(POS(), param_1, param_2);
4849     break;
4850   }
4851   default:
4852   {
4853     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
4854     break;
4855   }
4856   }
4857 
4858   if (!thd->is_error())
4859     push_deprecated_warn(thd, "DES_DECRYPT", "AES_DECRYPT");
4860 
4861   return func;
4862 }
4863 
4864 
4865 Create_func_des_encrypt Create_func_des_encrypt::s_singleton;
4866 
4867 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)4868 Create_func_des_encrypt::create_native(THD *thd, LEX_STRING name,
4869                                        PT_item_list *item_list)
4870 {
4871   Item *func= NULL;
4872   int arg_count= 0;
4873 
4874   if (item_list != NULL)
4875     arg_count= item_list->elements();
4876 
4877   switch (arg_count) {
4878   case 1:
4879   {
4880     Item *param_1= item_list->pop_front();
4881     func= new (thd->mem_root) Item_func_des_encrypt(POS(), param_1);
4882     break;
4883   }
4884   case 2:
4885   {
4886     Item *param_1= item_list->pop_front();
4887     Item *param_2= item_list->pop_front();
4888     func= new (thd->mem_root) Item_func_des_encrypt(POS(), param_1, param_2);
4889     break;
4890   }
4891   default:
4892   {
4893     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
4894     break;
4895   }
4896   }
4897 
4898   if (!thd->is_error())
4899     push_deprecated_warn(thd, "DES_ENCRYPT", "AES_ENCRYPT");
4900 
4901   return func;
4902 }
4903 
4904 
4905 Create_func_dimension Create_func_dimension::s_singleton;
4906 
4907 Item*
create(THD * thd,Item * arg1)4908 Create_func_dimension::create(THD *thd, Item *arg1)
4909 {
4910   return new (thd->mem_root) Item_func_dimension(POS(), arg1);
4911 }
4912 
4913 
4914 Create_func_mbr_disjoint Create_func_mbr_disjoint::s_singleton;
4915 
4916 Item*
create(THD * thd,Item * arg1,Item * arg2)4917 Create_func_mbr_disjoint::create(THD *thd, Item *arg1, Item *arg2)
4918 {
4919   return new (thd->mem_root) Item_func_spatial_mbr_rel(POS(), arg1, arg2,
4920                                Item_func::SP_DISJOINT_FUNC);
4921 }
4922 
4923 
4924 class Create_func_disjoint_deprecated : public Create_func_mbr_disjoint
4925 {
4926 public:
create(THD * thd,Item * arg1,Item * arg2)4927   virtual Item *create(THD *thd, Item *arg1, Item *arg2)
4928   {
4929     push_deprecated_warn(thd, "DISJOINT", "MBRDISJOINT");
4930     return Create_func_mbr_disjoint::create(thd, arg1, arg2);
4931   }
4932 
4933   static Create_func_disjoint_deprecated s_singleton;
4934 };
4935 Create_func_disjoint_deprecated Create_func_disjoint_deprecated::s_singleton;
4936 
4937 
4938 Create_func_disjoint Create_func_disjoint::s_singleton;
4939 
4940 Item*
create(THD * thd,Item * arg1,Item * arg2)4941 Create_func_disjoint::create(THD *thd, Item *arg1, Item *arg2)
4942 {
4943   return new (thd->mem_root) Item_func_spatial_rel(POS(), arg1, arg2,
4944                                                    Item_func::SP_DISJOINT_FUNC);
4945 }
4946 
4947 
4948 Create_func_distance Create_func_distance::s_singleton;
4949 
4950 Item *
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)4951 Create_func_distance::create_native(THD *thd, LEX_STRING name,
4952                                     PT_item_list *item_list)
4953 {
4954   int arg_count= 0;
4955 
4956   if (item_list != NULL)
4957     arg_count= item_list->elements();
4958   if (arg_count != 2)
4959   {
4960     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
4961     return NULL;
4962   }
4963   return new (thd->mem_root) Item_func_distance(POS(), item_list, false);
4964 }
4965 
4966 
4967 Create_func_distance_sphere Create_func_distance_sphere::s_singleton;
4968 
4969 Item *
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)4970 Create_func_distance_sphere::create_native(THD *thd, LEX_STRING name,
4971                                            PT_item_list *item_list)
4972 {
4973   int arg_count= 0;
4974 
4975   if (item_list != NULL)
4976     arg_count= item_list->elements();
4977   if (arg_count < 2 || arg_count > 3)
4978   {
4979     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
4980     return NULL;
4981   }
4982   return new (thd->mem_root) Item_func_distance(POS(), item_list, true);
4983 }
4984 
4985 
4986 Create_func_elt Create_func_elt::s_singleton;
4987 
4988 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)4989 Create_func_elt::create_native(THD *thd, LEX_STRING name,
4990                                PT_item_list *item_list)
4991 {
4992   int arg_count= 0;
4993 
4994   if (item_list != NULL)
4995     arg_count= item_list->elements();
4996 
4997   if (arg_count < 2)
4998   {
4999     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
5000     return NULL;
5001   }
5002 
5003   return new (thd->mem_root) Item_func_elt(POS(), item_list);
5004 }
5005 
5006 
5007 Create_func_encode Create_func_encode::s_singleton;
5008 
5009 Item*
create(THD * thd,Item * arg1,Item * arg2)5010 Create_func_encode::create(THD *thd, Item *arg1, Item *arg2)
5011 {
5012   return new (thd->mem_root) Item_func_encode(POS(), arg1, arg2);
5013 }
5014 
5015 
5016 Create_func_encrypt Create_func_encrypt::s_singleton;
5017 
5018 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)5019 Create_func_encrypt::create_native(THD *thd, LEX_STRING name,
5020                                    PT_item_list *item_list)
5021 {
5022   Item *func= NULL;
5023   int arg_count= 0;
5024 
5025   if (item_list != NULL)
5026     arg_count= item_list->elements();
5027 
5028   switch (arg_count) {
5029   case 1:
5030   {
5031     Item *param_1= item_list->pop_front();
5032     func= new (thd->mem_root) Item_func_encrypt(POS(), param_1);
5033     break;
5034   }
5035   case 2:
5036   {
5037     Item *param_1= item_list->pop_front();
5038     Item *param_2= item_list->pop_front();
5039     func= new (thd->mem_root) Item_func_encrypt(POS(), param_1, param_2);
5040     break;
5041   }
5042   default:
5043   {
5044     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
5045     break;
5046   }
5047   }
5048 
5049   if (!thd->is_error())
5050     push_deprecated_warn(thd, "ENCRYPT", "AES_ENCRYPT");
5051 
5052   return func;
5053 }
5054 
5055 
5056 Create_func_endpoint Create_func_endpoint::s_singleton;
5057 
5058 Item*
create(THD * thd,Item * arg1)5059 Create_func_endpoint::create(THD *thd, Item *arg1)
5060 {
5061   return new (thd->mem_root) Item_func_spatial_decomp(POS(), arg1,
5062                                                       Item_func::SP_ENDPOINT);
5063 }
5064 
5065 
5066 Create_func_envelope Create_func_envelope::s_singleton;
5067 
5068 Item*
create(THD * thd,Item * arg1)5069 Create_func_envelope::create(THD *thd, Item *arg1)
5070 {
5071   return new (thd->mem_root) Item_func_envelope(POS(), arg1);
5072 }
5073 
5074 
5075 Create_func_mbr_equals Create_func_mbr_equals::s_singleton;
5076 
5077 Item*
create(THD * thd,Item * arg1,Item * arg2)5078 Create_func_mbr_equals::create(THD *thd, Item *arg1, Item *arg2)
5079 {
5080   return new (thd->mem_root) Item_func_spatial_mbr_rel(POS(), arg1, arg2,
5081                                Item_func::SP_EQUALS_FUNC);
5082 }
5083 
5084 
5085 Create_func_equals Create_func_equals::s_singleton;
5086 
5087 Item*
create(THD * thd,Item * arg1,Item * arg2)5088 Create_func_equals::create(THD *thd, Item *arg1, Item *arg2)
5089 {
5090   return new (thd->mem_root) Item_func_spatial_rel(POS(), arg1, arg2,
5091                                Item_func::SP_EQUALS_FUNC);
5092 }
5093 
5094 
5095 Create_func_exp Create_func_exp::s_singleton;
5096 
5097 Item*
create(THD * thd,Item * arg1)5098 Create_func_exp::create(THD *thd, Item *arg1)
5099 {
5100   return new (thd->mem_root) Item_func_exp(POS(), arg1);
5101 }
5102 
5103 
5104 Create_func_export_set Create_func_export_set::s_singleton;
5105 
5106 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)5107 Create_func_export_set::create_native(THD *thd, LEX_STRING name,
5108                                       PT_item_list *item_list)
5109 {
5110   Item *func= NULL;
5111   int arg_count= 0;
5112 
5113   if (item_list != NULL)
5114     arg_count= item_list->elements();
5115 
5116   POS pos;
5117   switch (arg_count) {
5118   case 3:
5119   {
5120     Item *param_1= item_list->pop_front();
5121     Item *param_2= item_list->pop_front();
5122     Item *param_3= item_list->pop_front();
5123     func= new (thd->mem_root) Item_func_export_set(pos, param_1, param_2,
5124                                                    param_3);
5125     break;
5126   }
5127   case 4:
5128   {
5129     Item *param_1= item_list->pop_front();
5130     Item *param_2= item_list->pop_front();
5131     Item *param_3= item_list->pop_front();
5132     Item *param_4= item_list->pop_front();
5133     func= new (thd->mem_root) Item_func_export_set(pos, param_1, param_2,
5134                                                    param_3, param_4);
5135     break;
5136   }
5137   case 5:
5138   {
5139     Item *param_1= item_list->pop_front();
5140     Item *param_2= item_list->pop_front();
5141     Item *param_3= item_list->pop_front();
5142     Item *param_4= item_list->pop_front();
5143     Item *param_5= item_list->pop_front();
5144     func= new (thd->mem_root) Item_func_export_set(pos, param_1,
5145                                                    param_2, param_3,
5146                                                    param_4, param_5);
5147     break;
5148   }
5149   default:
5150   {
5151     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
5152     break;
5153   }
5154   }
5155 
5156   return func;
5157 }
5158 
5159 
5160 Create_func_exteriorring Create_func_exteriorring::s_singleton;
5161 
5162 Item*
create(THD * thd,Item * arg1)5163 Create_func_exteriorring::create(THD *thd, Item *arg1)
5164 {
5165   return new (thd->mem_root) Item_func_spatial_decomp(POS(), arg1,
5166                                                       Item_func::SP_EXTERIORRING);
5167 }
5168 
5169 
5170 Create_func_field Create_func_field::s_singleton;
5171 
5172 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)5173 Create_func_field::create_native(THD *thd, LEX_STRING name,
5174                                  PT_item_list *item_list)
5175 {
5176   int arg_count= 0;
5177 
5178   if (item_list != NULL)
5179     arg_count= item_list->elements();
5180 
5181   if (arg_count < 2)
5182   {
5183     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
5184     return NULL;
5185   }
5186 
5187   return new (thd->mem_root) Item_func_field(POS(), item_list);
5188 }
5189 
5190 
5191 Create_func_find_in_set Create_func_find_in_set::s_singleton;
5192 
5193 Item*
create(THD * thd,Item * arg1,Item * arg2)5194 Create_func_find_in_set::create(THD *thd, Item *arg1, Item *arg2)
5195 {
5196   return new (thd->mem_root) Item_func_find_in_set(POS(), arg1, arg2);
5197 }
5198 
5199 
5200 Create_func_floor Create_func_floor::s_singleton;
5201 
5202 Item*
create(THD * thd,Item * arg1)5203 Create_func_floor::create(THD *thd, Item *arg1)
5204 {
5205   return new (thd->mem_root) Item_func_floor(POS(), arg1);
5206 }
5207 
5208 
5209 Create_func_found_rows Create_func_found_rows::s_singleton;
5210 
5211 Item*
create(THD * thd)5212 Create_func_found_rows::create(THD *thd)
5213 {
5214   return new (thd->mem_root) Item_func_found_rows(POS());
5215 }
5216 
5217 
5218 Create_func_from_base64 Create_func_from_base64::s_singleton;
5219 
5220 Item*
create(THD * thd,Item * arg1)5221 Create_func_from_base64::create(THD *thd, Item *arg1)
5222 {
5223   return new (thd->mem_root) Item_func_from_base64(POS(), arg1);
5224 }
5225 
5226 
5227 Create_func_from_days Create_func_from_days::s_singleton;
5228 
5229 Item*
create(THD * thd,Item * arg1)5230 Create_func_from_days::create(THD *thd, Item *arg1)
5231 {
5232   return new (thd->mem_root) Item_func_from_days(POS(), arg1);
5233 }
5234 
5235 
5236 Create_func_from_unixtime Create_func_from_unixtime::s_singleton;
5237 
5238 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)5239 Create_func_from_unixtime::create_native(THD *thd, LEX_STRING name,
5240                                          PT_item_list *item_list)
5241 {
5242   Item *func= NULL;
5243   int arg_count= 0;
5244 
5245   if (item_list != NULL)
5246     arg_count= item_list->elements();
5247 
5248   switch (arg_count) {
5249   case 1:
5250   {
5251     Item *param_1= item_list->pop_front();
5252     func= new (thd->mem_root) Item_func_from_unixtime(POS(), param_1);
5253     break;
5254   }
5255   case 2:
5256   {
5257     Item *param_1= item_list->pop_front();
5258     Item *param_2= item_list->pop_front();
5259     Item *ut= new (thd->mem_root) Item_func_from_unixtime(POS(), param_1);
5260     func= new (thd->mem_root) Item_func_date_format(POS(), ut, param_2, 0);
5261     break;
5262   }
5263   default:
5264   {
5265     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
5266     break;
5267   }
5268   }
5269 
5270   return func;
5271 }
5272 
5273 
5274 Create_func_geohash Create_func_geohash::s_singleton;
5275 
5276 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)5277 Create_func_geohash::create_native(THD *thd, LEX_STRING name,
5278 PT_item_list *item_list)
5279 {
5280   Item *func= NULL;
5281   int arg_count= 0;
5282 
5283   if (item_list != NULL)
5284     arg_count= item_list->elements();
5285 
5286   switch (arg_count)
5287   {
5288   case 2:
5289     {
5290       Item *param_1= item_list->pop_front();
5291       Item *param_2= item_list->pop_front();
5292       func= new (thd->mem_root) Item_func_geohash(POS(), param_1, param_2);
5293       break;
5294     }
5295   case 3:
5296     {
5297       Item *param_1= item_list->pop_front();
5298       Item *param_2= item_list->pop_front();
5299       Item *param_3= item_list->pop_front();
5300       func= new (thd->mem_root) Item_func_geohash(POS(), param_1, param_2,
5301                                                   param_3);
5302       break;
5303     }
5304   default:
5305     {
5306       my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
5307       break;
5308     }
5309   }
5310 
5311   return func;
5312 }
5313 
5314 
5315 Create_func_geometry_from_text Create_func_geometry_from_text::s_singleton;
5316 
5317 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)5318 Create_func_geometry_from_text::create_native(THD *thd, LEX_STRING name,
5319                                               PT_item_list *item_list)
5320 {
5321   Item *func= NULL;
5322   int arg_count= 0;
5323 
5324   if (item_list != NULL)
5325     arg_count= item_list->elements();
5326 
5327   POS pos;
5328   switch (arg_count) {
5329   case 1:
5330   {
5331     Item *param_1= item_list->pop_front();
5332     func= new (thd->mem_root) Item_func_geometry_from_text(pos, param_1);
5333     break;
5334   }
5335   case 2:
5336   {
5337     Item *param_1= item_list->pop_front();
5338     Item *param_2= item_list->pop_front();
5339     func= new (thd->mem_root) Item_func_geometry_from_text(pos, param_1, param_2);
5340     break;
5341   }
5342   default:
5343   {
5344     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
5345     break;
5346   }
5347   }
5348 
5349   return func;
5350 }
5351 
5352 
5353 Create_func_geometry_from_wkb Create_func_geometry_from_wkb::s_singleton;
5354 
5355 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)5356 Create_func_geometry_from_wkb::create_native(THD *thd, LEX_STRING name,
5357                                              PT_item_list *item_list)
5358 {
5359   Item *func= NULL;
5360   int arg_count= 0;
5361 
5362   if (item_list != NULL)
5363     arg_count= item_list->elements();
5364 
5365   POS pos;
5366   switch (arg_count) {
5367   case 1:
5368   {
5369     Item *param_1= item_list->pop_front();
5370     func= new (thd->mem_root) Item_func_geometry_from_wkb(pos, param_1);
5371     break;
5372   }
5373   case 2:
5374   {
5375     Item *param_1= item_list->pop_front();
5376     Item *param_2= item_list->pop_front();
5377     func= new (thd->mem_root) Item_func_geometry_from_wkb(pos, param_1, param_2);
5378     break;
5379   }
5380   default:
5381   {
5382     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
5383     break;
5384   }
5385   }
5386 
5387   return func;
5388 }
5389 
5390 
5391 Create_func_geometry_type Create_func_geometry_type::s_singleton;
5392 
5393 Item*
create(THD * thd,Item * arg1)5394 Create_func_geometry_type::create(THD *thd, Item *arg1)
5395 {
5396   return new (thd->mem_root) Item_func_geometry_type(POS(), arg1);
5397 }
5398 
5399 
5400 Create_func_geometryn Create_func_geometryn::s_singleton;
5401 
5402 Item*
create(THD * thd,Item * arg1,Item * arg2)5403 Create_func_geometryn::create(THD *thd, Item *arg1, Item *arg2)
5404 {
5405   return new (thd->mem_root) Item_func_spatial_decomp_n(POS(), arg1, arg2,
5406                                                         Item_func::SP_GEOMETRYN);
5407 }
5408 
5409 
5410 Create_func_geomfromgeojson Create_func_geomfromgeojson::s_singleton;
5411 
5412 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)5413 Create_func_geomfromgeojson::create_native(THD *thd, LEX_STRING name,
5414                                            PT_item_list *item_list)
5415 {
5416   Item *func= NULL;
5417   int arg_count= 0;
5418 
5419   if (item_list != NULL)
5420     arg_count= item_list->elements();
5421 
5422   POS pos;
5423   switch (arg_count)
5424   {
5425   case 1:
5426     {
5427       Item *geojson_str= item_list->pop_front();
5428       func= new (thd->mem_root) Item_func_geomfromgeojson(pos, geojson_str);
5429       break;
5430     }
5431   case 2:
5432     {
5433       Item *geojson_str= item_list->pop_front();
5434       Item *options= item_list->pop_front();
5435       func= new (thd->mem_root) Item_func_geomfromgeojson(pos, geojson_str,
5436                                                           options);
5437       break;
5438     }
5439   case 3:
5440     {
5441       Item *geojson_str= item_list->pop_front();
5442       Item *options= item_list->pop_front();
5443       Item *srid= item_list->pop_front();
5444       func= new (thd->mem_root) Item_func_geomfromgeojson(pos, geojson_str,
5445                                                           options, srid);
5446       break;
5447     }
5448   default:
5449     {
5450       my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
5451       break;
5452     }
5453   }
5454 
5455   return func;
5456 }
5457 
5458 
5459 Create_func_get_lock Create_func_get_lock::s_singleton;
5460 
5461 Item*
create(THD * thd,Item * arg1,Item * arg2)5462 Create_func_get_lock::create(THD *thd, Item *arg1, Item *arg2)
5463 {
5464   return new (thd->mem_root) Item_func_get_lock(POS(), arg1, arg2);
5465 }
5466 
5467 
5468 Create_func_glength Create_func_glength::s_singleton;
5469 
5470 Item*
create(THD * thd,Item * arg1)5471 Create_func_glength::create(THD *thd, Item *arg1)
5472 {
5473   return new (thd->mem_root) Item_func_glength(POS(), arg1);
5474 }
5475 
5476 
5477 Create_func_greatest Create_func_greatest::s_singleton;
5478 
5479 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)5480 Create_func_greatest::create_native(THD *thd, LEX_STRING name,
5481                                     PT_item_list *item_list)
5482 {
5483   int arg_count= 0;
5484 
5485   if (item_list != NULL)
5486     arg_count= item_list->elements();
5487 
5488   if (arg_count < 2)
5489   {
5490     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
5491     return NULL;
5492   }
5493 
5494   return new (thd->mem_root) Item_func_max(POS(), item_list);
5495 }
5496 
5497 
5498 Create_func_gtid_subtract Create_func_gtid_subtract::s_singleton;
5499 
5500 Item*
create(THD * thd,Item * arg1,Item * arg2)5501 Create_func_gtid_subtract::create(THD *thd, Item *arg1, Item *arg2)
5502 {
5503   return new (thd->mem_root) Item_func_gtid_subtract(POS(), arg1, arg2);
5504 }
5505 
5506 
5507 Create_func_gtid_subset Create_func_gtid_subset::s_singleton;
5508 
5509 Item*
create(THD * thd,Item * arg1,Item * arg2)5510 Create_func_gtid_subset::create(THD *thd, Item *arg1, Item *arg2)
5511 {
5512   return new (thd->mem_root) Item_func_gtid_subset(POS(), arg1, arg2);
5513 }
5514 
5515 
5516 Create_func_hex Create_func_hex::s_singleton;
5517 
5518 Item*
create(THD * thd,Item * arg1)5519 Create_func_hex::create(THD *thd, Item *arg1)
5520 {
5521   return new (thd->mem_root) Item_func_hex(POS(), arg1);
5522 }
5523 
5524 
5525 Create_func_ifnull Create_func_ifnull::s_singleton;
5526 
5527 Item*
create(THD * thd,Item * arg1,Item * arg2)5528 Create_func_ifnull::create(THD *thd, Item *arg1, Item *arg2)
5529 {
5530   return new (thd->mem_root) Item_func_ifnull(POS(), arg1, arg2);
5531 }
5532 
5533 
5534 Create_func_inet_ntoa Create_func_inet_ntoa::s_singleton;
5535 
5536 Item*
create(THD * thd,Item * arg1)5537 Create_func_inet_ntoa::create(THD *thd, Item *arg1)
5538 {
5539   return new (thd->mem_root) Item_func_inet_ntoa(POS(), arg1);
5540 }
5541 
5542 
5543 Create_func_inet6_aton Create_func_inet6_aton::s_singleton;
5544 
5545 Item*
create(THD * thd,Item * arg1)5546 Create_func_inet6_aton::create(THD *thd, Item *arg1)
5547 {
5548   return new (thd->mem_root) Item_func_inet6_aton(POS(), arg1);
5549 }
5550 
5551 
5552 Create_func_inet6_ntoa Create_func_inet6_ntoa::s_singleton;
5553 
5554 Item*
create(THD * thd,Item * arg1)5555 Create_func_inet6_ntoa::create(THD *thd, Item *arg1)
5556 {
5557   return new (thd->mem_root) Item_func_inet6_ntoa(POS(), arg1);
5558 }
5559 
5560 
5561 Create_func_inet_aton Create_func_inet_aton::s_singleton;
5562 
5563 Item*
create(THD * thd,Item * arg1)5564 Create_func_inet_aton::create(THD *thd, Item *arg1)
5565 {
5566   return new (thd->mem_root) Item_func_inet_aton(POS(), arg1);
5567 }
5568 
5569 
5570 Create_func_is_ipv4 Create_func_is_ipv4::s_singleton;
5571 
5572 Item*
create(THD * thd,Item * arg1)5573 Create_func_is_ipv4::create(THD *thd, Item *arg1)
5574 {
5575   return new (thd->mem_root) Item_func_is_ipv4(POS(), arg1);
5576 }
5577 
5578 
5579 Create_func_is_ipv6 Create_func_is_ipv6::s_singleton;
5580 
5581 Item*
create(THD * thd,Item * arg1)5582 Create_func_is_ipv6::create(THD *thd, Item *arg1)
5583 {
5584   return new (thd->mem_root) Item_func_is_ipv6(POS(), arg1);
5585 }
5586 
5587 
5588 Create_func_is_ipv4_compat Create_func_is_ipv4_compat::s_singleton;
5589 
5590 Item*
create(THD * thd,Item * arg1)5591 Create_func_is_ipv4_compat::create(THD *thd, Item *arg1)
5592 {
5593   return new (thd->mem_root) Item_func_is_ipv4_compat(POS(), arg1);
5594 }
5595 
5596 
5597 Create_func_is_ipv4_mapped Create_func_is_ipv4_mapped::s_singleton;
5598 
5599 Item*
create(THD * thd,Item * arg1)5600 Create_func_is_ipv4_mapped::create(THD *thd, Item *arg1)
5601 {
5602   return new (thd->mem_root) Item_func_is_ipv4_mapped(POS(), arg1);
5603 }
5604 
5605 
5606 Create_func_instr Create_func_instr::s_singleton;
5607 
5608 Item*
create(THD * thd,Item * arg1,Item * arg2)5609 Create_func_instr::create(THD *thd, Item *arg1, Item *arg2)
5610 {
5611   return new (thd->mem_root) Item_func_instr(POS(), arg1, arg2);
5612 }
5613 
5614 
5615 Create_func_interiorringn Create_func_interiorringn::s_singleton;
5616 
5617 Item*
create(THD * thd,Item * arg1,Item * arg2)5618 Create_func_interiorringn::create(THD *thd, Item *arg1, Item *arg2)
5619 {
5620   return new (thd->mem_root) Item_func_spatial_decomp_n(POS(), arg1, arg2,
5621                                                         Item_func::SP_INTERIORRINGN);
5622 }
5623 
5624 
5625 Create_func_mbr_intersects Create_func_mbr_intersects::s_singleton;
5626 
5627 Item*
create(THD * thd,Item * arg1,Item * arg2)5628 Create_func_mbr_intersects::create(THD *thd, Item *arg1, Item *arg2)
5629 {
5630   return new (thd->mem_root) Item_func_spatial_mbr_rel(POS(), arg1, arg2,
5631                                Item_func::SP_INTERSECTS_FUNC);
5632 }
5633 
5634 
5635 Create_func_intersects Create_func_intersects::s_singleton;
5636 
5637 Item*
create(THD * thd,Item * arg1,Item * arg2)5638 Create_func_intersects::create(THD *thd, Item *arg1, Item *arg2)
5639 {
5640   return new (thd->mem_root) Item_func_spatial_rel(POS(), arg1, arg2,
5641                                                    Item_func::SP_INTERSECTS_FUNC);
5642 }
5643 
5644 
5645 Create_func_intersection Create_func_intersection::s_singleton;
5646 
5647 Item*
create(THD * thd,Item * arg1,Item * arg2)5648 Create_func_intersection::create(THD *thd, Item *arg1, Item *arg2)
5649 {
5650   return new (thd->mem_root) Item_func_spatial_operation(POS(), arg1, arg2,
5651                                Item_func_spatial_operation::op_intersection);
5652 }
5653 
5654 
5655 Create_func_difference Create_func_difference::s_singleton;
5656 
5657 Item*
create(THD * thd,Item * arg1,Item * arg2)5658 Create_func_difference::create(THD *thd, Item *arg1, Item *arg2)
5659 {
5660   return new (thd->mem_root) Item_func_spatial_operation(POS(), arg1, arg2,
5661                                Item_func_spatial_operation::op_difference);
5662 }
5663 
5664 
5665 Create_func_union Create_func_union::s_singleton;
5666 
5667 Item*
create(THD * thd,Item * arg1,Item * arg2)5668 Create_func_union::create(THD *thd, Item *arg1, Item *arg2)
5669 {
5670   return new (thd->mem_root) Item_func_spatial_operation(POS(), arg1, arg2,
5671                                Item_func_spatial_operation::op_union);
5672 }
5673 
5674 
5675 Create_func_symdifference Create_func_symdifference::s_singleton;
5676 
5677 Item*
create(THD * thd,Item * arg1,Item * arg2)5678 Create_func_symdifference::create(THD *thd, Item *arg1, Item *arg2)
5679 {
5680   return new (thd->mem_root) Item_func_spatial_operation(POS(), arg1, arg2,
5681                                Item_func_spatial_operation::op_symdifference);
5682 }
5683 
5684 
5685 Create_func_buffer Create_func_buffer::s_singleton;
5686 
5687 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)5688 Create_func_buffer::create_native(THD *thd, LEX_STRING name,
5689                                   PT_item_list *item_list)
5690 {
5691   int arg_count= 0;
5692 
5693   if (item_list != NULL)
5694     arg_count= item_list->elements();
5695 
5696   if (arg_count < 2 || arg_count > 5)
5697   {
5698     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
5699     return NULL;
5700   }
5701   return new (thd->mem_root) Item_func_buffer(POS(), item_list);
5702 
5703 }
5704 
5705 
5706 Create_func_is_free_lock Create_func_is_free_lock::s_singleton;
5707 
5708 Item*
create(THD * thd,Item * arg1)5709 Create_func_is_free_lock::create(THD *thd, Item *arg1)
5710 {
5711   return new (thd->mem_root) Item_func_is_free_lock(POS(), arg1);
5712 }
5713 
5714 
5715 Create_func_is_used_lock Create_func_is_used_lock::s_singleton;
5716 
5717 Item*
create(THD * thd,Item * arg1)5718 Create_func_is_used_lock::create(THD *thd, Item *arg1)
5719 {
5720   return new (thd->mem_root) Item_func_is_used_lock(POS(), arg1);
5721 }
5722 
5723 
5724 Create_func_isclosed Create_func_isclosed::s_singleton;
5725 
5726 Item*
create(THD * thd,Item * arg1)5727 Create_func_isclosed::create(THD *thd, Item *arg1)
5728 {
5729   return new (thd->mem_root) Item_func_isclosed(POS(), arg1);
5730 }
5731 
5732 
5733 Create_func_isempty Create_func_isempty::s_singleton;
5734 
5735 Item*
create(THD * thd,Item * arg1)5736 Create_func_isempty::create(THD *thd, Item *arg1)
5737 {
5738   return new (thd->mem_root) Item_func_isempty(POS(), arg1);
5739 }
5740 
5741 
5742 Create_func_isnull Create_func_isnull::s_singleton;
5743 
5744 Item*
create(THD * thd,Item * arg1)5745 Create_func_isnull::create(THD *thd, Item *arg1)
5746 {
5747   return new (thd->mem_root) Item_func_isnull(POS(), arg1);
5748 }
5749 
5750 
5751 Create_func_issimple Create_func_issimple::s_singleton;
5752 
5753 Item*
create(THD * thd,Item * arg1)5754 Create_func_issimple::create(THD *thd, Item *arg1)
5755 {
5756   return new (thd->mem_root) Item_func_issimple(POS(), arg1);
5757 }
5758 
5759 
5760 Create_func_json_valid Create_func_json_valid::s_singleton;
5761 
5762 Item*
create(THD * thd,Item * arg1)5763 Create_func_json_valid::create(THD *thd, Item *arg1)
5764 {
5765   return new (thd->mem_root) Item_func_json_valid(POS(), arg1);
5766 }
5767 
5768 Create_func_json_contains Create_func_json_contains::s_singleton;
5769 
5770 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)5771 Create_func_json_contains::create_native(THD *thd, LEX_STRING name,
5772                                          PT_item_list *item_list)
5773 {
5774   Item* func= NULL;
5775   int arg_count= 0;
5776 
5777   if (item_list != NULL)
5778     arg_count= item_list->elements();
5779 
5780   if (arg_count == 2 || arg_count == 3)
5781   {
5782     func= new (thd->mem_root) Item_func_json_contains(thd, POS(), item_list);
5783   }
5784   else
5785   {
5786     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
5787   }
5788 
5789   return func;
5790 }
5791 
5792 Create_func_json_contains_path Create_func_json_contains_path::s_singleton;
5793 
5794 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)5795 Create_func_json_contains_path::create_native(THD *thd, LEX_STRING name,
5796                                               PT_item_list *item_list)
5797 {
5798   Item* func= NULL;
5799   int arg_count= 0;
5800 
5801   if (item_list != NULL)
5802     arg_count= item_list->elements();
5803 
5804   if (!(arg_count >= 3))
5805   {
5806     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
5807   }
5808   else
5809   {
5810     func= new (thd->mem_root) Item_func_json_contains_path(thd, POS(), item_list);
5811   }
5812 
5813   return func;
5814 }
5815 
5816 Create_func_json_length Create_func_json_length::s_singleton;
5817 
5818 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)5819 Create_func_json_length::create_native(THD *thd, LEX_STRING name,
5820                                 PT_item_list *item_list)
5821 {
5822   Item* func= NULL;
5823   int arg_count= 0;
5824 
5825   if (item_list != NULL)
5826     arg_count= item_list->elements();
5827 
5828   switch (arg_count) {
5829   case 1:
5830   {
5831     Item *param_1= item_list->pop_front();
5832     func= new (thd->mem_root) Item_func_json_length(thd, POS(), param_1);
5833     break;
5834   }
5835   case 2:
5836   {
5837     Item *param_1= item_list->pop_front();
5838     Item *param_2= item_list->pop_front();
5839     func= new (thd->mem_root) Item_func_json_length(thd, POS(), param_1, param_2);
5840     break;
5841   }
5842   default:
5843   {
5844     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
5845     break;
5846   }
5847   }
5848 
5849   return func;
5850 }
5851 
5852 Create_func_json_depth Create_func_json_depth::s_singleton;
5853 
5854 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)5855 Create_func_json_depth::create_native(THD *thd, LEX_STRING name,
5856                                 PT_item_list *item_list)
5857 {
5858   Item* func= NULL;
5859   int arg_count= 0;
5860 
5861   if (item_list != NULL)
5862   {
5863     arg_count= item_list->elements();
5864   }
5865 
5866   if (arg_count != 1)
5867   {
5868     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
5869   }
5870   else
5871   {
5872     Item *param_1= item_list->pop_front();
5873 
5874     func= new (thd->mem_root) Item_func_json_depth(POS(), param_1);
5875   }
5876 
5877   return func;
5878 }
5879 
5880 Create_func_json_type Create_func_json_type::s_singleton;
5881 
5882 Item*
create(THD * thd,Item * arg1)5883 Create_func_json_type::create(THD *thd, Item *arg1)
5884 {
5885   return new (thd->mem_root) Item_func_json_type(POS(), arg1);
5886 }
5887 
5888 Create_func_json_keys Create_func_json_keys::s_singleton;
5889 
5890 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)5891 Create_func_json_keys::create_native(THD *thd, LEX_STRING name,
5892                                      PT_item_list *item_list)
5893 {
5894   Item* func= NULL;
5895   int arg_count= 0;
5896 
5897   if (item_list != NULL)
5898     arg_count= item_list->elements();
5899 
5900   switch (arg_count)
5901   {
5902   case 1:
5903     {
5904       Item *param_1= item_list->pop_front();
5905       func= new (thd->mem_root) Item_func_json_keys(thd, POS(), param_1);
5906       break;
5907     }
5908   case 2:
5909     {
5910       Item *param_1= item_list->pop_front();
5911       Item *param_2= item_list->pop_front();
5912       func= new (thd->mem_root) Item_func_json_keys(thd, POS(),
5913                                                     param_1, param_2);
5914       break;
5915     }
5916   default:
5917     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
5918     break;
5919   }
5920 
5921   return func;
5922 }
5923 
5924 Create_func_json_extract Create_func_json_extract::s_singleton;
5925 
5926 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)5927 Create_func_json_extract::create_native(THD *thd, LEX_STRING name,
5928                                      PT_item_list *item_list)
5929 {
5930   Item* func= NULL;
5931   int arg_count= 0;
5932 
5933   if (item_list != NULL)
5934     arg_count= item_list->elements();
5935 
5936   if (arg_count < 2)
5937   {
5938     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
5939   }
5940   else
5941   {
5942     func= new (thd->mem_root) Item_func_json_extract(thd, POS(), item_list);
5943   }
5944 
5945   return func;
5946 }
5947 
5948 Create_func_json_array_append Create_func_json_array_append::s_singleton;
5949 
5950 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)5951 Create_func_json_array_append::create_native(THD *thd, LEX_STRING name,
5952                                      PT_item_list *item_list)
5953 {
5954   Item* func= NULL;
5955   int arg_count= 0;
5956 
5957   if (item_list != NULL)
5958     arg_count= item_list->elements();
5959 
5960   if (arg_count < 3)
5961   {
5962     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
5963   }
5964 
5965   if (arg_count % 2 == 0) // 3,5,7, ..., (k*2)+1 args allowed
5966   {
5967     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
5968   }
5969   else
5970   {
5971     func= new (thd->mem_root) Item_func_json_array_append(thd, POS(), item_list);
5972   }
5973 
5974   return func;
5975 }
5976 
5977 Create_func_json_insert Create_func_json_insert::s_singleton;
5978 
5979 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)5980 Create_func_json_insert::create_native(THD *thd, LEX_STRING name,
5981                                      PT_item_list *item_list)
5982 {
5983   Item* func= NULL;
5984   int arg_count= 0;
5985 
5986   if (item_list != NULL)
5987     arg_count= item_list->elements();
5988 
5989   if (arg_count < 3)
5990   {
5991     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
5992   }
5993 
5994   if (arg_count % 2 == 0) // 3,5,7, ..., (k*2)+1 args allowed
5995   {
5996     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
5997   }
5998   else
5999   {
6000     func= new (thd->mem_root) Item_func_json_insert(thd, POS(), item_list);
6001   }
6002 
6003   return func;
6004 }
6005 
6006 Create_func_json_array_insert Create_func_json_array_insert::s_singleton;
6007 
6008 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)6009 Create_func_json_array_insert::create_native(THD *thd,
6010                                              LEX_STRING name,
6011                                              PT_item_list *item_list)
6012 {
6013   Item *func= NULL;
6014   int arg_count= 0;
6015 
6016   if (item_list != NULL)
6017     arg_count= item_list->elements();
6018 
6019   if (arg_count < 3)
6020   {
6021     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
6022     return NULL;
6023   }
6024 
6025   if (arg_count % 2 == 0) // 3,5,7, ..., (k*2)+1 args allowed
6026   {
6027     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
6028   }
6029   else
6030   {
6031     func= new (thd->mem_root) Item_func_json_array_insert(thd,
6032                                                           POS(),
6033                                                           item_list);
6034   }
6035 
6036   return func;
6037 }
6038 
6039 Create_func_json_row_object Create_func_json_row_object::s_singleton;
6040 
6041 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)6042 Create_func_json_row_object::create_native(THD *thd, LEX_STRING name,
6043                                      PT_item_list *item_list)
6044 {
6045   Item* func= NULL;
6046   int arg_count= 0;
6047 
6048   if (item_list != NULL)
6049     arg_count= item_list->elements();
6050 
6051   if (arg_count % 2 != 0) // arguments come in pairs
6052   {
6053     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
6054   }
6055   else
6056   {
6057     func= new (thd->mem_root) Item_func_json_row_object(thd, POS(), item_list);
6058   }
6059 
6060   return func;
6061 }
6062 
6063 Create_func_json_search Create_func_json_search::s_singleton;
6064 
6065 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)6066 Create_func_json_search::create_native(THD *thd, LEX_STRING name,
6067                                      PT_item_list *item_list)
6068 {
6069   Item* func= NULL;
6070   int arg_count= 0;
6071 
6072   if (item_list != NULL)
6073     arg_count= item_list->elements();
6074 
6075   if (arg_count < 3)
6076   {
6077     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
6078   }
6079   else
6080   {
6081     func= new (thd->mem_root) Item_func_json_search(thd, POS(), item_list);
6082   }
6083 
6084   return func;
6085 }
6086 
6087 Create_func_json_set Create_func_json_set::s_singleton;
6088 
6089 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)6090 Create_func_json_set::create_native(THD *thd, LEX_STRING name,
6091                                      PT_item_list *item_list)
6092 {
6093   Item* func= NULL;
6094   int arg_count= 0;
6095 
6096   if (item_list != NULL)
6097     arg_count= item_list->elements();
6098 
6099   if (arg_count < 3)
6100   {
6101     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
6102   }
6103 
6104   if (arg_count % 2 == 0) // 3,5,7, ..., (k*2)+1 args allowed
6105   {
6106     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
6107   }
6108   else
6109   {
6110     func= new (thd->mem_root) Item_func_json_set(thd, POS(), item_list);
6111   }
6112 
6113   return func;
6114 }
6115 
6116 Create_func_json_replace Create_func_json_replace::s_singleton;
6117 
6118 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)6119 Create_func_json_replace::create_native(THD *thd, LEX_STRING name,
6120                                      PT_item_list *item_list)
6121 {
6122   Item* func= NULL;
6123   int arg_count= 0;
6124 
6125   if (item_list != NULL)
6126     arg_count= item_list->elements();
6127 
6128   if (arg_count < 3)
6129   {
6130     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
6131   }
6132 
6133   if (arg_count % 2 == 0) // 3,5,7, ..., (k*2)+1 args allowed
6134   {
6135     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
6136   }
6137   else
6138   {
6139     func= new (thd->mem_root) Item_func_json_replace(thd, POS(), item_list);
6140   }
6141 
6142   return func;
6143 }
6144 
6145 Create_func_json_array Create_func_json_array::s_singleton;
6146 
6147 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)6148 Create_func_json_array::create_native(THD *thd, LEX_STRING name,
6149                                      PT_item_list *item_list)
6150 {
6151   return new (thd->mem_root) Item_func_json_array(thd, POS(), item_list);
6152 }
6153 
6154 Create_func_json_remove Create_func_json_remove::s_singleton;
6155 
6156 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)6157 Create_func_json_remove::create_native(THD *thd, LEX_STRING name,
6158                                      PT_item_list *item_list)
6159 {
6160   Item* func= NULL;
6161   int arg_count= 0;
6162 
6163   if (item_list != NULL)
6164   {
6165     arg_count= item_list->elements();
6166   }
6167 
6168   if (arg_count < 2)
6169   {
6170     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
6171   }
6172   else
6173   {
6174     func= new (thd->mem_root) Item_func_json_remove(thd, POS(), item_list);
6175   }
6176 
6177   return func;
6178 }
6179 
6180 Create_func_isvalid Create_func_isvalid::s_singleton;
6181 
6182 Item*
create(THD * thd,Item * arg1)6183 Create_func_isvalid::create(THD *thd, Item *arg1)
6184 {
6185   return new (thd->mem_root) Item_func_isvalid(POS(), arg1);
6186 }
6187 
6188 
6189 Create_func_validate Create_func_validate::s_singleton;
6190 
6191 Item*
create(THD * thd,Item * arg1)6192 Create_func_validate::create(THD *thd, Item *arg1)
6193 {
6194   return new (thd->mem_root) Item_func_validate(POS(), arg1);
6195 }
6196 
6197 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)6198 Create_func_json_merge_patch::create_native(THD *thd, LEX_STRING name,
6199                                             PT_item_list *item_list)
6200 {
6201   int arg_count= item_list ? item_list->elements() : 0;
6202   if (arg_count < 2)
6203     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
6204   return new (thd->mem_root) Item_func_json_merge_patch(thd, POS(), item_list);
6205 }
6206 
6207 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)6208 Create_func_json_merge_preserve::create_native(THD *thd, LEX_STRING name,
6209                                                PT_item_list *item_list)
6210 {
6211   Item* func= NULL;
6212   int arg_count= 0;
6213 
6214   if (item_list != NULL)
6215   {
6216     arg_count= item_list->elements();
6217   }
6218 
6219   if (arg_count < 2)
6220   {
6221     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
6222   }
6223   else
6224   {
6225     func= new (thd->mem_root) Item_func_json_merge_preserve(thd, POS(),
6226                                                             item_list);
6227   }
6228 
6229   return func;
6230 }
6231 
6232 Create_func_json_quote Create_func_json_quote::s_singleton;
6233 
6234 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)6235 Create_func_json_quote::create_native(THD *thd, LEX_STRING name,
6236                                      PT_item_list *item_list)
6237 {
6238   Item* func= NULL;
6239   int arg_count= 0;
6240 
6241   if (item_list != NULL)
6242   {
6243     arg_count= item_list->elements();
6244   }
6245 
6246   if (arg_count != 1)
6247   {
6248     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
6249   }
6250   else
6251   {
6252     func= new (thd->mem_root) Item_func_json_quote(POS(), item_list);
6253   }
6254 
6255   return func;
6256 }
6257 
6258 Create_func_json_unquote Create_func_json_unquote::s_singleton;
6259 
6260 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)6261 Create_func_json_unquote::create_native(THD *thd, LEX_STRING name,
6262                                      PT_item_list *item_list)
6263 {
6264   Item* func= NULL;
6265   int arg_count= 0;
6266 
6267   if (item_list != NULL)
6268   {
6269     arg_count= item_list->elements();
6270   }
6271 
6272   if (arg_count != 1)
6273   {
6274     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
6275   }
6276   else
6277   {
6278     func= new (thd->mem_root) Item_func_json_unquote(POS(), item_list);
6279   }
6280 
6281   return func;
6282 }
6283 
6284 Create_func_last_day Create_func_last_day::s_singleton;
6285 
6286 Item*
create(THD * thd,Item * arg1)6287 Create_func_last_day::create(THD *thd, Item *arg1)
6288 {
6289   return new (thd->mem_root) Item_func_last_day(POS(), arg1);
6290 }
6291 
6292 
6293 Create_func_latfromgeohash Create_func_latfromgeohash::s_singleton;
6294 
6295 Item*
create(THD * thd,Item * arg1)6296 Create_func_latfromgeohash::create(THD *thd, Item *arg1)
6297 {
6298   return new (thd->mem_root) Item_func_latfromgeohash(POS(), arg1);
6299 }
6300 
6301 
6302 Create_func_last_insert_id Create_func_last_insert_id::s_singleton;
6303 
6304 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)6305 Create_func_last_insert_id::create_native(THD *thd, LEX_STRING name,
6306                                           PT_item_list *item_list)
6307 {
6308   Item *func= NULL;
6309   int arg_count= 0;
6310 
6311   if (item_list != NULL)
6312     arg_count= item_list->elements();
6313 
6314   POS pos;
6315   switch (arg_count) {
6316   case 0:
6317   {
6318     func= new (thd->mem_root) Item_func_last_insert_id(pos);
6319     break;
6320   }
6321   case 1:
6322   {
6323     Item *param_1= item_list->pop_front();
6324     func= new (thd->mem_root) Item_func_last_insert_id(pos, param_1);
6325     break;
6326   }
6327   default:
6328   {
6329     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
6330     break;
6331   }
6332   }
6333 
6334   return func;
6335 }
6336 
6337 
6338 Create_func_lower Create_func_lower::s_singleton;
6339 
6340 Item*
create(THD * thd,Item * arg1)6341 Create_func_lower::create(THD *thd, Item *arg1)
6342 {
6343   return new (thd->mem_root) Item_func_lower(POS(), arg1);
6344 }
6345 
6346 
6347 Create_func_least Create_func_least::s_singleton;
6348 
6349 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)6350 Create_func_least::create_native(THD *thd, LEX_STRING name,
6351                                  PT_item_list *item_list)
6352 {
6353   int arg_count= 0;
6354 
6355   if (item_list != NULL)
6356     arg_count= item_list->elements();
6357 
6358   if (arg_count < 2)
6359   {
6360     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
6361     return NULL;
6362   }
6363 
6364   return new (thd->mem_root) Item_func_min(POS(), item_list);
6365 }
6366 
6367 
6368 Create_func_length Create_func_length::s_singleton;
6369 
6370 Item*
create(THD * thd,Item * arg1)6371 Create_func_length::create(THD *thd, Item *arg1)
6372 {
6373   return new (thd->mem_root) Item_func_length(POS(), arg1);
6374 }
6375 
6376 
6377 #ifndef NDEBUG
6378 Create_func_like_range_min Create_func_like_range_min::s_singleton;
6379 
6380 Item*
create(THD * thd,Item * arg1,Item * arg2)6381 Create_func_like_range_min::create(THD *thd, Item *arg1, Item *arg2)
6382 {
6383   return new (thd->mem_root) Item_func_like_range_min(POS(), arg1, arg2);
6384 }
6385 
6386 
6387 Create_func_like_range_max Create_func_like_range_max::s_singleton;
6388 
6389 Item*
create(THD * thd,Item * arg1,Item * arg2)6390 Create_func_like_range_max::create(THD *thd, Item *arg1, Item *arg2)
6391 {
6392   return new (thd->mem_root) Item_func_like_range_max(POS(), arg1, arg2);
6393 }
6394 #endif
6395 
6396 
6397 Create_func_ln Create_func_ln::s_singleton;
6398 
6399 Item*
create(THD * thd,Item * arg1)6400 Create_func_ln::create(THD *thd, Item *arg1)
6401 {
6402   return new (thd->mem_root) Item_func_ln(POS(), arg1);
6403 }
6404 
6405 
6406 Create_func_load_file Create_func_load_file::s_singleton;
6407 
6408 Item*
create(THD * thd,Item * arg1)6409 Create_func_load_file::create(THD *thd, Item *arg1)
6410 {
6411   return new (thd->mem_root) Item_load_file(POS(), arg1);
6412 }
6413 
6414 
6415 Create_func_locate Create_func_locate::s_singleton;
6416 
6417 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)6418 Create_func_locate::create_native(THD *thd, LEX_STRING name,
6419                                   PT_item_list *item_list)
6420 {
6421   Item *func= NULL;
6422   int arg_count= 0;
6423 
6424   if (item_list != NULL)
6425     arg_count= item_list->elements();
6426 
6427   POS pos;
6428   switch (arg_count) {
6429   case 2:
6430   {
6431     Item *param_1= item_list->pop_front();
6432     Item *param_2= item_list->pop_front();
6433     /* Yes, parameters in that order : 2, 1 */
6434     func= new (thd->mem_root) Item_func_locate(pos, param_2, param_1);
6435     break;
6436   }
6437   case 3:
6438   {
6439     Item *param_1= item_list->pop_front();
6440     Item *param_2= item_list->pop_front();
6441     Item *param_3= item_list->pop_front();
6442     /* Yes, parameters in that order : 2, 1, 3 */
6443     func= new (thd->mem_root) Item_func_locate(pos, param_2, param_1, param_3);
6444     break;
6445   }
6446   default:
6447   {
6448     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
6449     break;
6450   }
6451   }
6452 
6453   return func;
6454 }
6455 
6456 
6457 Create_func_log Create_func_log::s_singleton;
6458 
6459 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)6460 Create_func_log::create_native(THD *thd, LEX_STRING name,
6461                                PT_item_list *item_list)
6462 {
6463   Item *func= NULL;
6464   int arg_count= 0;
6465 
6466   if (item_list != NULL)
6467     arg_count= item_list->elements();
6468 
6469   switch (arg_count) {
6470   case 1:
6471   {
6472     Item *param_1= item_list->pop_front();
6473     func= new (thd->mem_root) Item_func_log(POS(), param_1);
6474     break;
6475   }
6476   case 2:
6477   {
6478     Item *param_1= item_list->pop_front();
6479     Item *param_2= item_list->pop_front();
6480     func= new (thd->mem_root) Item_func_log(POS(), param_1, param_2);
6481     break;
6482   }
6483   default:
6484   {
6485     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
6486     break;
6487   }
6488   }
6489 
6490   return func;
6491 }
6492 
6493 
6494 Create_func_log10 Create_func_log10::s_singleton;
6495 
6496 Item*
create(THD * thd,Item * arg1)6497 Create_func_log10::create(THD *thd, Item *arg1)
6498 {
6499   return new (thd->mem_root) Item_func_log10(POS(), arg1);
6500 }
6501 
6502 
6503 Create_func_log2 Create_func_log2::s_singleton;
6504 
6505 Item*
create(THD * thd,Item * arg1)6506 Create_func_log2::create(THD *thd, Item *arg1)
6507 {
6508   return new (thd->mem_root) Item_func_log2(POS(), arg1);
6509 }
6510 
6511 
6512 Create_func_longfromgeohash Create_func_longfromgeohash::s_singleton;
6513 
6514 Item*
create(THD * thd,Item * arg1)6515 Create_func_longfromgeohash::create(THD *thd, Item *arg1)
6516 {
6517   return new (thd->mem_root) Item_func_longfromgeohash(POS(), arg1);
6518 }
6519 
6520 
6521 Create_func_lpad Create_func_lpad::s_singleton;
6522 
6523 Item*
create(THD * thd,Item * arg1,Item * arg2,Item * arg3)6524 Create_func_lpad::create(THD *thd, Item *arg1, Item *arg2, Item *arg3)
6525 {
6526   return new (thd->mem_root) Item_func_lpad(POS(), arg1, arg2, arg3);
6527 }
6528 
6529 
6530 Create_func_ltrim Create_func_ltrim::s_singleton;
6531 
6532 Item*
create(THD * thd,Item * arg1)6533 Create_func_ltrim::create(THD *thd, Item *arg1)
6534 {
6535   return new (thd->mem_root) Item_func_trim(POS(), arg1,
6536                                             Item_func_trim::TRIM_LTRIM);
6537 }
6538 
6539 
6540 Create_func_makedate Create_func_makedate::s_singleton;
6541 
6542 Item*
create(THD * thd,Item * arg1,Item * arg2)6543 Create_func_makedate::create(THD *thd, Item *arg1, Item *arg2)
6544 {
6545   return new (thd->mem_root) Item_func_makedate(POS(), arg1, arg2);
6546 }
6547 
6548 
6549 Create_func_make_envelope Create_func_make_envelope::s_singleton;
6550 
6551 Item*
create(THD * thd,Item * arg1,Item * arg2)6552 Create_func_make_envelope::create(THD *thd, Item *arg1, Item *arg2)
6553 {
6554   return new (thd->mem_root) Item_func_make_envelope(POS(), arg1, arg2);
6555 }
6556 
6557 
6558 Create_func_maketime Create_func_maketime::s_singleton;
6559 
6560 Item*
create(THD * thd,Item * arg1,Item * arg2,Item * arg3)6561 Create_func_maketime::create(THD *thd, Item *arg1, Item *arg2, Item *arg3)
6562 {
6563   return new (thd->mem_root) Item_func_maketime(POS(), arg1, arg2, arg3);
6564 }
6565 
6566 
6567 Create_func_make_set Create_func_make_set::s_singleton;
6568 
6569 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)6570 Create_func_make_set::create_native(THD *thd, LEX_STRING name,
6571                                     PT_item_list *item_list)
6572 {
6573   int arg_count= 0;
6574 
6575   if (item_list != NULL)
6576     arg_count= item_list->elements();
6577 
6578   if (arg_count < 2)
6579   {
6580     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
6581     return NULL;
6582   }
6583 
6584   Item *param_1= item_list->pop_front();
6585   return new (thd->mem_root) Item_func_make_set(POS(), param_1,
6586                                                 item_list);
6587 }
6588 
6589 
6590 Create_func_master_pos_wait Create_func_master_pos_wait::s_singleton;
6591 
6592 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)6593 Create_func_master_pos_wait::create_native(THD *thd, LEX_STRING name,
6594                                            PT_item_list *item_list)
6595 
6596 {
6597   Item *func= NULL;
6598   int arg_count= 0;
6599 
6600   if (item_list != NULL)
6601     arg_count= item_list->elements();
6602 
6603   POS pos;
6604   switch (arg_count) {
6605   case 2:
6606   {
6607     Item *param_1= item_list->pop_front();
6608     Item *param_2= item_list->pop_front();
6609     func= new (thd->mem_root) Item_master_pos_wait(pos, param_1, param_2);
6610     break;
6611   }
6612   case 3:
6613   {
6614     Item *param_1= item_list->pop_front();
6615     Item *param_2= item_list->pop_front();
6616     Item *param_3= item_list->pop_front();
6617     func= new (thd->mem_root) Item_master_pos_wait(pos, param_1, param_2, param_3);
6618     break;
6619   }
6620   case 4:
6621   {
6622     Item *param_1= item_list->pop_front();
6623     Item *param_2= item_list->pop_front();
6624     Item *param_3= item_list->pop_front();
6625     Item *param_4= item_list->pop_front();
6626     func= new (thd->mem_root) Item_master_pos_wait(pos, param_1, param_2, param_3,
6627                                                    param_4);
6628     break;
6629   }
6630   default:
6631   {
6632     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
6633     break;
6634   }
6635   }
6636 
6637   return func;
6638 }
6639 
6640 Create_func_master_gtid_set_wait Create_func_master_gtid_set_wait::s_singleton;
6641 
6642 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)6643 Create_func_master_gtid_set_wait::create_native(THD *thd, LEX_STRING name,
6644                                                 PT_item_list *item_list)
6645 
6646 {
6647   Item *func= NULL;
6648   int arg_count= 0;
6649 
6650   if (item_list != NULL)
6651     arg_count= item_list->elements();
6652 
6653   POS pos;
6654   switch (arg_count) {
6655   case 1:
6656   {
6657     Item *param_1= item_list->pop_front();
6658     func= new (thd->mem_root) Item_master_gtid_set_wait(pos, param_1);
6659     break;
6660   }
6661   case 2:
6662   {
6663     Item *param_1= item_list->pop_front();
6664     Item *param_2= item_list->pop_front();
6665     func= new (thd->mem_root) Item_master_gtid_set_wait(pos, param_1, param_2);
6666     break;
6667   }
6668   case 3:
6669   {
6670     Item *param_1= item_list->pop_front();
6671     Item *param_2= item_list->pop_front();
6672     Item *param_3= item_list->pop_front();
6673     func= new (thd->mem_root) Item_master_gtid_set_wait(pos, param_1, param_2,
6674                                                         param_3);
6675     break;
6676   }
6677   default:
6678   {
6679     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
6680     break;
6681   }
6682   }
6683 
6684   return func;
6685 }
6686 
6687 Create_func_executed_gtid_set_wait Create_func_executed_gtid_set_wait::s_singleton;
6688 
6689 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)6690 Create_func_executed_gtid_set_wait::create_native(THD *thd, LEX_STRING name,
6691                                                   PT_item_list *item_list)
6692 
6693 {
6694   Item *func= NULL;
6695   int arg_count= 0;
6696 
6697   if (item_list != NULL)
6698     arg_count= item_list->elements();
6699 
6700   POS pos;
6701   switch (arg_count) {
6702   case 1:
6703   {
6704     Item *param_1= item_list->pop_front();
6705     func= new (thd->mem_root) Item_wait_for_executed_gtid_set(pos, param_1);
6706     break;
6707   }
6708   case 2:
6709   {
6710     Item *param_1= item_list->pop_front();
6711     Item *param_2= item_list->pop_front();
6712     func= new (thd->mem_root) Item_wait_for_executed_gtid_set(pos, param_1, param_2);
6713     break;
6714   }
6715   default:
6716   {
6717     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
6718     break;
6719   }
6720   }
6721 
6722   return func;
6723 }
6724 
6725 Create_func_md5 Create_func_md5::s_singleton;
6726 
6727 Item*
create(THD * thd,Item * arg1)6728 Create_func_md5::create(THD *thd, Item *arg1)
6729 {
6730   return new (thd->mem_root) Item_func_md5(POS(), arg1);
6731 }
6732 
6733 
6734 Create_func_monthname Create_func_monthname::s_singleton;
6735 
6736 Item*
create(THD * thd,Item * arg1)6737 Create_func_monthname::create(THD *thd, Item *arg1)
6738 {
6739   return new (thd->mem_root) Item_func_monthname(POS(), arg1);
6740 }
6741 
6742 
6743 Create_func_name_const Create_func_name_const::s_singleton;
6744 
6745 Item*
create(THD * thd,Item * arg1,Item * arg2)6746 Create_func_name_const::create(THD *thd, Item *arg1, Item *arg2)
6747 {
6748   return new (thd->mem_root) Item_name_const(POS(), arg1, arg2);
6749 }
6750 
6751 
6752 Create_func_nullif Create_func_nullif::s_singleton;
6753 
6754 Item*
create(THD * thd,Item * arg1,Item * arg2)6755 Create_func_nullif::create(THD *thd, Item *arg1, Item *arg2)
6756 {
6757   return new (thd->mem_root) Item_func_nullif(POS(), arg1, arg2);
6758 }
6759 
6760 
6761 Create_func_numgeometries Create_func_numgeometries::s_singleton;
6762 
6763 Item*
create(THD * thd,Item * arg1)6764 Create_func_numgeometries::create(THD *thd, Item *arg1)
6765 {
6766   return new (thd->mem_root) Item_func_numgeometries(POS(), arg1);
6767 }
6768 
6769 
6770 Create_func_numinteriorring Create_func_numinteriorring::s_singleton;
6771 
6772 Item*
create(THD * thd,Item * arg1)6773 Create_func_numinteriorring::create(THD *thd, Item *arg1)
6774 {
6775   return new (thd->mem_root) Item_func_numinteriorring(POS(), arg1);
6776 }
6777 
6778 
6779 Create_func_numpoints Create_func_numpoints::s_singleton;
6780 
6781 Item*
create(THD * thd,Item * arg1)6782 Create_func_numpoints::create(THD *thd, Item *arg1)
6783 {
6784   return new (thd->mem_root) Item_func_numpoints(POS(), arg1);
6785 }
6786 
6787 
6788 Create_func_oct Create_func_oct::s_singleton;
6789 
6790 Item*
create(THD * thd,Item * arg1)6791 Create_func_oct::create(THD *thd, Item *arg1)
6792 {
6793   Item *i10= new (thd->mem_root) Item_int(POS(), 10,2);
6794   Item *i8= new (thd->mem_root) Item_int(POS(), 8,1);
6795   return new (thd->mem_root) Item_func_conv(POS(), arg1, i10, i8);
6796 }
6797 
6798 
6799 Create_func_ord Create_func_ord::s_singleton;
6800 
6801 Item*
create(THD * thd,Item * arg1)6802 Create_func_ord::create(THD *thd, Item *arg1)
6803 {
6804   return new (thd->mem_root) Item_func_ord(POS(), arg1);
6805 }
6806 
6807 
6808 Create_func_mbr_overlaps Create_func_mbr_overlaps::s_singleton;
6809 
6810 Item*
create(THD * thd,Item * arg1,Item * arg2)6811 Create_func_mbr_overlaps::create(THD *thd, Item *arg1, Item *arg2)
6812 {
6813   return new (thd->mem_root) Item_func_spatial_mbr_rel(POS(), arg1, arg2,
6814                                Item_func::SP_OVERLAPS_FUNC);
6815 }
6816 
6817 
6818 Create_func_overlaps Create_func_overlaps::s_singleton;
6819 
6820 Item*
create(THD * thd,Item * arg1,Item * arg2)6821 Create_func_overlaps::create(THD *thd, Item *arg1, Item *arg2)
6822 {
6823   return new (thd->mem_root) Item_func_spatial_rel(POS(), arg1, arg2,
6824                                                    Item_func::SP_OVERLAPS_FUNC);
6825 }
6826 
6827 
6828 Create_func_period_add Create_func_period_add::s_singleton;
6829 
6830 Item*
create(THD * thd,Item * arg1,Item * arg2)6831 Create_func_period_add::create(THD *thd, Item *arg1, Item *arg2)
6832 {
6833   return new (thd->mem_root) Item_func_period_add(POS(), arg1, arg2);
6834 }
6835 
6836 
6837 Create_func_period_diff Create_func_period_diff::s_singleton;
6838 
6839 Item*
create(THD * thd,Item * arg1,Item * arg2)6840 Create_func_period_diff::create(THD *thd, Item *arg1, Item *arg2)
6841 {
6842   return new (thd->mem_root) Item_func_period_diff(POS(), arg1, arg2);
6843 }
6844 
6845 
6846 Create_func_pi Create_func_pi::s_singleton;
6847 
6848 Item*
create(THD * thd)6849 Create_func_pi::create(THD *thd)
6850 {
6851   return new (thd->mem_root) Item_static_float_func(POS(),
6852                                                     NAME_STRING("pi()"),
6853                                                     M_PI, 6, 8);
6854 }
6855 
6856 
6857 Create_func_pointfromgeohash Create_func_pointfromgeohash::s_singleton;
6858 
6859 Item*
create(THD * thd,Item * arg1,Item * arg2)6860 Create_func_pointfromgeohash::create(THD *thd, Item *arg1, Item *arg2)
6861 {
6862   return new (thd->mem_root) Item_func_pointfromgeohash(POS(), arg1, arg2);
6863 }
6864 
6865 
6866 Create_func_pointn Create_func_pointn::s_singleton;
6867 
6868 Item*
create(THD * thd,Item * arg1,Item * arg2)6869 Create_func_pointn::create(THD *thd, Item *arg1, Item *arg2)
6870 {
6871   return new (thd->mem_root) Item_func_spatial_decomp_n(POS(), arg1, arg2,
6872                                                         Item_func::SP_POINTN);
6873 }
6874 
6875 
6876 Create_func_pow Create_func_pow::s_singleton;
6877 
6878 Item*
create(THD * thd,Item * arg1,Item * arg2)6879 Create_func_pow::create(THD *thd, Item *arg1, Item *arg2)
6880 {
6881   return new (thd->mem_root) Item_func_pow(POS(), arg1, arg2);
6882 }
6883 
6884 
6885 Create_func_quote Create_func_quote::s_singleton;
6886 
6887 Item*
create(THD * thd,Item * arg1)6888 Create_func_quote::create(THD *thd, Item *arg1)
6889 {
6890   return new (thd->mem_root) Item_func_quote(POS(), arg1);
6891 }
6892 
6893 
6894 Create_func_radians Create_func_radians::s_singleton;
6895 
6896 Item*
create(THD * thd,Item * arg1)6897 Create_func_radians::create(THD *thd, Item *arg1)
6898 {
6899   return new (thd->mem_root) Item_func_units(POS(), (char*) "radians", arg1,
6900                                              M_PI/180, 0.0);
6901 }
6902 
6903 
6904 Create_func_rand Create_func_rand::s_singleton;
6905 
6906 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)6907 Create_func_rand::create_native(THD *thd, LEX_STRING name,
6908                                 PT_item_list *item_list)
6909 {
6910   Item *func= NULL;
6911   int arg_count= 0;
6912 
6913   if (item_list != NULL)
6914     arg_count= item_list->elements();
6915 
6916   switch (arg_count) {
6917   case 0:
6918   {
6919     func= new (thd->mem_root) Item_func_rand(POS());
6920     break;
6921   }
6922   case 1:
6923   {
6924     Item *param_1= item_list->pop_front();
6925     func= new (thd->mem_root) Item_func_rand(POS(), param_1);
6926     break;
6927   }
6928   default:
6929   {
6930     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
6931     break;
6932   }
6933   }
6934 
6935   return func;
6936 }
6937 
6938 
6939 Create_func_release_all_locks Create_func_release_all_locks::s_singleton;
6940 
6941 Item*
create(THD * thd)6942 Create_func_release_all_locks::create(THD *thd)
6943 {
6944   return new (thd->mem_root) Item_func_release_all_locks(POS());
6945 }
6946 
6947 
6948 Create_func_release_lock Create_func_release_lock::s_singleton;
6949 
6950 Item*
create(THD * thd,Item * arg1)6951 Create_func_release_lock::create(THD *thd, Item *arg1)
6952 {
6953   return new (thd->mem_root) Item_func_release_lock(POS(), arg1);
6954 }
6955 
6956 
6957 Create_func_reverse Create_func_reverse::s_singleton;
6958 
6959 Item*
create(THD * thd,Item * arg1)6960 Create_func_reverse::create(THD *thd, Item *arg1)
6961 {
6962   return new (thd->mem_root) Item_func_reverse(POS(), arg1);
6963 }
6964 
6965 
6966 Create_func_round Create_func_round::s_singleton;
6967 
6968 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)6969 Create_func_round::create_native(THD *thd, LEX_STRING name,
6970                                  PT_item_list *item_list)
6971 {
6972   Item *func= NULL;
6973   int arg_count= 0;
6974 
6975   if (item_list != NULL)
6976     arg_count= item_list->elements();
6977 
6978   switch (arg_count) {
6979   case 1:
6980   {
6981     Item *param_1= item_list->pop_front();
6982     Item *i0 = new (thd->mem_root) Item_int_0(POS());
6983     func= new (thd->mem_root) Item_func_round(POS(), param_1, i0, 0);
6984     break;
6985   }
6986   case 2:
6987   {
6988     Item *param_1= item_list->pop_front();
6989     Item *param_2= item_list->pop_front();
6990     func= new (thd->mem_root) Item_func_round(POS(), param_1, param_2, 0);
6991     break;
6992   }
6993   default:
6994   {
6995     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
6996     break;
6997   }
6998   }
6999 
7000   return func;
7001 }
7002 
7003 
7004 Create_func_rpad Create_func_rpad::s_singleton;
7005 
7006 Item*
create(THD * thd,Item * arg1,Item * arg2,Item * arg3)7007 Create_func_rpad::create(THD *thd, Item *arg1, Item *arg2, Item *arg3)
7008 {
7009   return new (thd->mem_root) Item_func_rpad(POS(), arg1, arg2, arg3);
7010 }
7011 
7012 
7013 Create_func_rtrim Create_func_rtrim::s_singleton;
7014 
7015 Item*
create(THD * thd,Item * arg1)7016 Create_func_rtrim::create(THD *thd, Item *arg1)
7017 {
7018   return new (thd->mem_root) Item_func_trim(POS(), arg1,
7019                                             Item_func_trim::TRIM_RTRIM);
7020 }
7021 
7022 
7023 Create_func_sec_to_time Create_func_sec_to_time::s_singleton;
7024 
7025 Item*
create(THD * thd,Item * arg1)7026 Create_func_sec_to_time::create(THD *thd, Item *arg1)
7027 {
7028   return new (thd->mem_root) Item_func_sec_to_time(POS(), arg1);
7029 }
7030 
7031 
7032 Create_func_sha Create_func_sha::s_singleton;
7033 
7034 Item*
create(THD * thd,Item * arg1)7035 Create_func_sha::create(THD *thd, Item *arg1)
7036 {
7037   return new (thd->mem_root) Item_func_sha(POS(), arg1);
7038 }
7039 
7040 
7041 Create_func_sha2 Create_func_sha2::s_singleton;
7042 
7043 Item*
create(THD * thd,Item * arg1,Item * arg2)7044 Create_func_sha2::create(THD *thd, Item *arg1, Item *arg2)
7045 {
7046   return new (thd->mem_root) Item_func_sha2(POS(), arg1, arg2);
7047 }
7048 
7049 
7050 Create_func_sign Create_func_sign::s_singleton;
7051 
7052 Item*
create(THD * thd,Item * arg1)7053 Create_func_sign::create(THD *thd, Item *arg1)
7054 {
7055   return new (thd->mem_root) Item_func_sign(POS(), arg1);
7056 }
7057 
7058 
7059 Create_func_simplify Create_func_simplify::s_singleton;
7060 
7061 Item*
create(THD * thd,Item * arg1,Item * arg2)7062 Create_func_simplify::create(THD *thd, Item *arg1, Item *arg2)
7063 {
7064   return new (thd->mem_root) Item_func_simplify(POS(), arg1, arg2);
7065 }
7066 
7067 
7068 Create_func_sin Create_func_sin::s_singleton;
7069 
7070 Item*
create(THD * thd,Item * arg1)7071 Create_func_sin::create(THD *thd, Item *arg1)
7072 {
7073   return new (thd->mem_root) Item_func_sin(POS(), arg1);
7074 }
7075 
7076 
7077 Create_func_sleep Create_func_sleep::s_singleton;
7078 
7079 Item*
create(THD * thd,Item * arg1)7080 Create_func_sleep::create(THD *thd, Item *arg1)
7081 {
7082   return new (thd->mem_root) Item_func_sleep(POS(), arg1);
7083 }
7084 
7085 
7086 Create_func_soundex Create_func_soundex::s_singleton;
7087 
7088 Item*
create(THD * thd,Item * arg1)7089 Create_func_soundex::create(THD *thd, Item *arg1)
7090 {
7091   return new (thd->mem_root) Item_func_soundex(POS(), arg1);
7092 }
7093 
7094 
7095 Create_func_space Create_func_space::s_singleton;
7096 
7097 Item*
create(THD * thd,Item * arg1)7098 Create_func_space::create(THD *thd, Item *arg1)
7099 {
7100   return new (thd->mem_root) Item_func_space(POS(), arg1);
7101 }
7102 
7103 
7104 Create_func_sqrt Create_func_sqrt::s_singleton;
7105 
7106 Item*
create(THD * thd,Item * arg1)7107 Create_func_sqrt::create(THD *thd, Item *arg1)
7108 {
7109   return new (thd->mem_root) Item_func_sqrt(POS(), arg1);
7110 }
7111 
7112 
7113 Create_func_srid Create_func_srid::s_singleton;
7114 
7115 Item*
create(THD * thd,Item * arg1)7116 Create_func_srid::create(THD *thd, Item *arg1)
7117 {
7118   return new (thd->mem_root) Item_func_srid(POS(), arg1);
7119 }
7120 
7121 
7122 Create_func_startpoint Create_func_startpoint::s_singleton;
7123 
7124 Item*
create(THD * thd,Item * arg1)7125 Create_func_startpoint::create(THD *thd, Item *arg1)
7126 {
7127   return new (thd->mem_root) Item_func_spatial_decomp(POS(), arg1,
7128                                                       Item_func::SP_STARTPOINT);
7129 }
7130 
7131 
7132 Create_func_str_to_date Create_func_str_to_date::s_singleton;
7133 
7134 Item*
create(THD * thd,Item * arg1,Item * arg2)7135 Create_func_str_to_date::create(THD *thd, Item *arg1, Item *arg2)
7136 {
7137   return new (thd->mem_root) Item_func_str_to_date(POS(), arg1, arg2);
7138 }
7139 
7140 
7141 Create_func_strcmp Create_func_strcmp::s_singleton;
7142 
7143 Item*
create(THD * thd,Item * arg1,Item * arg2)7144 Create_func_strcmp::create(THD *thd, Item *arg1, Item *arg2)
7145 {
7146   return new (thd->mem_root) Item_func_strcmp(POS(), arg1, arg2);
7147 }
7148 
7149 
7150 Create_func_substr_index Create_func_substr_index::s_singleton;
7151 
7152 Item*
create(THD * thd,Item * arg1,Item * arg2,Item * arg3)7153 Create_func_substr_index::create(THD *thd, Item *arg1, Item *arg2, Item *arg3)
7154 {
7155   return new (thd->mem_root) Item_func_substr_index(POS(), arg1, arg2,
7156                                                     arg3);
7157 }
7158 
7159 
7160 Create_func_subtime Create_func_subtime::s_singleton;
7161 
7162 Item*
create(THD * thd,Item * arg1,Item * arg2)7163 Create_func_subtime::create(THD *thd, Item *arg1, Item *arg2)
7164 {
7165   return new (thd->mem_root) Item_func_add_time(POS(), arg1, arg2, 0, 1);
7166 }
7167 
7168 
7169 Create_func_tan Create_func_tan::s_singleton;
7170 
7171 Item*
create(THD * thd,Item * arg1)7172 Create_func_tan::create(THD *thd, Item *arg1)
7173 {
7174   return new (thd->mem_root) Item_func_tan(POS(), arg1);
7175 }
7176 
7177 
7178 Create_func_time_format Create_func_time_format::s_singleton;
7179 
7180 Item*
create(THD * thd,Item * arg1,Item * arg2)7181 Create_func_time_format::create(THD *thd, Item *arg1, Item *arg2)
7182 {
7183   return new (thd->mem_root) Item_func_date_format(POS(), arg1, arg2, 1);
7184 }
7185 
7186 
7187 Create_func_time_to_sec Create_func_time_to_sec::s_singleton;
7188 
7189 Item*
create(THD * thd,Item * arg1)7190 Create_func_time_to_sec::create(THD *thd, Item *arg1)
7191 {
7192   return new (thd->mem_root) Item_func_time_to_sec(POS(), arg1);
7193 }
7194 
7195 
7196 Create_func_timediff Create_func_timediff::s_singleton;
7197 
7198 Item*
create(THD * thd,Item * arg1,Item * arg2)7199 Create_func_timediff::create(THD *thd, Item *arg1, Item *arg2)
7200 {
7201   return new (thd->mem_root) Item_func_timediff(POS(), arg1, arg2);
7202 }
7203 
7204 
7205 Create_func_to_base64 Create_func_to_base64::s_singleton;
7206 
7207 Item*
create(THD * thd,Item * arg1)7208 Create_func_to_base64::create(THD *thd, Item *arg1)
7209 {
7210   return new (thd->mem_root) Item_func_to_base64(POS(), arg1);
7211 }
7212 
7213 
7214 Create_func_to_days Create_func_to_days::s_singleton;
7215 
7216 Item*
create(THD * thd,Item * arg1)7217 Create_func_to_days::create(THD *thd, Item *arg1)
7218 {
7219   return new (thd->mem_root) Item_func_to_days(POS(), arg1);
7220 }
7221 
7222 
7223 Create_func_to_seconds Create_func_to_seconds::s_singleton;
7224 
7225 Item*
create(THD * thd,Item * arg1)7226 Create_func_to_seconds::create(THD *thd, Item *arg1)
7227 {
7228   return new (thd->mem_root) Item_func_to_seconds(POS(), arg1);
7229 }
7230 
7231 
7232 Create_func_mbr_touches Create_func_mbr_touches::s_singleton;
7233 
7234 Item*
create(THD * thd,Item * arg1,Item * arg2)7235 Create_func_mbr_touches::create(THD *thd, Item *arg1, Item *arg2)
7236 {
7237   return new (thd->mem_root)
7238     Item_func_spatial_mbr_rel(POS(), arg1, arg2,
7239                               Item_func::SP_TOUCHES_FUNC);
7240 }
7241 
7242 
7243 Create_func_touches Create_func_touches::s_singleton;
7244 
7245 Item*
create(THD * thd,Item * arg1,Item * arg2)7246 Create_func_touches::create(THD *thd, Item *arg1, Item *arg2)
7247 {
7248   return new (thd->mem_root) Item_func_spatial_rel(POS(), arg1, arg2,
7249                                                    Item_func::SP_TOUCHES_FUNC);
7250 }
7251 
7252 
7253 Create_func_upper Create_func_upper::s_singleton;
7254 
7255 Item*
create(THD * thd,Item * arg1)7256 Create_func_upper::create(THD *thd, Item *arg1)
7257 {
7258   return new (thd->mem_root) Item_func_upper(POS(), arg1);
7259 }
7260 
7261 
7262 Create_func_uncompress Create_func_uncompress::s_singleton;
7263 
7264 Item*
create(THD * thd,Item * arg1)7265 Create_func_uncompress::create(THD *thd, Item *arg1)
7266 {
7267   return new (thd->mem_root) Item_func_uncompress(POS(), arg1);
7268 }
7269 
7270 
7271 Create_func_uncompressed_length Create_func_uncompressed_length::s_singleton;
7272 
7273 Item*
create(THD * thd,Item * arg1)7274 Create_func_uncompressed_length::create(THD *thd, Item *arg1)
7275 {
7276   return new (thd->mem_root) Item_func_uncompressed_length(POS(), arg1);
7277 }
7278 
7279 
7280 Create_func_unhex Create_func_unhex::s_singleton;
7281 
7282 Item*
create(THD * thd,Item * arg1)7283 Create_func_unhex::create(THD *thd, Item *arg1)
7284 {
7285   return new (thd->mem_root) Item_func_unhex(POS(), arg1);
7286 }
7287 
7288 
7289 Create_func_unix_timestamp Create_func_unix_timestamp::s_singleton;
7290 
7291 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)7292 Create_func_unix_timestamp::create_native(THD *thd, LEX_STRING name,
7293                                           PT_item_list *item_list)
7294 {
7295   Item *func= NULL;
7296   int arg_count= 0;
7297 
7298   if (item_list != NULL)
7299     arg_count= item_list->elements();
7300 
7301   switch (arg_count) {
7302   case 0:
7303   {
7304     func= new (thd->mem_root) Item_func_unix_timestamp(POS());
7305     break;
7306   }
7307   case 1:
7308   {
7309     Item *param_1= item_list->pop_front();
7310     func= new (thd->mem_root) Item_func_unix_timestamp(POS(), param_1);
7311     break;
7312   }
7313   default:
7314   {
7315     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
7316     break;
7317   }
7318   }
7319 
7320   return func;
7321 }
7322 
7323 
7324 Create_func_uuid Create_func_uuid::s_singleton;
7325 
7326 Item*
create(THD * thd)7327 Create_func_uuid::create(THD *thd)
7328 {
7329   return new (thd->mem_root) Item_func_uuid(POS());
7330 }
7331 
7332 
7333 Create_func_uuid_short Create_func_uuid_short::s_singleton;
7334 
7335 Item*
create(THD * thd)7336 Create_func_uuid_short::create(THD *thd)
7337 {
7338   return new (thd->mem_root) Item_func_uuid_short(POS());
7339 }
7340 
7341 
7342 Create_func_validate_password_strength
7343                      Create_func_validate_password_strength::s_singleton;
7344 
7345 Item*
create(THD * thd,Item * arg1)7346 Create_func_validate_password_strength::create(THD *thd, Item *arg1)
7347 {
7348   return new (thd->mem_root) Item_func_validate_password_strength(POS(),
7349                                                                   arg1);
7350 }
7351 
7352 
7353 Create_func_version Create_func_version::s_singleton;
7354 
7355 Item*
create(THD * thd)7356 Create_func_version::create(THD *thd)
7357 {
7358   return new (thd->mem_root) Item_func_version(POS());
7359 }
7360 
7361 
7362 Create_func_weekday Create_func_weekday::s_singleton;
7363 
7364 Item*
create(THD * thd,Item * arg1)7365 Create_func_weekday::create(THD *thd, Item *arg1)
7366 {
7367   return new (thd->mem_root) Item_func_weekday(POS(), arg1, 0);
7368 }
7369 
7370 
7371 Create_func_weekofyear Create_func_weekofyear::s_singleton;
7372 
7373 Item*
create(THD * thd,Item * arg1)7374 Create_func_weekofyear::create(THD *thd, Item *arg1)
7375 {
7376   Item *i1= new (thd->mem_root) Item_int(POS(), NAME_STRING("0"), 3, 1);
7377   return new (thd->mem_root) Item_func_week(POS(), arg1, i1);
7378 }
7379 
7380 
7381 Create_func_mbr_within Create_func_mbr_within::s_singleton;
7382 
7383 Item*
create(THD * thd,Item * arg1,Item * arg2)7384 Create_func_mbr_within::create(THD *thd, Item *arg1, Item *arg2)
7385 {
7386   return new (thd->mem_root) Item_func_spatial_mbr_rel(POS(), arg1, arg2,
7387                                Item_func::SP_WITHIN_FUNC);
7388 }
7389 
7390 
7391 Create_func_within Create_func_within::s_singleton;
7392 
7393 Item*
create(THD * thd,Item * arg1,Item * arg2)7394 Create_func_within::create(THD *thd, Item *arg1, Item *arg2)
7395 {
7396   return new (thd->mem_root) Item_func_spatial_rel(POS(), arg1, arg2,
7397                                                    Item_func::SP_WITHIN_FUNC);
7398 }
7399 
7400 
7401 Create_func_x Create_func_x::s_singleton;
7402 
7403 Item*
create(THD * thd,Item * arg1)7404 Create_func_x::create(THD *thd, Item *arg1)
7405 {
7406   return new (thd->mem_root) Item_func_x(POS(), arg1);
7407 }
7408 
7409 
7410 Create_func_xml_extractvalue Create_func_xml_extractvalue::s_singleton;
7411 
7412 Item*
create(THD * thd,Item * arg1,Item * arg2)7413 Create_func_xml_extractvalue::create(THD *thd, Item *arg1, Item *arg2)
7414 {
7415   return new (thd->mem_root) Item_func_xml_extractvalue(POS(), arg1,
7416                                                         arg2);
7417 }
7418 
7419 
7420 Create_func_xml_update Create_func_xml_update::s_singleton;
7421 
7422 Item*
create(THD * thd,Item * arg1,Item * arg2,Item * arg3)7423 Create_func_xml_update::create(THD *thd, Item *arg1, Item *arg2, Item *arg3)
7424 {
7425   return new (thd->mem_root) Item_func_xml_update(POS(), arg1, arg2,
7426                                                   arg3);
7427 }
7428 
7429 
7430 Create_func_y Create_func_y::s_singleton;
7431 
7432 Item*
create(THD * thd,Item * arg1)7433 Create_func_y::create(THD *thd, Item *arg1)
7434 {
7435   return new (thd->mem_root) Item_func_y(POS(), arg1);
7436 }
7437 
7438 
7439 Create_func_year_week Create_func_year_week::s_singleton;
7440 
7441 Item*
create_native(THD * thd,LEX_STRING name,PT_item_list * item_list)7442 Create_func_year_week::create_native(THD *thd, LEX_STRING name,
7443                                      PT_item_list *item_list)
7444 {
7445   Item *func= NULL;
7446   int arg_count= 0;
7447 
7448   if (item_list != NULL)
7449     arg_count= item_list->elements();
7450 
7451   switch (arg_count) {
7452   case 1:
7453   {
7454     Item *param_1= item_list->pop_front();
7455     Item *i0= new (thd->mem_root) Item_int_0(POS());
7456     func= new (thd->mem_root) Item_func_yearweek(POS(), param_1, i0);
7457     break;
7458   }
7459   case 2:
7460   {
7461     Item *param_1= item_list->pop_front();
7462     Item *param_2= item_list->pop_front();
7463     func= new (thd->mem_root) Item_func_yearweek(POS(), param_1, param_2);
7464     break;
7465   }
7466   default:
7467   {
7468     my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str);
7469     break;
7470   }
7471   }
7472 
7473   return func;
7474 }
7475 
7476 
7477 struct Native_func_registry
7478 {
7479   LEX_STRING name;
7480   Create_func *builder;
7481 };
7482 
7483 #define BUILDER(F) & F::s_singleton
7484 
7485 #define GEOM_BUILDER(F) & F::s_singleton
7486 
7487 /*
7488   MySQL native functions.
7489   MAINTAINER:
7490   - Keep sorted for human lookup. At runtime, a hash table is used.
7491   - do **NOT** conditionally (#ifdef, #ifndef) define a function *NAME*:
7492     doing so will cause user code that works against a --without-XYZ binary
7493     to fail with name collisions against a --with-XYZ binary.
7494     Use something similar to GEOM_BUILDER instead.
7495   - keep 1 line per entry, it makes grep | sort easier
7496 */
7497 
7498 static Native_func_registry func_array[] =
7499 {
7500   { { C_STRING_WITH_LEN("ABS") }, BUILDER(Create_func_abs)},
7501   { { C_STRING_WITH_LEN("ACOS") }, BUILDER(Create_func_acos)},
7502   { { C_STRING_WITH_LEN("ADDTIME") }, BUILDER(Create_func_addtime)},
7503   { { C_STRING_WITH_LEN("AES_DECRYPT") }, BUILDER(Create_func_aes_decrypt)},
7504   { { C_STRING_WITH_LEN("AES_ENCRYPT") }, BUILDER(Create_func_aes_encrypt)},
7505   { { C_STRING_WITH_LEN("ANY_VALUE") }, BUILDER(Create_func_any_value)},
7506   { { C_STRING_WITH_LEN("AREA") }, GEOM_BUILDER(Create_func_area_deprecated)},
7507   { { C_STRING_WITH_LEN("ASBINARY") }, GEOM_BUILDER(Create_func_as_binary_deprecated)},
7508   { { C_STRING_WITH_LEN("ASIN") }, BUILDER(Create_func_asin)},
7509   { { C_STRING_WITH_LEN("ASTEXT") }, GEOM_BUILDER(Create_func_as_text_deprecated)},
7510   { { C_STRING_WITH_LEN("ASWKB") }, GEOM_BUILDER(Create_func_as_wkb_deprecated)},
7511   { { C_STRING_WITH_LEN("ASWKT") }, GEOM_BUILDER(Create_func_as_wkt_deprecated)},
7512   { { C_STRING_WITH_LEN("ATAN") }, BUILDER(Create_func_atan)},
7513   { { C_STRING_WITH_LEN("ATAN2") }, BUILDER(Create_func_atan)},
7514   { { C_STRING_WITH_LEN("BENCHMARK") }, BUILDER(Create_func_benchmark)},
7515   { { C_STRING_WITH_LEN("BIN") }, BUILDER(Create_func_bin)},
7516   { { C_STRING_WITH_LEN("BIT_COUNT") }, BUILDER(Create_func_bit_count)},
7517   { { C_STRING_WITH_LEN("BUFFER") }, GEOM_BUILDER(Create_func_buffer_deprecated)},
7518   { { C_STRING_WITH_LEN("BIT_LENGTH") }, BUILDER(Create_func_bit_length)},
7519   { { C_STRING_WITH_LEN("CEIL") }, BUILDER(Create_func_ceiling)},
7520   { { C_STRING_WITH_LEN("CEILING") }, BUILDER(Create_func_ceiling)},
7521   { { C_STRING_WITH_LEN("CENTROID") }, GEOM_BUILDER(Create_func_centroid_deprecated)},
7522   { { C_STRING_WITH_LEN("CHARACTER_LENGTH") }, BUILDER(Create_func_char_length)},
7523   { { C_STRING_WITH_LEN("CHAR_LENGTH") }, BUILDER(Create_func_char_length)},
7524   { { C_STRING_WITH_LEN("COERCIBILITY") }, BUILDER(Create_func_coercibility)},
7525   { { C_STRING_WITH_LEN("COMPRESS") }, BUILDER(Create_func_compress)},
7526   { { C_STRING_WITH_LEN("CONCAT") }, BUILDER(Create_func_concat)},
7527   { { C_STRING_WITH_LEN("CONCAT_WS") }, BUILDER(Create_func_concat_ws)},
7528   { { C_STRING_WITH_LEN("CONNECTION_ID") }, BUILDER(Create_func_connection_id)},
7529   { { C_STRING_WITH_LEN("CONV") }, BUILDER(Create_func_conv)},
7530   { { C_STRING_WITH_LEN("CONVERT_TZ") }, BUILDER(Create_func_convert_tz)},
7531   { { C_STRING_WITH_LEN("CONVEXHULL") }, GEOM_BUILDER(Create_func_convex_hull_deprecated)},
7532   { { C_STRING_WITH_LEN("COS") }, BUILDER(Create_func_cos)},
7533   { { C_STRING_WITH_LEN("COT") }, BUILDER(Create_func_cot)},
7534   { { C_STRING_WITH_LEN("CRC32") }, BUILDER(Create_func_crc32)},
7535   { { C_STRING_WITH_LEN("CROSSES") }, GEOM_BUILDER(Create_func_crosses_deprecated)},
7536   { { C_STRING_WITH_LEN("DATEDIFF") }, BUILDER(Create_func_datediff)},
7537   { { C_STRING_WITH_LEN("DATE_FORMAT") }, BUILDER(Create_func_date_format)},
7538   { { C_STRING_WITH_LEN("DAYNAME") }, BUILDER(Create_func_dayname)},
7539   { { C_STRING_WITH_LEN("DAYOFMONTH") }, BUILDER(Create_func_dayofmonth)},
7540   { { C_STRING_WITH_LEN("DAYOFWEEK") }, BUILDER(Create_func_dayofweek)},
7541   { { C_STRING_WITH_LEN("DAYOFYEAR") }, BUILDER(Create_func_dayofyear)},
7542   { { C_STRING_WITH_LEN("DECODE") }, BUILDER(Create_func_decode)},
7543   { { C_STRING_WITH_LEN("DEGREES") }, BUILDER(Create_func_degrees)},
7544   { { C_STRING_WITH_LEN("DES_DECRYPT") }, BUILDER(Create_func_des_decrypt)},
7545   { { C_STRING_WITH_LEN("DES_ENCRYPT") }, BUILDER(Create_func_des_encrypt)},
7546   { { C_STRING_WITH_LEN("DIMENSION") }, GEOM_BUILDER(Create_func_dimension_deprecated)},
7547   { { C_STRING_WITH_LEN("DISJOINT") }, GEOM_BUILDER(Create_func_disjoint_deprecated)},
7548   { { C_STRING_WITH_LEN("DISTANCE") }, GEOM_BUILDER(Create_func_distance_deprecated)},
7549   { { C_STRING_WITH_LEN("ELT") }, BUILDER(Create_func_elt)},
7550   { { C_STRING_WITH_LEN("ENCODE") }, BUILDER(Create_func_encode)},
7551   { { C_STRING_WITH_LEN("ENCRYPT") }, BUILDER(Create_func_encrypt)},
7552   { { C_STRING_WITH_LEN("ENDPOINT") }, GEOM_BUILDER(Create_func_endpoint_deprecated)},
7553   { { C_STRING_WITH_LEN("ENVELOPE") }, GEOM_BUILDER(Create_func_envelope_deprecated)},
7554   { { C_STRING_WITH_LEN("EQUALS") }, GEOM_BUILDER(Create_func_equals_deprecated)},
7555   { { C_STRING_WITH_LEN("EXP") }, BUILDER(Create_func_exp)},
7556   { { C_STRING_WITH_LEN("EXPORT_SET") }, BUILDER(Create_func_export_set)},
7557   { { C_STRING_WITH_LEN("EXTERIORRING") }, GEOM_BUILDER(Create_func_exteriorring_deprecated)},
7558   { { C_STRING_WITH_LEN("EXTRACTVALUE") }, BUILDER(Create_func_xml_extractvalue)},
7559   { { C_STRING_WITH_LEN("FIELD") }, BUILDER(Create_func_field)},
7560   { { C_STRING_WITH_LEN("FIND_IN_SET") }, BUILDER(Create_func_find_in_set)},
7561   { { C_STRING_WITH_LEN("FLOOR") }, BUILDER(Create_func_floor)},
7562   { { C_STRING_WITH_LEN("FOUND_ROWS") }, BUILDER(Create_func_found_rows)},
7563   { { C_STRING_WITH_LEN("FROM_BASE64") }, BUILDER(Create_func_from_base64)},
7564   { { C_STRING_WITH_LEN("FROM_DAYS") }, BUILDER(Create_func_from_days)},
7565   { { C_STRING_WITH_LEN("FROM_UNIXTIME") }, BUILDER(Create_func_from_unixtime)},
7566   { { C_STRING_WITH_LEN("GEOMCOLLFROMTEXT") }, GEOM_BUILDER(Create_func_geomcollfromtext_deprecated)},
7567   { { C_STRING_WITH_LEN("GEOMCOLLFROMWKB") }, GEOM_BUILDER(Create_func_geomcollfromwkb_deprecated)},
7568   { { C_STRING_WITH_LEN("GEOMETRYCOLLECTIONFROMTEXT") }, GEOM_BUILDER(Create_func_geometrycollectionfromtext_deprecated)},
7569   { { C_STRING_WITH_LEN("GEOMETRYCOLLECTIONFROMWKB") }, GEOM_BUILDER(Create_func_geometrycollectionfromwkb_deprecated)},
7570   { { C_STRING_WITH_LEN("GEOMETRYFROMTEXT") }, GEOM_BUILDER(Create_func_geometryfromtext_deprecated)},
7571   { { C_STRING_WITH_LEN("GEOMETRYFROMWKB") }, GEOM_BUILDER(Create_func_geometryfromwkb_deprecated)},
7572   { { C_STRING_WITH_LEN("GEOMETRYN") }, GEOM_BUILDER(Create_func_geometryn_deprecated)},
7573   { { C_STRING_WITH_LEN("GEOMETRYTYPE") }, GEOM_BUILDER(Create_func_geometry_type_deprecated)},
7574   { { C_STRING_WITH_LEN("GEOMFROMTEXT") }, GEOM_BUILDER(Create_func_geomfromtext_deprecated)},
7575   { { C_STRING_WITH_LEN("GEOMFROMWKB") }, GEOM_BUILDER(Create_func_geomfromwkb_deprecated)},
7576   { { C_STRING_WITH_LEN("GET_LOCK") }, BUILDER(Create_func_get_lock)},
7577   { { C_STRING_WITH_LEN("GLENGTH") }, GEOM_BUILDER(Create_func_glength_deprecated)},
7578   { { C_STRING_WITH_LEN("GREATEST") }, BUILDER(Create_func_greatest)},
7579   { { C_STRING_WITH_LEN("GTID_SUBTRACT") }, BUILDER(Create_func_gtid_subtract) },
7580   { { C_STRING_WITH_LEN("GTID_SUBSET") }, BUILDER(Create_func_gtid_subset) },
7581   { { C_STRING_WITH_LEN("HEX") }, BUILDER(Create_func_hex)},
7582   { { C_STRING_WITH_LEN("IFNULL") }, BUILDER(Create_func_ifnull)},
7583   { { C_STRING_WITH_LEN("INET_ATON") }, BUILDER(Create_func_inet_aton)},
7584   { { C_STRING_WITH_LEN("INET_NTOA") }, BUILDER(Create_func_inet_ntoa)},
7585   { { C_STRING_WITH_LEN("INET6_ATON") }, BUILDER(Create_func_inet6_aton)},
7586   { { C_STRING_WITH_LEN("INET6_NTOA") }, BUILDER(Create_func_inet6_ntoa)},
7587   { { C_STRING_WITH_LEN("IS_IPV4") }, BUILDER(Create_func_is_ipv4)},
7588   { { C_STRING_WITH_LEN("IS_IPV6") }, BUILDER(Create_func_is_ipv6)},
7589   { { C_STRING_WITH_LEN("IS_IPV4_COMPAT") }, BUILDER(Create_func_is_ipv4_compat)},
7590   { { C_STRING_WITH_LEN("IS_IPV4_MAPPED") }, BUILDER(Create_func_is_ipv4_mapped)},
7591   { { C_STRING_WITH_LEN("INSTR") }, BUILDER(Create_func_instr)},
7592   { { C_STRING_WITH_LEN("INTERIORRINGN") }, GEOM_BUILDER(Create_func_interiorringn_deprecated)},
7593   { { C_STRING_WITH_LEN("INTERSECTS") }, GEOM_BUILDER(Create_func_intersects_deprecated)},
7594   { { C_STRING_WITH_LEN("ISCLOSED") }, GEOM_BUILDER(Create_func_isclosed_deprecated)},
7595   { { C_STRING_WITH_LEN("ISEMPTY") }, GEOM_BUILDER(Create_func_isempty_deprecated)},
7596   { { C_STRING_WITH_LEN("ISNULL") }, BUILDER(Create_func_isnull)},
7597   { { C_STRING_WITH_LEN("ISSIMPLE") }, GEOM_BUILDER(Create_func_issimple_deprecated)},
7598   { { C_STRING_WITH_LEN("JSON_VALID") }, BUILDER(Create_func_json_valid)},
7599   { { C_STRING_WITH_LEN("JSON_CONTAINS") }, BUILDER(Create_func_json_contains)},
7600   { { C_STRING_WITH_LEN("JSON_CONTAINS_PATH") }, BUILDER(Create_func_json_contains_path)},
7601   { { C_STRING_WITH_LEN("JSON_LENGTH") }, BUILDER(Create_func_json_length)},
7602   { { C_STRING_WITH_LEN("JSON_DEPTH") }, BUILDER(Create_func_json_depth)},
7603   { { C_STRING_WITH_LEN("JSON_PRETTY") }, BUILDER(Create_func_json_pretty)},
7604   { { C_STRING_WITH_LEN("JSON_TYPE") }, BUILDER(Create_func_json_type)},
7605   { { C_STRING_WITH_LEN("JSON_KEYS") }, BUILDER(Create_func_json_keys)},
7606   { { C_STRING_WITH_LEN("JSON_EXTRACT") }, BUILDER(Create_func_json_extract)},
7607   { { C_STRING_WITH_LEN("JSON_ARRAY_APPEND") }, BUILDER(Create_func_json_array_append)},
7608   { { C_STRING_WITH_LEN("JSON_INSERT") }, BUILDER(Create_func_json_insert)},
7609   { { C_STRING_WITH_LEN("JSON_ARRAY_INSERT") }, BUILDER(Create_func_json_array_insert)},
7610   { { C_STRING_WITH_LEN("JSON_OBJECT") }, BUILDER(Create_func_json_row_object)},
7611   { { C_STRING_WITH_LEN("JSON_SEARCH") }, BUILDER(Create_func_json_search)},
7612   { { C_STRING_WITH_LEN("JSON_SET") }, BUILDER(Create_func_json_set)},
7613   { { C_STRING_WITH_LEN("JSON_REPLACE") }, BUILDER(Create_func_json_replace)},
7614   { { C_STRING_WITH_LEN("JSON_ARRAY") }, BUILDER(Create_func_json_array)},
7615   { { C_STRING_WITH_LEN("JSON_REMOVE") }, BUILDER(Create_func_json_remove)},
7616   { { C_STRING_WITH_LEN("JSON_MERGE") }, BUILDER(Create_func_json_merge)},
7617   { { C_STRING_WITH_LEN("JSON_MERGE_PATCH") }, BUILDER(Create_func_json_merge_patch)},
7618   { { C_STRING_WITH_LEN("JSON_MERGE_PRESERVE") }, BUILDER(Create_func_json_merge_preserve)},
7619   { { C_STRING_WITH_LEN("JSON_QUOTE") }, BUILDER(Create_func_json_quote)},
7620   { { C_STRING_WITH_LEN("JSON_STORAGE_SIZE") }, BUILDER(Create_func_json_storage_size)},
7621   { { C_STRING_WITH_LEN("JSON_UNQUOTE") }, BUILDER(Create_func_json_unquote)},
7622   { { C_STRING_WITH_LEN("IS_FREE_LOCK") }, BUILDER(Create_func_is_free_lock)},
7623   { { C_STRING_WITH_LEN("IS_USED_LOCK") }, BUILDER(Create_func_is_used_lock)},
7624   { { C_STRING_WITH_LEN("LAST_DAY") }, BUILDER(Create_func_last_day)},
7625   { { C_STRING_WITH_LEN("LAST_INSERT_ID") }, BUILDER(Create_func_last_insert_id)},
7626   { { C_STRING_WITH_LEN("LCASE") }, BUILDER(Create_func_lower)},
7627   { { C_STRING_WITH_LEN("LEAST") }, BUILDER(Create_func_least)},
7628   { { C_STRING_WITH_LEN("LENGTH") }, BUILDER(Create_func_length)},
7629 #ifndef NDEBUG
7630   { { C_STRING_WITH_LEN("LIKE_RANGE_MIN") }, BUILDER(Create_func_like_range_min)},
7631   { { C_STRING_WITH_LEN("LIKE_RANGE_MAX") }, BUILDER(Create_func_like_range_max)},
7632 #endif
7633   { { C_STRING_WITH_LEN("LINEFROMTEXT") }, GEOM_BUILDER(Create_func_linefromtext_deprecated)},
7634   { { C_STRING_WITH_LEN("LINEFROMWKB") }, GEOM_BUILDER(Create_func_linefromwkb_deprecated)},
7635   { { C_STRING_WITH_LEN("LINESTRINGFROMTEXT") }, GEOM_BUILDER(Create_func_linestringfromtext_deprecated)},
7636   { { C_STRING_WITH_LEN("LINESTRINGFROMWKB") }, GEOM_BUILDER(Create_func_linestringfromwkb_deprecated)},
7637   { { C_STRING_WITH_LEN("LN") }, BUILDER(Create_func_ln)},
7638   { { C_STRING_WITH_LEN("LOAD_FILE") }, BUILDER(Create_func_load_file)},
7639   { { C_STRING_WITH_LEN("LOCATE") }, BUILDER(Create_func_locate)},
7640   { { C_STRING_WITH_LEN("LOG") }, BUILDER(Create_func_log)},
7641   { { C_STRING_WITH_LEN("LOG10") }, BUILDER(Create_func_log10)},
7642   { { C_STRING_WITH_LEN("LOG2") }, BUILDER(Create_func_log2)},
7643   { { C_STRING_WITH_LEN("LOWER") }, BUILDER(Create_func_lower)},
7644   { { C_STRING_WITH_LEN("LPAD") }, BUILDER(Create_func_lpad)},
7645   { { C_STRING_WITH_LEN("LTRIM") }, BUILDER(Create_func_ltrim)},
7646   { { C_STRING_WITH_LEN("MAKEDATE") }, BUILDER(Create_func_makedate)},
7647   { { C_STRING_WITH_LEN("MAKETIME") }, BUILDER(Create_func_maketime)},
7648   { { C_STRING_WITH_LEN("MAKE_SET") }, BUILDER(Create_func_make_set)},
7649   { { C_STRING_WITH_LEN("MASTER_POS_WAIT") }, BUILDER(Create_func_master_pos_wait)},
7650   { { C_STRING_WITH_LEN("MBRCONTAINS") }, GEOM_BUILDER(Create_func_mbr_contains)},
7651   { { C_STRING_WITH_LEN("MBRCOVEREDBY") }, GEOM_BUILDER(Create_func_mbr_covered_by)},
7652   { { C_STRING_WITH_LEN("MBRCOVERS") }, GEOM_BUILDER(Create_func_mbr_covers)},
7653   { { C_STRING_WITH_LEN("MBRDISJOINT") }, GEOM_BUILDER(Create_func_mbr_disjoint)},
7654   { { C_STRING_WITH_LEN("MBREQUAL") }, GEOM_BUILDER(Create_func_mbr_equal_deprecated)},
7655   { { C_STRING_WITH_LEN("MBREQUALS") }, GEOM_BUILDER(Create_func_mbr_equals)},
7656   { { C_STRING_WITH_LEN("MBRINTERSECTS") }, GEOM_BUILDER(Create_func_mbr_intersects)},
7657   { { C_STRING_WITH_LEN("MBROVERLAPS") }, GEOM_BUILDER(Create_func_mbr_overlaps)},
7658   { { C_STRING_WITH_LEN("MBRTOUCHES") }, GEOM_BUILDER(Create_func_mbr_touches)},
7659   { { C_STRING_WITH_LEN("MBRWITHIN") }, GEOM_BUILDER(Create_func_mbr_within)},
7660   { { C_STRING_WITH_LEN("MD5") }, BUILDER(Create_func_md5)},
7661   { { C_STRING_WITH_LEN("MLINEFROMTEXT") }, GEOM_BUILDER(Create_func_mlinefromtext_deprecated)},
7662   { { C_STRING_WITH_LEN("MLINEFROMWKB") }, GEOM_BUILDER(Create_func_mlinefromwkb_deprecated)},
7663   { { C_STRING_WITH_LEN("MONTHNAME") }, BUILDER(Create_func_monthname)},
7664   { { C_STRING_WITH_LEN("MPOINTFROMTEXT") }, GEOM_BUILDER(Create_func_mpointfromtext_deprecated)},
7665   { { C_STRING_WITH_LEN("MPOINTFROMWKB") }, GEOM_BUILDER(Create_func_mpointfromwkb_deprecated)},
7666   { { C_STRING_WITH_LEN("MPOLYFROMTEXT") }, GEOM_BUILDER(Create_func_mpolyfromtext_deprecated)},
7667   { { C_STRING_WITH_LEN("MPOLYFROMWKB") }, GEOM_BUILDER(Create_func_mpolyfromwkb_deprecated)},
7668   { { C_STRING_WITH_LEN("MULTILINESTRINGFROMTEXT") }, GEOM_BUILDER(Create_func_multilinestringfromtext_deprecated)},
7669   { { C_STRING_WITH_LEN("MULTILINESTRINGFROMWKB") }, GEOM_BUILDER(Create_func_multilinestringfromwkb_deprecated)},
7670   { { C_STRING_WITH_LEN("MULTIPOINTFROMTEXT") }, GEOM_BUILDER(Create_func_multipointfromtext_deprecated)},
7671   { { C_STRING_WITH_LEN("MULTIPOINTFROMWKB") }, GEOM_BUILDER(Create_func_multipointfromwkb_deprecated)},
7672   { { C_STRING_WITH_LEN("MULTIPOLYGONFROMTEXT") }, GEOM_BUILDER(Create_func_multipolygonfromtext_deprecated)},
7673   { { C_STRING_WITH_LEN("MULTIPOLYGONFROMWKB") }, GEOM_BUILDER(Create_func_multipolygonfromwkb_deprecated)},
7674   { { C_STRING_WITH_LEN("NAME_CONST") }, BUILDER(Create_func_name_const)},
7675   { { C_STRING_WITH_LEN("NULLIF") }, BUILDER(Create_func_nullif)},
7676   { { C_STRING_WITH_LEN("NUMGEOMETRIES") }, GEOM_BUILDER(Create_func_numgeometries_deprecated)},
7677   { { C_STRING_WITH_LEN("NUMINTERIORRINGS") }, GEOM_BUILDER(Create_func_numinteriorring_deprecated)},
7678   { { C_STRING_WITH_LEN("NUMPOINTS") }, GEOM_BUILDER(Create_func_numpoints_deprecated)},
7679   { { C_STRING_WITH_LEN("OCT") }, BUILDER(Create_func_oct)},
7680   { { C_STRING_WITH_LEN("OCTET_LENGTH") }, BUILDER(Create_func_length)},
7681   { { C_STRING_WITH_LEN("ORD") }, BUILDER(Create_func_ord)},
7682   { { C_STRING_WITH_LEN("OVERLAPS") }, GEOM_BUILDER(Create_func_mbr_overlaps_deprecated)},
7683   { { C_STRING_WITH_LEN("PERIOD_ADD") }, BUILDER(Create_func_period_add)},
7684   { { C_STRING_WITH_LEN("PERIOD_DIFF") }, BUILDER(Create_func_period_diff)},
7685   { { C_STRING_WITH_LEN("PI") }, BUILDER(Create_func_pi)},
7686   { { C_STRING_WITH_LEN("POINTFROMTEXT") }, GEOM_BUILDER(Create_func_pointfromtext_deprecated)},
7687   { { C_STRING_WITH_LEN("POINTFROMWKB") }, GEOM_BUILDER(Create_func_pointfromwkb_deprecated)},
7688   { { C_STRING_WITH_LEN("POINTN") }, GEOM_BUILDER(Create_func_pointn_deprecated)},
7689   { { C_STRING_WITH_LEN("POLYFROMTEXT") }, GEOM_BUILDER(Create_func_polyfromtext_deprecated)},
7690   { { C_STRING_WITH_LEN("POLYFROMWKB") }, GEOM_BUILDER(Create_func_polyfromwkb_deprecated)},
7691   { { C_STRING_WITH_LEN("POLYGONFROMTEXT") }, GEOM_BUILDER(Create_func_polygonfromtext_deprecated)},
7692   { { C_STRING_WITH_LEN("POLYGONFROMWKB") }, GEOM_BUILDER(Create_func_polygonfromwkb_deprecated)},
7693   { { C_STRING_WITH_LEN("POW") }, BUILDER(Create_func_pow)},
7694   { { C_STRING_WITH_LEN("POWER") }, BUILDER(Create_func_pow)},
7695   { { C_STRING_WITH_LEN("QUOTE") }, BUILDER(Create_func_quote)},
7696   { { C_STRING_WITH_LEN("RADIANS") }, BUILDER(Create_func_radians)},
7697   { { C_STRING_WITH_LEN("RAND") }, BUILDER(Create_func_rand)},
7698   { { C_STRING_WITH_LEN("RANDOM_BYTES") }, BUILDER(Create_func_random_bytes) },
7699   { { C_STRING_WITH_LEN("RELEASE_ALL_LOCKS") }, BUILDER(Create_func_release_all_locks) },
7700   { { C_STRING_WITH_LEN("RELEASE_LOCK") }, BUILDER(Create_func_release_lock) },
7701   { { C_STRING_WITH_LEN("REVERSE") }, BUILDER(Create_func_reverse)},
7702   { { C_STRING_WITH_LEN("ROUND") }, BUILDER(Create_func_round)},
7703   { { C_STRING_WITH_LEN("RPAD") }, BUILDER(Create_func_rpad)},
7704   { { C_STRING_WITH_LEN("RTRIM") }, BUILDER(Create_func_rtrim)},
7705   { { C_STRING_WITH_LEN("SEC_TO_TIME") }, BUILDER(Create_func_sec_to_time)},
7706   { { C_STRING_WITH_LEN("SHA") }, BUILDER(Create_func_sha)},
7707   { { C_STRING_WITH_LEN("SHA1") }, BUILDER(Create_func_sha)},
7708   { { C_STRING_WITH_LEN("SHA2") }, BUILDER(Create_func_sha2)},
7709   { { C_STRING_WITH_LEN("SIGN") }, BUILDER(Create_func_sign)},
7710   { { C_STRING_WITH_LEN("SIN") }, BUILDER(Create_func_sin)},
7711   { { C_STRING_WITH_LEN("SLEEP") }, BUILDER(Create_func_sleep)},
7712   { { C_STRING_WITH_LEN("SOUNDEX") }, BUILDER(Create_func_soundex)},
7713   { { C_STRING_WITH_LEN("SPACE") }, BUILDER(Create_func_space)},
7714   { { C_STRING_WITH_LEN("WAIT_FOR_EXECUTED_GTID_SET") }, BUILDER(Create_func_executed_gtid_set_wait)},
7715   { { C_STRING_WITH_LEN("WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS") }, BUILDER(Create_func_master_gtid_set_wait)},
7716   { { C_STRING_WITH_LEN("SQRT") }, BUILDER(Create_func_sqrt)},
7717   { { C_STRING_WITH_LEN("SRID") }, GEOM_BUILDER(Create_func_srid_deprecated)},
7718   { { C_STRING_WITH_LEN("STARTPOINT") }, GEOM_BUILDER(Create_func_startpoint_deprecated)},
7719   { { C_STRING_WITH_LEN("STRCMP") }, BUILDER(Create_func_strcmp)},
7720   { { C_STRING_WITH_LEN("STR_TO_DATE") }, BUILDER(Create_func_str_to_date)},
7721   { { C_STRING_WITH_LEN("ST_AREA") }, GEOM_BUILDER(Create_func_area)},
7722   { { C_STRING_WITH_LEN("ST_ASBINARY") }, GEOM_BUILDER(Create_func_as_wkb)},
7723   { { C_STRING_WITH_LEN("ST_ASGEOJSON") }, GEOM_BUILDER(Create_func_as_geojson)},
7724   { { C_STRING_WITH_LEN("ST_ASTEXT") }, GEOM_BUILDER(Create_func_as_wkt)},
7725   { { C_STRING_WITH_LEN("ST_ASWKB") }, GEOM_BUILDER(Create_func_as_wkb)},
7726   { { C_STRING_WITH_LEN("ST_ASWKT") }, GEOM_BUILDER(Create_func_as_wkt)},
7727   { { C_STRING_WITH_LEN("ST_BUFFER") }, GEOM_BUILDER(Create_func_buffer)},
7728   { { C_STRING_WITH_LEN("ST_BUFFER_STRATEGY") }, GEOM_BUILDER(Create_func_buffer_strategy)},
7729   { { C_STRING_WITH_LEN("ST_CENTROID") }, GEOM_BUILDER(Create_func_centroid)},
7730   { { C_STRING_WITH_LEN("ST_CONTAINS") }, GEOM_BUILDER(Create_func_contains)},
7731   { { C_STRING_WITH_LEN("ST_CONVEXHULL") }, GEOM_BUILDER(Create_func_convex_hull)},
7732   { { C_STRING_WITH_LEN("ST_CROSSES") }, GEOM_BUILDER(Create_func_crosses)},
7733   { { C_STRING_WITH_LEN("ST_DIFFERENCE") }, GEOM_BUILDER(Create_func_difference)},
7734   { { C_STRING_WITH_LEN("ST_DIMENSION") }, GEOM_BUILDER(Create_func_dimension)},
7735   { { C_STRING_WITH_LEN("ST_DISJOINT") }, GEOM_BUILDER(Create_func_disjoint)},
7736   { { C_STRING_WITH_LEN("ST_DISTANCE") }, GEOM_BUILDER(Create_func_distance)},
7737   { { C_STRING_WITH_LEN("ST_DISTANCE_SPHERE") }, GEOM_BUILDER(Create_func_distance_sphere)},
7738   { { C_STRING_WITH_LEN("ST_ENDPOINT") }, GEOM_BUILDER(Create_func_endpoint)},
7739   { { C_STRING_WITH_LEN("ST_ENVELOPE") }, GEOM_BUILDER(Create_func_envelope)},
7740   { { C_STRING_WITH_LEN("ST_EQUALS") }, GEOM_BUILDER(Create_func_equals)},
7741   { { C_STRING_WITH_LEN("ST_EXTERIORRING") }, GEOM_BUILDER(Create_func_exteriorring)},
7742   { { C_STRING_WITH_LEN("ST_GEOHASH") }, GEOM_BUILDER(Create_func_geohash)},
7743   { { C_STRING_WITH_LEN("ST_GEOMCOLLFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
7744   { { C_STRING_WITH_LEN("ST_GEOMCOLLFROMTXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
7745   { { C_STRING_WITH_LEN("ST_GEOMCOLLFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
7746   { { C_STRING_WITH_LEN("ST_GEOMETRYCOLLECTIONFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
7747   { { C_STRING_WITH_LEN("ST_GEOMETRYCOLLECTIONFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
7748   { { C_STRING_WITH_LEN("ST_GEOMETRYFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
7749   { { C_STRING_WITH_LEN("ST_GEOMETRYFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
7750   { { C_STRING_WITH_LEN("ST_GEOMETRYN") }, GEOM_BUILDER(Create_func_geometryn)},
7751   { { C_STRING_WITH_LEN("ST_GEOMETRYTYPE") }, GEOM_BUILDER(Create_func_geometry_type)},
7752   { { C_STRING_WITH_LEN("ST_GEOMFROMGEOJSON") }, GEOM_BUILDER(Create_func_geomfromgeojson)},
7753   { { C_STRING_WITH_LEN("ST_GEOMFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
7754   { { C_STRING_WITH_LEN("ST_GEOMFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
7755   { { C_STRING_WITH_LEN("ST_INTERIORRINGN") }, GEOM_BUILDER(Create_func_interiorringn)},
7756   { { C_STRING_WITH_LEN("ST_INTERSECTS") }, GEOM_BUILDER(Create_func_intersects)},
7757   { { C_STRING_WITH_LEN("ST_INTERSECTION") }, GEOM_BUILDER(Create_func_intersection)},
7758   { { C_STRING_WITH_LEN("ST_ISCLOSED") }, GEOM_BUILDER(Create_func_isclosed)},
7759   { { C_STRING_WITH_LEN("ST_ISEMPTY") }, GEOM_BUILDER(Create_func_isempty)},
7760   { { C_STRING_WITH_LEN("ST_ISSIMPLE") }, GEOM_BUILDER(Create_func_issimple)},
7761   { { C_STRING_WITH_LEN("ST_ISVALID") }, GEOM_BUILDER(Create_func_isvalid)},
7762   { { C_STRING_WITH_LEN("ST_LATFROMGEOHASH") }, GEOM_BUILDER(Create_func_latfromgeohash)},
7763   { { C_STRING_WITH_LEN("ST_LENGTH") }, GEOM_BUILDER(Create_func_glength)},
7764   { { C_STRING_WITH_LEN("ST_LINEFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
7765   { { C_STRING_WITH_LEN("ST_LINEFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
7766   { { C_STRING_WITH_LEN("ST_LINESTRINGFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
7767   { { C_STRING_WITH_LEN("ST_LINESTRINGFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
7768   { { C_STRING_WITH_LEN("ST_LONGFROMGEOHASH") }, GEOM_BUILDER(Create_func_longfromgeohash)},
7769   { { C_STRING_WITH_LEN("ST_MAKEENVELOPE") }, GEOM_BUILDER(Create_func_make_envelope)},
7770   { { C_STRING_WITH_LEN("ST_MLINEFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
7771   { { C_STRING_WITH_LEN("ST_MLINEFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
7772   { { C_STRING_WITH_LEN("ST_MPOINTFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
7773   { { C_STRING_WITH_LEN("ST_MPOINTFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
7774   { { C_STRING_WITH_LEN("ST_MPOLYFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
7775   { { C_STRING_WITH_LEN("ST_MPOLYFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
7776   { { C_STRING_WITH_LEN("ST_MULTILINESTRINGFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
7777   { { C_STRING_WITH_LEN("ST_MULTILINESTRINGFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
7778   { { C_STRING_WITH_LEN("ST_MULTIPOINTFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
7779   { { C_STRING_WITH_LEN("ST_MULTIPOINTFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
7780   { { C_STRING_WITH_LEN("ST_MULTIPOLYGONFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
7781   { { C_STRING_WITH_LEN("ST_MULTIPOLYGONFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
7782   { { C_STRING_WITH_LEN("ST_NUMGEOMETRIES") }, GEOM_BUILDER(Create_func_numgeometries)},
7783   { { C_STRING_WITH_LEN("ST_NUMINTERIORRING") }, GEOM_BUILDER(Create_func_numinteriorring)},
7784   { { C_STRING_WITH_LEN("ST_NUMINTERIORRINGS") }, GEOM_BUILDER(Create_func_numinteriorring)},
7785   { { C_STRING_WITH_LEN("ST_NUMPOINTS") }, GEOM_BUILDER(Create_func_numpoints)},
7786   { { C_STRING_WITH_LEN("ST_OVERLAPS") }, GEOM_BUILDER(Create_func_overlaps)},
7787   { { C_STRING_WITH_LEN("ST_POINTFROMGEOHASH") }, GEOM_BUILDER(Create_func_pointfromgeohash)},
7788   { { C_STRING_WITH_LEN("ST_POINTFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
7789   { { C_STRING_WITH_LEN("ST_POINTFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
7790   { { C_STRING_WITH_LEN("ST_POINTN") }, GEOM_BUILDER(Create_func_pointn)},
7791   { { C_STRING_WITH_LEN("ST_POLYFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
7792   { { C_STRING_WITH_LEN("ST_POLYFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
7793   { { C_STRING_WITH_LEN("ST_POLYGONFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)},
7794   { { C_STRING_WITH_LEN("ST_POLYGONFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)},
7795   { { C_STRING_WITH_LEN("ST_SIMPLIFY") }, GEOM_BUILDER(Create_func_simplify)},
7796   { { C_STRING_WITH_LEN("ST_SRID") }, GEOM_BUILDER(Create_func_srid)},
7797   { { C_STRING_WITH_LEN("ST_STARTPOINT") }, GEOM_BUILDER(Create_func_startpoint)},
7798   { { C_STRING_WITH_LEN("ST_SYMDIFFERENCE") }, GEOM_BUILDER(Create_func_symdifference)},
7799   { { C_STRING_WITH_LEN("ST_TOUCHES") }, GEOM_BUILDER(Create_func_touches)},
7800   { { C_STRING_WITH_LEN("ST_UNION") }, GEOM_BUILDER(Create_func_union)},
7801   { { C_STRING_WITH_LEN("ST_VALIDATE") }, GEOM_BUILDER(Create_func_validate)},
7802   { { C_STRING_WITH_LEN("ST_WITHIN") }, GEOM_BUILDER(Create_func_within)},
7803   { { C_STRING_WITH_LEN("ST_X") }, GEOM_BUILDER(Create_func_x)},
7804   { { C_STRING_WITH_LEN("ST_Y") }, GEOM_BUILDER(Create_func_y)},
7805   { { C_STRING_WITH_LEN("SUBSTRING_INDEX") }, BUILDER(Create_func_substr_index)},
7806   { { C_STRING_WITH_LEN("SUBTIME") }, BUILDER(Create_func_subtime)},
7807   { { C_STRING_WITH_LEN("TAN") }, BUILDER(Create_func_tan)},
7808   { { C_STRING_WITH_LEN("TIMEDIFF") }, BUILDER(Create_func_timediff)},
7809   { { C_STRING_WITH_LEN("TIME_FORMAT") }, BUILDER(Create_func_time_format)},
7810   { { C_STRING_WITH_LEN("TIME_TO_SEC") }, BUILDER(Create_func_time_to_sec)},
7811   { { C_STRING_WITH_LEN("TOUCHES") }, GEOM_BUILDER(Create_func_touches_deprecated)},
7812   { { C_STRING_WITH_LEN("TO_BASE64") }, BUILDER(Create_func_to_base64)},
7813   { { C_STRING_WITH_LEN("TO_DAYS") }, BUILDER(Create_func_to_days)},
7814   { { C_STRING_WITH_LEN("TO_SECONDS") }, BUILDER(Create_func_to_seconds)},
7815   { { C_STRING_WITH_LEN("UCASE") }, BUILDER(Create_func_upper)},
7816   { { C_STRING_WITH_LEN("UNCOMPRESS") }, BUILDER(Create_func_uncompress)},
7817   { { C_STRING_WITH_LEN("UNCOMPRESSED_LENGTH") }, BUILDER(Create_func_uncompressed_length)},
7818   { { C_STRING_WITH_LEN("UNHEX") }, BUILDER(Create_func_unhex)},
7819   { { C_STRING_WITH_LEN("UNIX_TIMESTAMP") }, BUILDER(Create_func_unix_timestamp)},
7820   { { C_STRING_WITH_LEN("UPDATEXML") }, BUILDER(Create_func_xml_update)},
7821   { { C_STRING_WITH_LEN("UPPER") }, BUILDER(Create_func_upper)},
7822   { { C_STRING_WITH_LEN("UUID") }, BUILDER(Create_func_uuid)},
7823   { { C_STRING_WITH_LEN("UUID_SHORT") }, BUILDER(Create_func_uuid_short)},
7824   { { C_STRING_WITH_LEN("VALIDATE_PASSWORD_STRENGTH") }, BUILDER(Create_func_validate_password_strength)},
7825   { { C_STRING_WITH_LEN("VERSION") }, BUILDER(Create_func_version)},
7826   { { C_STRING_WITH_LEN("WEEKDAY") }, BUILDER(Create_func_weekday)},
7827   { { C_STRING_WITH_LEN("WEEKOFYEAR") }, BUILDER(Create_func_weekofyear)},
7828   { { C_STRING_WITH_LEN("WITHIN") }, GEOM_BUILDER(Create_func_within_deprecated)},
7829   { { C_STRING_WITH_LEN("X") }, GEOM_BUILDER(Create_func_x_deprecated)},
7830   { { C_STRING_WITH_LEN("Y") }, GEOM_BUILDER(Create_func_y_deprecated)},
7831   { { C_STRING_WITH_LEN("YEARWEEK") }, BUILDER(Create_func_year_week)},
7832 
7833   { {0, 0}, NULL}
7834 };
7835 
7836 static HASH native_functions_hash;
7837 
7838 extern "C" uchar*
get_native_fct_hash_key(const uchar * buff,size_t * length,my_bool)7839 get_native_fct_hash_key(const uchar *buff, size_t *length,
7840                         my_bool /* unused */)
7841 {
7842   Native_func_registry *func= (Native_func_registry*) buff;
7843   *length= func->name.length;
7844   return (uchar*) func->name.str;
7845 }
7846 
7847 /*
7848   Load the hash table for native functions.
7849   Note: this code is not thread safe, and is intended to be used at server
7850   startup only (before going multi-threaded)
7851 */
7852 
item_create_init()7853 int item_create_init()
7854 {
7855   Native_func_registry *func;
7856 
7857   DBUG_ENTER("item_create_init");
7858 
7859   if (my_hash_init(& native_functions_hash,
7860                    system_charset_info,
7861                    array_elements(func_array),
7862                    0,
7863                    0,
7864                    (my_hash_get_key) get_native_fct_hash_key,
7865                    NULL,                          /* Nothing to free */
7866                    MYF(0),
7867                    key_memory_native_functions))
7868     DBUG_RETURN(1);
7869 
7870   for (func= func_array; func->builder != NULL; func++)
7871   {
7872     if (my_hash_insert(& native_functions_hash, (uchar*) func))
7873       DBUG_RETURN(1);
7874   }
7875 
7876 #ifndef NDEBUG
7877   for (uint i=0 ; i < native_functions_hash.records ; i++)
7878   {
7879     func= (Native_func_registry*) my_hash_element(& native_functions_hash, i);
7880     DBUG_PRINT("info", ("native function: %s  length: %u",
7881                         func->name.str, (uint) func->name.length));
7882   }
7883 #endif
7884 
7885   DBUG_RETURN(0);
7886 }
7887 
7888 /*
7889   Empty the hash table for native functions.
7890   Note: this code is not thread safe, and is intended to be used at server
7891   shutdown only (after thread requests have been executed).
7892 */
7893 
item_create_cleanup()7894 void item_create_cleanup()
7895 {
7896   DBUG_ENTER("item_create_cleanup");
7897   my_hash_free(& native_functions_hash);
7898   DBUG_VOID_RETURN;
7899 }
7900 
7901 Create_func *
find_native_function_builder(THD * thd,LEX_STRING name)7902 find_native_function_builder(THD *thd, LEX_STRING name)
7903 {
7904   Native_func_registry *func;
7905   Create_func *builder= NULL;
7906 
7907   /* Thread safe */
7908   func= (Native_func_registry*) my_hash_search(& native_functions_hash,
7909                                                (uchar*) name.str,
7910                                                name.length);
7911 
7912   if (func)
7913   {
7914     builder= func->builder;
7915   }
7916 
7917   return builder;
7918 }
7919 
7920 Create_qfunc *
find_qualified_function_builder(THD * thd)7921 find_qualified_function_builder(THD *thd)
7922 {
7923   return & Create_sp_func::s_singleton;
7924 }
7925 
7926 
7927 Item *
create_func_cast(THD * thd,const POS & pos,Item * a,Cast_target cast_target,const CHARSET_INFO * cs)7928 create_func_cast(THD *thd, const POS &pos, Item *a, Cast_target cast_target,
7929                  const CHARSET_INFO *cs)
7930 {
7931   Cast_type type;
7932   type.target= cast_target;
7933   type.charset= cs;
7934   type.type_flags= 0;
7935   type.length= NULL;
7936   type.dec= NULL;
7937   return create_func_cast(thd, pos, a, &type);
7938 }
7939 
7940 
7941 Item *
create_func_cast(THD * thd,const POS & pos,Item * a,const Cast_type * type)7942 create_func_cast(THD *thd, const POS &pos, Item *a, const Cast_type *type)
7943 {
7944   if (a == NULL)
7945     return NULL; // earlier syntax error detected
7946 
7947   const Cast_target cast_type= type->target;
7948   const char *c_len= type->length;
7949   const char *c_dec= type->dec;
7950 
7951   Item *res= NULL;
7952 
7953   switch (cast_type) {
7954   case ITEM_CAST_BINARY:
7955     res= new (thd->mem_root) Item_func_binary(pos, a);
7956     break;
7957   case ITEM_CAST_SIGNED_INT:
7958     res= new (thd->mem_root) Item_func_signed(pos, a);
7959     break;
7960   case ITEM_CAST_UNSIGNED_INT:
7961     res= new (thd->mem_root) Item_func_unsigned(pos, a);
7962     break;
7963   case ITEM_CAST_DATE:
7964     res= new (thd->mem_root) Item_date_typecast(pos, a);
7965     break;
7966   case ITEM_CAST_TIME:
7967   case ITEM_CAST_DATETIME:
7968   {
7969     uint dec= c_dec ? strtoul(c_dec, NULL, 10) : 0;
7970     if (dec > DATETIME_MAX_DECIMALS)
7971     {
7972       my_error(ER_TOO_BIG_PRECISION, MYF(0),
7973                (int) dec, "CAST", DATETIME_MAX_DECIMALS);
7974       return 0;
7975     }
7976     res= (cast_type == ITEM_CAST_TIME) ?
7977          (Item*) new (thd->mem_root) Item_time_typecast(pos, a, dec) :
7978          (Item*) new (thd->mem_root) Item_datetime_typecast(pos, a, dec);
7979     break;
7980   }
7981   case ITEM_CAST_DECIMAL:
7982   {
7983     ulong len= 0;
7984     uint dec= 0;
7985 
7986     if (c_len)
7987     {
7988       ulong decoded_size;
7989       errno= 0;
7990       decoded_size= strtoul(c_len, NULL, 10);
7991       if (errno != 0)
7992       {
7993         StringBuffer<192> buff(pos.cpp.start, pos.cpp.length(),
7994                                system_charset_info);
7995         my_error(ER_TOO_BIG_PRECISION, MYF(0), INT_MAX, buff.c_ptr_safe(),
7996                  static_cast<ulong>(DECIMAL_MAX_PRECISION));
7997         return NULL;
7998       }
7999       len= decoded_size;
8000     }
8001 
8002     if (c_dec)
8003     {
8004       ulong decoded_size;
8005       errno= 0;
8006       decoded_size= strtoul(c_dec, NULL, 10);
8007       if ((errno != 0) || (decoded_size > UINT_MAX))
8008       {
8009         StringBuffer<192> buff(pos.cpp.start, pos.cpp.length(),
8010                                system_charset_info);
8011         my_error(ER_TOO_BIG_SCALE, MYF(0), INT_MAX, buff.c_ptr_safe(),
8012                  static_cast<ulong>(DECIMAL_MAX_SCALE));
8013         return NULL;
8014       }
8015       dec= decoded_size;
8016     }
8017     my_decimal_trim(&len, &dec);
8018     if (len < dec)
8019     {
8020       my_error(ER_M_BIGGER_THAN_D, MYF(0), "");
8021       return 0;
8022     }
8023     if (len > DECIMAL_MAX_PRECISION)
8024     {
8025       StringBuffer<192> buff(pos.cpp.start, pos.cpp.length(),
8026                              system_charset_info);
8027       my_error(ER_TOO_BIG_PRECISION, MYF(0), static_cast<int>(len),
8028                buff.c_ptr_safe(), static_cast<ulong>(DECIMAL_MAX_PRECISION));
8029       return 0;
8030     }
8031     if (dec > DECIMAL_MAX_SCALE)
8032     {
8033       StringBuffer<192> buff(pos.cpp.start, pos.cpp.length(),
8034                              system_charset_info);
8035       my_error(ER_TOO_BIG_SCALE, MYF(0), dec, buff.c_ptr_safe(),
8036                static_cast<ulong>(DECIMAL_MAX_SCALE));
8037       return 0;
8038     }
8039     res= new (thd->mem_root) Item_decimal_typecast(pos, a, len, dec);
8040     break;
8041   }
8042   case ITEM_CAST_CHAR:
8043   {
8044     int len= -1;
8045     const CHARSET_INFO *cs= type->charset;
8046     const CHARSET_INFO *real_cs=
8047       (cs ? cs : thd->variables.collation_connection);
8048     if (c_len)
8049     {
8050       ulong decoded_size;
8051       errno= 0;
8052       decoded_size= strtoul(c_len, NULL, 10);
8053       if ((errno != 0) || (decoded_size > MAX_FIELD_BLOBLENGTH))
8054       {
8055         my_error(ER_TOO_BIG_DISPLAYWIDTH, MYF(0), "cast as char", MAX_FIELD_BLOBLENGTH);
8056         return NULL;
8057       }
8058       len= (int) decoded_size;
8059     }
8060     res= new (thd->mem_root) Item_char_typecast(POS(), a, len, real_cs);
8061     break;
8062   }
8063   case ITEM_CAST_JSON:
8064   {
8065     res= new (thd->mem_root) Item_json_typecast(thd, pos, a);
8066 
8067     break;
8068   }
8069   default:
8070   {
8071     assert(0);
8072     res= 0;
8073     break;
8074   }
8075   }
8076   return res;
8077 }
8078 
8079 
8080 /**
8081   Builder for datetime literals:
8082     TIME'00:00:00', DATE'2001-01-01', TIMESTAMP'2001-01-01 00:00:00'.
8083   @param thd          The current thread
8084   @param str          Character literal
8085   @param length       Length of str
8086   @param type         Type of literal (TIME, DATE or DATETIME)
8087   @param send_error   Whether to generate an error on failure
8088 */
8089 
create_temporal_literal(THD * thd,const char * str,size_t length,const CHARSET_INFO * cs,enum_field_types type,bool send_error)8090 Item *create_temporal_literal(THD *thd,
8091                               const char *str, size_t length,
8092                               const CHARSET_INFO *cs,
8093                               enum_field_types type, bool send_error)
8094 {
8095   MYSQL_TIME_STATUS status;
8096   MYSQL_TIME ltime;
8097   Item *item= NULL;
8098   my_time_flags_t flags= TIME_FUZZY_DATE;
8099   if (thd->variables.sql_mode & MODE_NO_ZERO_IN_DATE)
8100     flags|= TIME_NO_ZERO_IN_DATE;
8101   if (thd->variables.sql_mode & MODE_NO_ZERO_DATE)
8102     flags|= TIME_NO_ZERO_DATE;
8103 
8104   if (thd->variables.sql_mode & MODE_INVALID_DATES)
8105     flags|= TIME_INVALID_DATES;
8106 
8107   switch(type)
8108   {
8109   case MYSQL_TYPE_DATE:
8110   case MYSQL_TYPE_NEWDATE:
8111     if (!str_to_datetime(cs, str, length, &ltime, flags, &status) &&
8112         ltime.time_type == MYSQL_TIMESTAMP_DATE && !status.warnings)
8113       item= new (thd->mem_root) Item_date_literal(&ltime);
8114     break;
8115   case MYSQL_TYPE_DATETIME:
8116     if (!str_to_datetime(cs, str, length, &ltime, flags, &status) &&
8117         ltime.time_type == MYSQL_TIMESTAMP_DATETIME && !status.warnings)
8118       item= new (thd->mem_root) Item_datetime_literal(&ltime,
8119                                                       status.fractional_digits);
8120     break;
8121   case MYSQL_TYPE_TIME:
8122     if (!str_to_time(cs, str, length, &ltime, 0, &status) &&
8123         ltime.time_type == MYSQL_TIMESTAMP_TIME && !status.warnings)
8124       item= new (thd->mem_root) Item_time_literal(&ltime,
8125                                                   status.fractional_digits);
8126     break;
8127   default:
8128     assert(0);
8129   }
8130 
8131   if (item)
8132     return item;
8133 
8134   if (send_error)
8135   {
8136     const char *typestr=
8137       (type == MYSQL_TYPE_DATE) ? "DATE" :
8138       (type == MYSQL_TYPE_TIME) ? "TIME" : "DATETIME";
8139     ErrConvString err(str, length, thd->variables.character_set_client);
8140     my_error(ER_WRONG_VALUE, MYF(0), typestr, err.ptr());
8141   }
8142   return NULL;
8143 }
8144