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