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