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)