MySQL 9.1.0
Source Code Documentation
item_func.h
Go to the documentation of this file.
1#ifndef ITEM_FUNC_INCLUDED
2#define ITEM_FUNC_INCLUDED
3
4/* Copyright (c) 2000, 2024, Oracle and/or its affiliates.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License, version 2.0,
8 as published by the Free Software Foundation.
9
10 This program is designed to work with certain software (including
11 but not limited to OpenSSL) that is licensed under separate terms,
12 as designated in a particular file or component or in included license
13 documentation. The authors of MySQL hereby grant you an additional
14 permission to link the program and your derivative works with the
15 separately licensed software that they have either included with
16 the program or referenced in the documentation.
17
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License, version 2.0, for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
26
27#include <sys/types.h>
28
29#include <climits>
30#include <cmath> // isfinite
31#include <cstddef>
32#include <functional>
33
34#include "decimal.h"
35#include "field_types.h"
36#include "ft_global.h"
37#include "lex_string.h"
38#include "my_alloc.h"
39#include "my_base.h"
40#include "my_compiler.h"
41#include "my_dbug.h"
42#include "my_inttypes.h"
44#include "my_table_map.h"
45#include "my_thread_local.h"
46#include "my_time.h"
50#include "mysql_time.h"
51#include "mysqld_error.h"
52#include "sql-common/my_decimal.h" // str2my_decimal
53#include "sql/enum_query_type.h"
54#include "sql/field.h"
55#include "sql/handler.h"
56#include "sql/item.h" // Item_result_field
57#include "sql/parse_location.h" // POS
58#include "sql/set_var.h" // enum_var_type
59#include "sql/sql_const.h"
60#include "sql/sql_udf.h" // udf_handler
61#include "sql/table.h"
62#include "sql/thr_malloc.h"
63#include "sql_string.h"
64#include "template_utils.h"
65
66class Json_wrapper;
67class PT_item_list;
68class Protocol;
69class Query_block;
70class THD;
71class sp_rcontext;
72struct MY_BITMAP;
73struct Parse_context;
74struct TYPELIB;
75
76template <class T>
77class List;
78
79/* Function items used by mysql */
80
81void unsupported_json_comparison(size_t arg_count, Item **args,
82 const char *msg);
83
84void report_conversion_error(const CHARSET_INFO *to_cs, const char *from,
85 size_t from_length, const CHARSET_INFO *from_cs);
86
87bool simplify_string_args(THD *thd, const DTCollation &c, Item **items,
88 uint nitems);
89
91 String *buffer);
92
93inline String *eval_string_arg(const CHARSET_INFO *to_cs, Item *arg,
94 String *buffer) {
95 if (my_charset_same(to_cs, arg->collation.collation))
96 return arg->val_str(buffer);
97 return eval_string_arg_noinline(to_cs, arg, buffer);
98}
99
101 protected:
102 /**
103 Array of pointers to arguments. If there are max 2 arguments, this array
104 is often just m_embedded_arguments; otherwise it's explicitly allocated in
105 the constructor.
106 */
108
109 private:
111
112 /// Allocates space for the given number of arguments, if needed. Uses
113 /// #m_embedded_arguments if it's big enough.
114 bool alloc_args(MEM_ROOT *mem_root, unsigned num_args) {
115 if (num_args <= array_elements(m_embedded_arguments)) {
117 } else {
118 args = mem_root->ArrayAlloc<Item *>(num_args);
119 if (args == nullptr) {
120 // OOM
121 arg_count = 0;
122 return true;
123 }
124 }
125 arg_count = num_args;
126 return false;
127 }
128
129 public:
130 uint arg_count; ///< How many arguments in 'args'
131 virtual uint argument_count() const { return arg_count; }
132 inline Item **arguments() const {
133 return (argument_count() > 0) ? args : nullptr;
134 }
135 /*
136 This function is used to provide a unique textual name for the specific
137 subclass of Item_func. E.g, it returns "+" for the arithmetic addition
138 operator, "abs" for the absolute value function, "avg" for the average
139 aggregate function, etc. The function value is currently used to distinguish
140 Item_func subclasses from each other in Item_func::eq(),
141 since Item_func::functype() is not implemented for every subclass.
142 In addition, the function value is used when printing a textual
143 representation of a function reference, which is used within the dictionary
144 implementation and when printing SQL text for explain purposes.
145 Note that for calls to stored functions and UDF functions, func_name()
146 returns the name of the function. This may overlap with the name of an
147 internal function, thus the functype() must be used together with
148 func_name() to get a unique function reference.
149 For runtime type identification, it is adviced to use Item_func::functype()
150 and Item_sum::sum_func() instead.
151 The value is returned in ASCII character set, except for user-defined
152 functions, whose names are returned in the system character set.
153 */
154 virtual const char *func_name() const = 0;
155
156 bool reject_vector_args();
157 uint num_vector_args();
159
160 protected:
161 /*
162 These decide of types of arguments which are prepared-statement
163 parameters.
164 */
167 bool param_type_is_default(THD *thd, uint start, uint end, uint step,
168 enum_field_types def);
169 bool param_type_is_default(THD *thd, uint start, uint end,
171 return param_type_is_default(thd, start, end, 1, def);
172 }
173 bool param_type_is_rejected(uint start, uint end);
174
175 /**
176 Affects how to determine that NULL argument implies a NULL function return.
177 Default behaviour in this class is:
178 - if true, any NULL argument means the function returns NULL.
179 - if false, no such assumption is made and not_null_tables_cache is thus
180 set to 0.
181 null_on_null is true for all Item_func derived classes, except Item_func_sp,
182 all CASE derived functions and a few other functions.
183 RETURNS NULL ON NULL INPUT can be implemented for stored functions by
184 modifying this member in class Item_func_sp.
185 */
186 bool null_on_null{true};
187 /*
188 Allowed numbers of columns in result (usually 1, which means scalar value)
189 0 means get this number from first argument
190 */
192 /// Value used in calculation of result of used_tables()
194 /// Value used in calculation of result of not_null_tables()
196
197 public:
198 bool is_null_on_null() const { return null_on_null; }
199
200 /*
201 When updating Functype with new spatial functions,
202 is_spatial_operator() should also be updated.
203
204 DD_INTERNAL_FUNC:
205 Some of the internal functions introduced for the INFORMATION_SCHEMA views
206 opens data-dictionary tables. DD_INTERNAL_FUNC is used for the such type
207 of functions.
208 */
209 enum Functype {
357 };
364 };
365 enum Type type() const override { return FUNC_ITEM; }
366 virtual enum Functype functype() const { return UNKNOWN_FUNC; }
368
369 explicit Item_func(const POS &pos)
371
373 args[0] = a;
375 }
376 Item_func(const POS &pos, Item *a)
378 args[0] = a;
379 }
380
382 args[0] = a;
383 args[1] = b;
387 }
388 Item_func(const POS &pos, Item *a, Item *b)
390 args[0] = a;
391 args[1] = b;
392 }
393
394 Item_func(Item *a, Item *b, Item *c) {
395 if (alloc_args(*THR_MALLOC, 3)) return;
396 args[0] = a;
397 args[1] = b;
398 args[2] = c;
403 }
404
405 Item_func(const POS &pos, Item *a, Item *b, Item *c)
406 : Item_result_field(pos) {
407 if (alloc_args(*THR_MALLOC, 3)) return;
408 args[0] = a;
409 args[1] = b;
410 args[2] = c;
411 }
412
413 Item_func(Item *a, Item *b, Item *c, Item *d) {
414 if (alloc_args(*THR_MALLOC, 4)) return;
415 args[0] = a;
416 args[1] = b;
417 args[2] = c;
418 args[3] = d;
424 }
425
426 Item_func(const POS &pos, Item *a, Item *b, Item *c, Item *d)
427 : Item_result_field(pos) {
428 if (alloc_args(*THR_MALLOC, 4)) return;
429 args[0] = a;
430 args[1] = b;
431 args[2] = c;
432 args[3] = d;
433 }
434 Item_func(Item *a, Item *b, Item *c, Item *d, Item *e) {
435 if (alloc_args(*THR_MALLOC, 5)) return;
436 args[0] = a;
437 args[1] = b;
438 args[2] = c;
439 args[3] = d;
440 args[4] = e;
447 }
448 Item_func(const POS &pos, Item *a, Item *b, Item *c, Item *d, Item *e)
449 : Item_result_field(pos) {
450 if (alloc_args(*THR_MALLOC, 5)) return;
451 args[0] = a;
452 args[1] = b;
453 args[2] = c;
454 args[3] = d;
455 args[4] = e;
456 }
457 Item_func(Item *a, Item *b, Item *c, Item *d, Item *e, Item *f) {
458 if (alloc_args(*THR_MALLOC, 6)) return;
459 args[0] = a;
460 args[1] = b;
461 args[2] = c;
462 args[3] = d;
463 args[4] = e;
464 args[5] = f;
472 }
473 Item_func(const POS &pos, Item *a, Item *b, Item *c, Item *d, Item *e,
474 Item *f)
475 : Item_result_field(pos) {
476 if (alloc_args(*THR_MALLOC, 6)) return;
477 args[0] = a;
478 args[1] = b;
479 args[2] = c;
480 args[3] = d;
481 args[4] = e;
482 args[5] = f;
483 }
485 set_arguments(list, false);
486 }
487
488 Item_func(const POS &pos, PT_item_list *opt_list);
489
490 // Constructor used for Item_cond_and/or (see Item comment)
491 Item_func(THD *thd, const Item_func *item);
492
493 /// Get the i'th argument of the function that this object represents.
494 virtual Item *get_arg(uint i) { return args[i]; }
495
496 /// Get the i'th argument of the function that this object represents.
497 virtual const Item *get_arg(uint i) const { return args[i]; }
498 virtual Item *set_arg(THD *, uint, Item *) {
499 assert(0);
500 return nullptr;
501 }
502
503 bool do_itemize(Parse_context *pc, Item **res) override;
504
505 bool fix_fields(THD *, Item **ref) override;
506 bool fix_func_arg(THD *, Item **arg);
507 void fix_after_pullout(Query_block *parent_query_block,
508 Query_block *removed_query_block) override;
509 /**
510 Resolve type of function after all arguments have had their data types
511 resolved. Called from resolve_type() when no dynamic parameters
512 are used and from propagate_type() otherwise.
513 */
514 virtual bool resolve_type_inner(THD *) {
515 assert(false);
516 return false;
517 }
518 bool propagate_type(THD *thd, const Type_properties &type) override;
519 /**
520 Returns the pseudo tables depended upon in order to evaluate this
521 function expression. The default implementation returns the empty
522 set.
523 */
524 virtual table_map get_initial_pseudo_tables() const { return 0; }
525 table_map used_tables() const override { return used_tables_cache; }
527 void update_used_tables() override;
529 bool eq(const Item *item) const override;
530 /**
531 Provide a more specific equality check for a function.
532 Combine with Item::eq() to implement a complete equality check.
533 */
534 virtual bool eq_specific(const Item *) const { return true; }
535 virtual optimize_type select_optimize(const THD *) { return OPTIMIZE_NONE; }
536 virtual bool have_rev_func() const { return false; }
537 virtual Item *key_item() const { return args[0]; }
538 /**
539 Copy arguments from list to args array
540
541 @param list function argument list
542 @param context_free true: for use in context-independent
543 constructors (Item_func(POS,...)) i.e. for use
544 in the parser
545 @return true on OOM, false otherwise
546 */
547 bool set_arguments(mem_root_deque<Item *> *list, bool context_free);
548 bool split_sum_func(THD *thd, Ref_item_array ref_item_array,
549 mem_root_deque<Item *> *fields) override;
550 void print(const THD *thd, String *str,
551 enum_query_type query_type) const override;
552 void print_op(const THD *thd, String *str, enum_query_type query_type) const;
553 void print_args(const THD *thd, String *str, uint from,
554 enum_query_type query_type) const;
555 virtual void fix_num_length_and_dec();
556 virtual bool is_deprecated() const { return false; }
557 bool get_arg0_date(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date) {
558 return (null_value = args[0]->get_date(ltime, fuzzy_date));
559 }
560 inline bool get_arg0_time(MYSQL_TIME *ltime) {
561 return (null_value = args[0]->get_time(ltime));
562 }
563 bool is_null() override { return update_null_value() || null_value; }
566 friend class udf_handler;
567 Field *tmp_table_field(TABLE *t_arg) override;
568 Item *get_tmp_table_item(THD *thd) override;
569
570 my_decimal *val_decimal(my_decimal *) override;
571
572 bool agg_arg_charsets(DTCollation &c, Item **items, uint nitems, uint flags,
573 int item_sep) {
574 return agg_item_charsets(c, func_name(), items, nitems, flags, item_sep);
575 }
576 /*
577 Aggregate arguments for string result, e.g: CONCAT(a,b)
578 - convert to @@character_set_connection if all arguments are numbers
579 - allow DERIVATION_NONE
580 */
582 uint nitems, int item_sep = 1) {
583 return agg_item_charsets_for_string_result(c, func_name(), items, nitems,
584 item_sep);
585 }
586 /*
587 Aggregate arguments for comparison, e.g: a=b, a LIKE b, a RLIKE b
588 - don't convert to @@character_set_connection if all arguments are numbers
589 - don't allow DERIVATION_NONE
590 */
592 uint nitems, int item_sep = 1) {
593 return agg_item_charsets_for_comparison(c, func_name(), items, nitems,
594 item_sep);
595 }
596
597 Item *replace_func_call(uchar *) override;
598
599 bool walk(Item_processor processor, enum_walk walk, uchar *arg) override;
600 Item *transform(Item_transformer transformer, uchar *arg) override;
601 Item *compile(Item_analyzer analyzer, uchar **arg_p,
602 Item_transformer transformer, uchar *arg_t) override;
603 void traverse_cond(Cond_traverser traverser, void *arg,
604 traverse_order order) override;
605
606 bool replace_equal_field_checker(uchar **arg) override {
607 Replace_equal *replace = pointer_cast<Replace_equal *>(*arg);
608 replace->stack.push_front(this);
609 return true;
610 }
611
613 pointer_cast<Replace_equal *>(arg)->stack.pop();
614 return this;
615 }
616
617 /**
618 Check whether a function allows replacement of a field with another item:
619 In particular, a replacement that changes the metadata of some Item
620 from non-nullable to nullable is not allowed.
621 Notice that e.g. changing the nullability of an operand of a comparison
622 operator in a WHERE clause that ignores UNKNOWN values is allowed,
623 according to this criterion.
624
625 @param original the field that could be replaced
626 @param subst the item that could be the replacement
627
628 @returns true if replacement is allowed, false otherwise
629 */
630 virtual bool allow_replacement(Item_field *const original,
631 Item *const subst) {
632 return original->is_nullable() || !subst->is_nullable();
633 }
634
635 /**
636 Throw an error if the input double number is not finite, i.e. is either
637 +/-INF or NAN.
638 */
639 inline double check_float_overflow(double value) {
640 return std::isfinite(value) ? value : raise_float_overflow();
641 }
642 /**
643 Throw an error if the input BIGINT value represented by the
644 (longlong value, bool unsigned flag) pair cannot be returned by the
645 function, i.e. is not compatible with this Item's unsigned_flag.
646 */
647 inline longlong check_integer_overflow(longlong value, bool val_unsigned) {
648 if ((unsigned_flag && !val_unsigned && value < 0) ||
649 (!unsigned_flag && val_unsigned &&
650 (ulonglong)value > (ulonglong)LLONG_MAX))
651 return raise_integer_overflow();
652 return value;
653 }
654 /**
655 Throw an error if the error code of a DECIMAL operation is E_DEC_OVERFLOW.
656 */
659 }
660
662 assert(fixed);
663 for (uint i = 0; i < arg_count; i++) {
664 if (args[i]->type() == Item::FIELD_ITEM &&
666 return true;
667 }
668 return false;
669 }
670
672 assert(fixed);
673 for (uint i = 0; i < arg_count; i++) {
674 if (args[i]->type() == Item::FIELD_ITEM &&
675 (args[i]->data_type() == MYSQL_TYPE_DATE ||
677 return true;
678 }
679 return false;
680 }
681
683 assert(fixed);
684 for (uint i = 0; i < arg_count; i++) {
685 if (args[i]->type() == Item::FIELD_ITEM &&
686 (args[i]->data_type() == MYSQL_TYPE_TIME ||
688 return true;
689 }
690 return false;
691 }
692
694 assert(fixed);
695 for (uint i = 0; i < arg_count; i++) {
696 if (args[i]->type() == Item::FIELD_ITEM &&
698 return true;
699 }
700 return false;
701 }
702
703 /*
704 We assume the result of any function that has a TIMESTAMP argument to be
705 timezone-dependent, since a TIMESTAMP value in both numeric and string
706 contexts is interpreted according to the current timezone.
707 The only exception is UNIX_TIMESTAMP() which returns the internal
708 representation of a TIMESTAMP argument verbatim, and thus does not depend on
709 the timezone.
710 */
712 return has_timestamp_args();
713 }
714
715 Item *gc_subst_transformer(uchar *arg) override;
716
717 bool resolve_type(THD *thd) override {
718 // By default, pick PS-param's type from other arguments, or VARCHAR
719 return param_type_uses_non_param(thd);
720 }
721
722 /**
723 Whether an arg of a JSON function can be cached to avoid repetitive
724 string->JSON conversion. This function returns true only for those args,
725 which are the source of JSON data. JSON path args are cached independently
726 and for them this function returns false. Same as for all other type of
727 args.
728
729 @param arg the arg to cache
730
731 @retval true arg can be cached
732 @retval false otherwise
733 */
734 virtual enum_const_item_cache can_cache_json_arg(Item *arg [[maybe_unused]]) {
735 return CACHE_NONE;
736 }
737
738 /// Whether this Item is an equi-join condition. If this Item is a compound
739 /// item (i.e. multiple condition AND'ed together), it will only return true
740 /// if the Item contains only equi-join conditions AND'ed together. This is
741 /// used to determine whether the condition can be used as a join condition
742 /// for hash join (join conditions in hash join must be equi-join conditions),
743 /// or if it should be placed as a filter after the join.
744 virtual bool contains_only_equi_join_condition() const { return false; }
745
746 protected:
747 /**
748 Whether or not an item should contribute to the filtering effect
749 (@see get_filtering_effect()). First it verifies that table
750 requirements are satisfied as follows:
751
752 1) The item must refer to a field in 'filter_for_table' in some
753 way. This reference may be indirect through any number of
754 intermediate items. For example, this item may be an
755 Item_cond_and which refers to an Item_func_eq which refers to
756 the field.
757 2) The item must not refer to other tables than those already
758 read and the table in 'filter_for_table'
759
760 Then it contines to other properties as follows:
761
762 Item_funcs represent "<operand1> OP <operand2> [OP ...]". If the
763 Item_func is to contribute to the filtering effect, then
764
765 1) one of the operands must be a field from 'filter_for_table' that is not
766 in 'fields_to_ignore', and
767 2) depending on the Item_func type filtering effect is calculated
768 for, one or all [1] of the other operand(s) must be an available
769 value, i.e.:
770 - a constant, or
771 - a constant subquery, or
772 - a field value read from a table in 'read_tables', or
773 - a second field in 'filter_for_table', or
774 - a function that only refers to constants or tables in
775 'read_tables', or
776 - special case: an implicit value like NULL in the case of
777 "field IS NULL". Such Item_funcs have arg_count==1.
778
779 [1] "At least one" for multiple equality (X = Y = Z = ...), "all"
780 for the rest (e.g. BETWEEN)
781
782 @param thd The current thread.
783 @param read_tables Tables earlier in the join sequence.
784 Predicates for table 'filter_for_table' that
785 rely on values from these tables can be part of
786 the filter effect.
787 @param filter_for_table The table we are calculating filter effect for
788 @param fields_to_ignore Columns that should be ignored.
789
790
791 @return Item_field that participates in the predicate if none of the
792 requirements are broken, NULL otherwise
793
794 @note: This function only applies to items doing comparison, i.e.
795 boolean predicates. Unfortunately, some of those items do not
796 inherit from Item_bool_func so the member function has to be
797 placed in Item_func.
798 */
800 THD *thd, table_map read_tables, table_map filter_for_table,
801 const MY_BITMAP *fields_to_ignore) const;
802 /**
803 Named parameters are allowed in a parameter list
804
805 The syntax to name parameters in a function call is as follow:
806 <code>foo(expr AS named, expr named, expr AS "named", expr "named")</code>
807 where "AS" is optional.
808 Only UDF function support that syntax.
809
810 @return true if the function item can have named parameters
811 */
812 virtual bool may_have_named_parameters() const { return false; }
813 bool is_non_const_over_literals(uchar *) override { return false; }
814
815 bool check_function_as_value_generator(uchar *checker_args) override {
816 if (is_deprecated()) {
818 pointer_cast<Check_function_as_value_generator_parameters *>(
819 checker_args);
820 func_arg->banned_function_name = func_name();
821 return true;
822 }
823 return false;
824 }
825 bool is_valid_for_pushdown(uchar *arg) override;
826 bool check_column_in_window_functions(uchar *arg) override;
827 bool check_column_in_group_by(uchar *arg) override;
828
830};
831
832class Item_real_func : public Item_func {
833 public:
835 explicit Item_real_func(const POS &pos) : Item_func(pos) {
837 }
838
840 Item_real_func(const POS &pos, Item *a) : Item_func(pos, a) {
842 }
843
845
846 Item_real_func(const POS &pos, Item *a, Item *b) : Item_func(pos, a, b) {
848 }
849
852 }
853
856 }
857
858 String *val_str(String *str) override;
859 my_decimal *val_decimal(my_decimal *decimal_value) override;
860 longlong val_int() override {
861 assert(fixed);
863 }
864 bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override {
865 return get_date_from_real(ltime, fuzzydate);
866 }
867 bool get_time(MYSQL_TIME *ltime) override {
868 return get_time_from_real(ltime);
869 }
870 enum Item_result result_type() const override { return REAL_RESULT; }
871};
872
874 protected:
876
877 public:
880 }
882 : Item_func(pos, a), hybrid_type(REAL_RESULT) {
884 }
885
889 }
890 Item_func_numhybrid(const POS &pos, Item *a, Item *b)
891 : Item_func(pos, a, b), hybrid_type(REAL_RESULT) {
893 }
894
898 }
902 }
903
904 enum Item_result result_type() const override { return hybrid_type; }
906 return MYSQL_TYPE_DOUBLE;
907 }
908 bool resolve_type(THD *thd) override;
909 bool resolve_type_inner(THD *thd) override;
910 void fix_num_length_and_dec() override;
911 virtual void set_numeric_type() = 0; // To be called from resolve_type()
912
913 double val_real() override;
914 longlong val_int() override;
915 my_decimal *val_decimal(my_decimal *) override;
916 String *val_str(String *str) override;
917 bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override;
918 bool get_time(MYSQL_TIME *ltime) override;
919 /**
920 @brief Performs the operation that this functions implements when the
921 result type is INT.
922
923 @return The result of the operation.
924 */
925 virtual longlong int_op() = 0;
926
927 /**
928 @brief Performs the operation that this functions implements when the
929 result type is REAL.
930
931 @return The result of the operation.
932 */
933 virtual double real_op() = 0;
934
935 /**
936 @brief Performs the operation that this functions implements when the
937 result type is DECIMAL.
938
939 @param decimal_value A pointer where the DECIMAL value will be allocated.
940 @return
941 - 0 If the result is NULL
942 - The same pointer it was given, with the area initialized to the
943 result of the operation.
944 */
945 virtual my_decimal *decimal_op(my_decimal *decimal_value) = 0;
946
947 /**
948 @brief Performs the operation that this functions implements when the
949 result type is a string type.
950
951 @return The result of the operation.
952 */
953 virtual String *str_op(String *) = 0;
954 /**
955 @brief Performs the operation that this functions implements when the
956 result type is MYSQL_TYPE_DATE or MYSQL_TYPE_DATETIME.
957
958 @return The result of the operation.
959 */
960 virtual bool date_op(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) = 0;
961 virtual bool time_op(MYSQL_TIME *ltime) = 0;
962 bool is_null() override { return update_null_value() || null_value; }
963};
964
965/* function where type of result detected by first argument */
967 public:
969 Item_func_num1(const POS &pos, Item *a) : Item_func_numhybrid(pos, a) {}
970
972 Item_func_num1(const POS &pos, Item *a, Item *b)
973 : Item_func_numhybrid(pos, a, b) {}
974
975 void fix_num_length_and_dec() override;
976 void set_numeric_type() override;
977 String *str_op(String *) override {
978 assert(0);
979 return nullptr;
980 }
982 assert(0);
983 return false;
984 }
985 bool time_op(MYSQL_TIME *) override {
986 assert(0);
987 return false;
988 }
989};
990
991/* Base class for operations like '+', '-', '*' */
993 public:
995 Item_num_op(const POS &pos, Item *a, Item *b)
996 : Item_func_numhybrid(pos, a, b) {}
997
998 virtual void result_precision() = 0;
999
1000 void print(const THD *thd, String *str,
1001 enum_query_type query_type) const override {
1002 print_op(thd, str, query_type);
1003 }
1004
1005 void set_numeric_type() override;
1006 String *str_op(String *) override {
1007 assert(0);
1008 return nullptr;
1009 }
1011 assert(0);
1012 return false;
1013 }
1014 bool time_op(MYSQL_TIME *) override {
1015 assert(0);
1016 return false;
1017 }
1018};
1019
1020class Item_int_func : public Item_func {
1021 public:
1023 explicit Item_int_func(const POS &pos) : Item_func(pos) {
1025 }
1026
1028 Item_int_func(const POS &pos, Item *a) : Item_func(pos, a) {
1030 }
1031
1034 }
1035 Item_int_func(const POS &pos, Item *a, Item *b) : Item_func(pos, a, b) {
1037 }
1038
1039 Item_int_func(Item *a, Item *b, Item *c) : Item_func(a, b, c) {
1041 }
1042 Item_int_func(const POS &pos, Item *a, Item *b, Item *c)
1043 : Item_func(pos, a, b, c) {
1045 }
1046
1047 Item_int_func(Item *a, Item *b, Item *c, Item *d) : Item_func(a, b, c, d) {
1049 }
1050 Item_int_func(const POS &pos, Item *a, Item *b, Item *c, Item *d)
1051 : Item_func(pos, a, b, c, d) {
1053 }
1054
1057 }
1058 Item_int_func(const POS &pos, PT_item_list *opt_list)
1059 : Item_func(pos, opt_list) {
1061 }
1062
1063 Item_int_func(THD *thd, Item_int_func *item) : Item_func(thd, item) {
1065 }
1066 double val_real() override;
1067 String *val_str(String *str) override;
1068 bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override {
1069 return get_date_from_int(ltime, fuzzydate);
1070 }
1071 bool get_time(MYSQL_TIME *ltime) override { return get_time_from_int(ltime); }
1072 enum Item_result result_type() const override { return INT_RESULT; }
1073 /*
1074 Concerning PS-param types,
1075 resolve_type(THD *) is not overridden here, as experience shows that for
1076 most child classes of this class, VARCHAR is the best default
1077 */
1078};
1079
1082
1083 public:
1085
1087 return INNER_TABLE_BIT;
1088 }
1089 bool do_itemize(Parse_context *pc, Item **res) override;
1090 const char *func_name() const override { return "connection_id"; }
1091 bool resolve_type(THD *thd) override;
1092 bool fix_fields(THD *thd, Item **ref) override;
1093 longlong val_int() override;
1094 bool check_function_as_value_generator(uchar *checker_args) override {
1096 pointer_cast<Check_function_as_value_generator_parameters *>(
1097 checker_args);
1098 func_arg->banned_function_name = func_name();
1099 return ((func_arg->source == VGS_GENERATED_COLUMN) ||
1100 (func_arg->source == VGS_CHECK_CONSTRAINT));
1101 }
1102};
1103
1105 public:
1106 Item_typecast_signed(const POS &pos, Item *a) : Item_int_func(pos, a) {
1107 unsigned_flag = false;
1108 }
1109 const char *func_name() const override { return "cast_as_signed"; }
1110 longlong val_int() override;
1111 bool resolve_type(THD *thd) override;
1112 void print(const THD *thd, String *str,
1113 enum_query_type query_type) const override;
1114 enum Functype functype() const override { return TYPECAST_FUNC; }
1115};
1116
1118 public:
1119 Item_typecast_unsigned(const POS &pos, Item *a) : Item_int_func(pos, a) {
1120 unsigned_flag = true;
1121 }
1122 const char *func_name() const override { return "cast_as_unsigned"; }
1123 longlong val_int() override;
1124 bool resolve_type(THD *thd) override;
1125 void print(const THD *thd, String *str,
1126 enum_query_type query_type) const override;
1127 enum Functype functype() const override { return TYPECAST_FUNC; }
1128};
1129
1130class Item_typecast_decimal final : public Item_func {
1131 protected:
1132 void add_json_info(Json_object *obj) override;
1133
1134 public:
1135 Item_typecast_decimal(const POS &pos, Item *a, int len, int dec)
1136 : Item_func(pos, a) {
1138 }
1139 String *val_str(String *str) override;
1140 double val_real() override;
1141 longlong val_int() override;
1142 bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override {
1143 return get_date_from_decimal(ltime, fuzzydate);
1144 }
1145 bool get_time(MYSQL_TIME *ltime) override {
1146 return get_time_from_decimal(ltime);
1147 }
1148 my_decimal *val_decimal(my_decimal *) override;
1149 enum Item_result result_type() const override { return DECIMAL_RESULT; }
1150 bool resolve_type(THD *thd) override {
1151 if (reject_vector_args()) return true;
1152 if (args[0]->propagate_type(thd, MYSQL_TYPE_NEWDECIMAL, false, true))
1153 return true;
1154 return false;
1155 }
1156 const char *func_name() const override { return "cast_as_decimal"; }
1157 enum Functype functype() const override { return TYPECAST_FUNC; }
1158 void print(const THD *thd, String *str,
1159 enum_query_type query_type) const override;
1160};
1161
1162/**
1163 Class used to implement CAST to floating-point data types.
1164*/
1165class Item_typecast_real final : public Item_func {
1166 protected:
1167 void add_json_info(Json_object *obj) override {
1168 obj->add_alias("is_double", create_dom_ptr<Json_boolean>(
1170 }
1171
1172 public:
1173 Item_typecast_real(const POS &pos, Item *a, bool as_double)
1174 : Item_func(pos, a) {
1175 if (as_double)
1177 else
1179 }
1181 String *val_str(String *str) override;
1182 double val_real() override;
1183 longlong val_int() override { return val_int_from_real(); }
1184 bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override;
1185 bool get_time(MYSQL_TIME *ltime) override;
1186 my_decimal *val_decimal(my_decimal *decimal_value) override;
1187 enum Item_result result_type() const override { return REAL_RESULT; }
1188 bool resolve_type(THD *thd) override {
1189 if (reject_vector_args()) return true;
1190 return args[0]->propagate_type(thd, MYSQL_TYPE_DOUBLE, false, true);
1191 }
1192 const char *func_name() const override { return "cast_as_real"; }
1193 enum Functype functype() const override { return TYPECAST_FUNC; }
1194 void print(const THD *thd, String *str,
1195 enum_query_type query_type) const override;
1196};
1197
1199 public:
1202 : Item_num_op(pos, a, b) {}
1203
1204 void result_precision() override;
1205 bool check_partition_func_processor(uchar *) override { return false; }
1206 bool check_function_as_value_generator(uchar *) override { return false; }
1207};
1208
1210 public:
1212 Item_func_plus(const POS &pos, Item *a, Item *b)
1213 : Item_func_additive_op(pos, a, b) {}
1214
1215 const char *func_name() const override { return "+"; }
1216
1217 // SUPPRESS_UBSAN: signed integer overflow
1218 longlong int_op() override SUPPRESS_UBSAN;
1219
1220 double real_op() override;
1221 my_decimal *decimal_op(my_decimal *) override;
1222 enum Functype functype() const override { return PLUS_FUNC; }
1223};
1224
1226 public:
1228 Item_func_minus(const POS &pos, Item *a, Item *b)
1229 : Item_func_additive_op(pos, a, b) {}
1230
1231 const char *func_name() const override { return "-"; }
1232
1233 // SUPPRESS_UBSAN: signed integer overflow
1234 longlong int_op() override SUPPRESS_UBSAN;
1235
1236 double real_op() override;
1237 my_decimal *decimal_op(my_decimal *) override;
1238 bool resolve_type(THD *thd) override;
1239 enum Functype functype() const override { return MINUS_FUNC; }
1240};
1241
1242class Item_func_mul final : public Item_num_op {
1243 public:
1245 Item_func_mul(const POS &pos, Item *a, Item *b) : Item_num_op(pos, a, b) {}
1246
1247 const char *func_name() const override { return "*"; }
1248 longlong int_op() override;
1249 double real_op() override;
1250 my_decimal *decimal_op(my_decimal *) override;
1251 void result_precision() override;
1252 bool check_partition_func_processor(uchar *) override { return false; }
1253 bool check_function_as_value_generator(uchar *) override { return false; }
1254 enum Functype functype() const override { return MUL_FUNC; }
1255};
1256
1258 public:
1259 Item_func_div_base(const POS &pos, Item *a, Item *b)
1260 : Item_num_op(pos, a, b) {}
1262 longlong int_op() override;
1263 double real_op() override;
1264 my_decimal *decimal_op(my_decimal *) override;
1265 enum Functype functype() const override { return DIV_FUNC; }
1266
1267 protected:
1269};
1270
1271class Item_func_div final : public Item_func_div_base {
1272 public:
1273 Item_func_div(const POS &pos, Item *a, Item *b)
1274 : Item_func_div_base(pos, a, b) {}
1275 const char *func_name() const override { return "/"; }
1276 bool resolve_type(THD *thd) override;
1277 void result_precision() override;
1278};
1279
1281 public:
1283 Item_func_div_int(const POS &pos, Item *a, Item *b)
1284 : Item_func_div_base(pos, a, b) {}
1285 const char *func_name() const override { return "DIV"; }
1287 return MYSQL_TYPE_LONGLONG;
1288 }
1289 bool resolve_type(THD *thd) override;
1290 void result_precision() override;
1291 void set_numeric_type() override;
1292 bool check_partition_func_processor(uchar *) override { return false; }
1293 bool check_function_as_value_generator(uchar *) override { return false; }
1294};
1295
1296class Item_func_mod final : public Item_num_op {
1297 public:
1299 Item_func_mod(const POS &pos, Item *a, Item *b) : Item_num_op(pos, a, b) {}
1300
1301 longlong int_op() override;
1302 double real_op() override;
1303 my_decimal *decimal_op(my_decimal *) override;
1304 const char *func_name() const override { return "%"; }
1305 void result_precision() override;
1306 bool resolve_type(THD *thd) override;
1307 bool check_partition_func_processor(uchar *) override { return false; }
1308 bool check_function_as_value_generator(uchar *) override { return false; }
1309 enum Functype functype() const override { return MOD_FUNC; }
1310};
1311
1312class Item_func_neg final : public Item_func_num1 {
1313 public:
1315 Item_func_neg(const POS &pos, Item *a) : Item_func_num1(pos, a) {}
1316
1317 double real_op() override;
1318 longlong int_op() override;
1319 my_decimal *decimal_op(my_decimal *) override;
1320 const char *func_name() const override { return "-"; }
1321 enum Functype functype() const override { return NEG_FUNC; }
1322 bool resolve_type(THD *thd) override;
1323 void fix_num_length_and_dec() override;
1324 bool check_partition_func_processor(uchar *) override { return false; }
1325 bool check_function_as_value_generator(uchar *) override { return false; }
1326};
1327
1328class Item_func_abs final : public Item_func_num1 {
1329 public:
1330 Item_func_abs(const POS &pos, Item *a) : Item_func_num1(pos, a) {}
1331 double real_op() override;
1332 longlong int_op() override;
1333 my_decimal *decimal_op(my_decimal *) override;
1334 const char *func_name() const override { return "abs"; }
1335 bool resolve_type(THD *) override;
1336 bool check_partition_func_processor(uchar *) override { return false; }
1337 bool check_function_as_value_generator(uchar *) override { return false; }
1338 enum Functype functype() const override { return ABS_FUNC; }
1339};
1340
1341// A class to handle logarithmic and trigonometric functions
1342
1344 public:
1346 Item_dec_func(const POS &pos, Item *a) : Item_real_func(pos, a) {}
1347
1348 Item_dec_func(const POS &pos, Item *a, Item *b) : Item_real_func(pos, a, b) {}
1349 bool resolve_type(THD *thd) override;
1350};
1351
1352class Item_func_exp final : public Item_dec_func {
1353 public:
1354 Item_func_exp(const POS &pos, Item *a) : Item_dec_func(pos, a) {}
1355 double val_real() override;
1356 const char *func_name() const override { return "exp"; }
1357 enum Functype functype() const override { return EXP_FUNC; }
1358};
1359
1360class Item_func_ln final : public Item_dec_func {
1361 public:
1362 Item_func_ln(const POS &pos, Item *a) : Item_dec_func(pos, a) {}
1363 double val_real() override;
1364 const char *func_name() const override { return "ln"; }
1365 enum Functype functype() const override { return LN_FUNC; }
1366};
1367
1368class Item_func_log final : public Item_dec_func {
1369 public:
1370 Item_func_log(const POS &pos, Item *a) : Item_dec_func(pos, a) {}
1371 Item_func_log(const POS &pos, Item *a, Item *b) : Item_dec_func(pos, a, b) {}
1372 double val_real() override;
1373 const char *func_name() const override { return "log"; }
1374 enum Functype functype() const override { return LOG_FUNC; }
1375};
1376
1377class Item_func_log2 final : public Item_dec_func {
1378 public:
1379 Item_func_log2(const POS &pos, Item *a) : Item_dec_func(pos, a) {}
1380 double val_real() override;
1381 const char *func_name() const override { return "log2"; }
1382};
1383
1384class Item_func_log10 final : public Item_dec_func {
1385 public:
1386 Item_func_log10(const POS &pos, Item *a) : Item_dec_func(pos, a) {}
1387 double val_real() override;
1388 const char *func_name() const override { return "log10"; }
1389 enum Functype functype() const override { return LOG10_FUNC; }
1390};
1391
1392class Item_func_sqrt final : public Item_dec_func {
1393 public:
1394 Item_func_sqrt(const POS &pos, Item *a) : Item_dec_func(pos, a) {}
1395 double val_real() override;
1396 const char *func_name() const override { return "sqrt"; }
1397 enum Functype functype() const override { return SQRT_FUNC; }
1398};
1399
1400class Item_func_pow final : public Item_dec_func {
1401 public:
1402 Item_func_pow(const POS &pos, Item *a, Item *b) : Item_dec_func(pos, a, b) {}
1403 double val_real() override;
1404 const char *func_name() const override { return "pow"; }
1405 enum Functype functype() const override { return POW_FUNC; }
1406};
1407
1408class Item_func_acos final : public Item_dec_func {
1409 public:
1410 Item_func_acos(const POS &pos, Item *a) : Item_dec_func(pos, a) {}
1411 double val_real() override;
1412 const char *func_name() const override { return "acos"; }
1413 enum Functype functype() const override { return ACOS_FUNC; }
1414};
1415
1416class Item_func_asin final : public Item_dec_func {
1417 public:
1418 Item_func_asin(const POS &pos, Item *a) : Item_dec_func(pos, a) {}
1419 double val_real() override;
1420 const char *func_name() const override { return "asin"; }
1421 enum Functype functype() const override { return ASIN_FUNC; }
1422};
1423
1424class Item_func_atan final : public Item_dec_func {
1425 public:
1426 Item_func_atan(const POS &pos, Item *a) : Item_dec_func(pos, a) {}
1427 Item_func_atan(const POS &pos, Item *a, Item *b) : Item_dec_func(pos, a, b) {}
1428 double val_real() override;
1429 const char *func_name() const override { return "atan"; }
1430 enum Functype functype() const override { return ATAN_FUNC; }
1431};
1432
1433class Item_func_cos final : public Item_dec_func {
1434 public:
1435 Item_func_cos(const POS &pos, Item *a) : Item_dec_func(pos, a) {}
1436 double val_real() override;
1437 const char *func_name() const override { return "cos"; }
1438 enum Functype functype() const override { return COS_FUNC; }
1439};
1440
1441class Item_func_sin final : public Item_dec_func {
1442 public:
1443 Item_func_sin(const POS &pos, Item *a) : Item_dec_func(pos, a) {}
1444 double val_real() override;
1445 const char *func_name() const override { return "sin"; }
1446 enum Functype functype() const override { return SIN_FUNC; }
1447};
1448
1449class Item_func_tan final : public Item_dec_func {
1450 public:
1451 Item_func_tan(const POS &pos, Item *a) : Item_dec_func(pos, a) {}
1452 double val_real() override;
1453 const char *func_name() const override { return "tan"; }
1454 enum Functype functype() const override { return TAN_FUNC; }
1455};
1456
1457class Item_func_cot final : public Item_dec_func {
1458 public:
1459 Item_func_cot(const POS &pos, Item *a) : Item_dec_func(pos, a) {}
1460 double val_real() override;
1461 const char *func_name() const override { return "cot"; }
1462 enum Functype functype() const override { return COT_FUNC; }
1463};
1464
1466 public:
1468 Item_func_int_val(const POS &pos, Item *a) : Item_func_num1(pos, a) {}
1469 bool resolve_type_inner(THD *thd) override;
1470};
1471
1473 public:
1475 Item_func_ceiling(const POS &pos, Item *a) : Item_func_int_val(pos, a) {}
1476 const char *func_name() const override { return "ceiling"; }
1477 longlong int_op() override;
1478 double real_op() override;
1479 my_decimal *decimal_op(my_decimal *) override;
1480 bool check_partition_func_processor(uchar *) override { return false; }
1481 bool check_function_as_value_generator(uchar *) override { return false; }
1482 enum Functype functype() const override { return CEILING_FUNC; }
1483};
1484
1486 public:
1488 Item_func_floor(const POS &pos, Item *a) : Item_func_int_val(pos, a) {}
1489 const char *func_name() const override { return "floor"; }
1490 longlong int_op() override;
1491 double real_op() override;
1492 my_decimal *decimal_op(my_decimal *) override;
1493 bool check_partition_func_processor(uchar *) override { return false; }
1494 bool check_function_as_value_generator(uchar *) override { return false; }
1495 enum Functype functype() const override { return FLOOR_FUNC; }
1496};
1497
1498/* This handles round and truncate */
1499
1500class Item_func_round final : public Item_func_num1 {
1502
1503 public:
1504 Item_func_round(Item *a, Item *b, bool trunc_arg)
1505 : Item_func_num1(a, b), truncate(trunc_arg) {}
1506 Item_func_round(const POS &pos, Item *a, Item *b, bool trunc_arg)
1507 : Item_func_num1(pos, a, b), truncate(trunc_arg) {}
1508
1509 const char *func_name() const override {
1510 return truncate ? "truncate" : "round";
1511 }
1512 double real_op() override;
1513 longlong int_op() override;
1514 my_decimal *decimal_op(my_decimal *) override;
1515 bool resolve_type(THD *) override;
1516 enum Functype functype() const override {
1518 }
1519};
1520
1521class Item_func_rand final : public Item_real_func {
1523
1525 bool first_eval{true}; // true if val_real() is called 1st time
1526 public:
1528 Item_func_rand(const POS &pos, Item *a) : Item_real_func(pos, a) {}
1529 explicit Item_func_rand(const POS &pos) : Item_real_func(pos) {}
1530
1531 bool do_itemize(Parse_context *pc, Item **res) override;
1532 double val_real() override;
1533 const char *func_name() const override { return "rand"; }
1534 /**
1535 This function is non-deterministic and hence depends on the
1536 'RAND' pseudo-table.
1537
1538 @returns RAND_TABLE_BIT
1539 */
1541 return RAND_TABLE_BIT;
1542 }
1543 bool fix_fields(THD *thd, Item **ref) override;
1544 bool resolve_type(THD *thd) override;
1545 void cleanup() override {
1546 first_eval = true;
1548 }
1549 bool check_function_as_value_generator(uchar *checker_args) override {
1551 pointer_cast<Check_function_as_value_generator_parameters *>(
1552 checker_args);
1553 func_arg->banned_function_name = func_name();
1554 return ((func_arg->source == VGS_GENERATED_COLUMN) ||
1555 (func_arg->source == VGS_CHECK_CONSTRAINT));
1556 }
1557
1558 private:
1559 void seed_random(Item *val);
1560};
1561
1562class Item_func_sign final : public Item_int_func {
1563 public:
1564 Item_func_sign(const POS &pos, Item *a) : Item_int_func(pos, a) {}
1565 const char *func_name() const override { return "sign"; }
1566 enum Functype functype() const override { return SIGN_FUNC; }
1567 longlong val_int() override;
1568 bool resolve_type(THD *thd) override;
1569};
1570
1571// Common base class for the DEGREES and RADIANS functions.
1573 double mul, add;
1574
1575 protected:
1576 Item_func_units(const POS &pos, Item *a, double mul_arg, double add_arg)
1577 : Item_real_func(pos, a), mul(mul_arg), add(add_arg) {}
1578
1579 public:
1580 double val_real() override;
1581 bool resolve_type(THD *thd) override;
1582};
1583
1585 public:
1587 : Item_func_units(pos, a, 180.0 / M_PI, 0.0) {}
1588 const char *func_name() const override { return "degrees"; }
1589 enum Functype functype() const override { return DEGREES_FUNC; }
1590};
1591
1593 public:
1595 : Item_func_units(pos, a, M_PI / 180.0, 0.0) {}
1596 const char *func_name() const override { return "radians"; }
1597 enum Functype functype() const override { return RADIANS_FUNC; }
1598};
1600 public:
1601 Item_func_min_max(const POS &pos, PT_item_list *opt_list, bool is_least_func)
1602 : Item_func_numhybrid(pos, opt_list),
1603 m_is_least_func(is_least_func),
1605
1606 longlong val_int() override;
1607 double val_real() override;
1608 my_decimal *val_decimal(my_decimal *) override;
1609 longlong int_op() override;
1610 double real_op() override;
1611 my_decimal *decimal_op(my_decimal *) override;
1612 String *str_op(String *) override;
1613 bool date_op(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override;
1614 bool time_op(MYSQL_TIME *ltime) override;
1616 return MYSQL_TYPE_VARCHAR;
1617 }
1618 bool resolve_type(THD *thd) override;
1619 bool resolve_type_inner(THD *thd) override;
1620 void set_numeric_type() override {}
1621 enum Item_result result_type() const override { return hybrid_type; }
1622 TYPELIB *get_typelib() const override;
1623
1624 /**
1625 Make CAST(LEAST_OR_GREATEST(datetime_expr, varchar_expr))
1626 return a number in format YYMMDDhhmmss.
1627 */
1628 enum Item_result cast_to_int_type() const override {
1630 }
1631
1632 /// Returns true if arguments to this function should be compared as dates.
1633 bool compare_as_dates() const;
1634
1635 /// Returns true if at least one of the arguments was of temporal type.
1636 bool has_temporal_arg() const { return temporal_item; }
1637
1638 private:
1639 /// True if LEAST function, false if GREATEST.
1642 /*
1643 Used for determining whether one of the arguments is of temporal type and
1644 for converting arguments to a common output format if arguments are
1645 compared as dates and result type is character string. For example,
1646 LEAST('95-05-05', date '10-10-10') should return '1995-05-05', not
1647 '95-05-05'.
1648 */
1650
1651 /**
1652 Fractional seconds precision to use when converting a time or timestamp
1653 expression into a string.
1654 */
1656 /**
1657 Compare arguments as datetime values.
1658
1659 @param value Pointer to which the datetime value of the winning argument
1660 is written.
1661
1662 @return true if error, false otherwise.
1663 */
1664 bool cmp_datetimes(longlong *value);
1665
1666 /**
1667 Compare arguments as time values.
1668
1669 @param value Pointer to which the time value of the winning argument is
1670 written.
1671
1672 @return true if error, false otherwise.
1673 */
1674 bool cmp_times(longlong *value);
1675};
1676
1677class Item_func_min final : public Item_func_min_max {
1678 public:
1679 Item_func_min(const POS &pos, PT_item_list *opt_list)
1680 : Item_func_min_max(pos, opt_list, true) {}
1681 const char *func_name() const override { return "least"; }
1682 enum Functype functype() const override { return LEAST_FUNC; }
1683};
1684
1685class Item_func_max final : public Item_func_min_max {
1686 public:
1687 Item_func_max(const POS &pos, PT_item_list *opt_list)
1688 : Item_func_min_max(pos, opt_list, false) {}
1689 const char *func_name() const override { return "greatest"; }
1690 enum Functype functype() const override { return GREATEST_FUNC; }
1691};
1692
1693/**
1694 A wrapper Item that normally returns its parameter, but becomes NULL when
1695 processing rows for rollup. Rollup is implemented by AggregateIterator, and
1696 works by means of hierarchical levels -- 0 is the “grand totals” phase, 1 is
1697 where only one group level is active, and so on. E.g., for a query with GROUP
1698 BY a,b, the rows will look like this:
1699
1700 a b rollup level
1701 1 1 2
1702 1 2 2
1703 1 NULL 1
1704 2 1 2
1705 2 NULL 1
1706 NULL NULL 0
1707
1708 Each rollup group item has a minimum level for when it becomes NULL. In the
1709 example above, a would have minimum level 0 and b would have minimum level 1.
1710 For simplicity, the JOIN carries a list of all rollup group items, and they
1711 are being given the current rollup level when it changes. A rollup level of
1712 INT_MAX essentially always disables rollup, which is useful when there are
1713 leftover group items in places that are not relevant for rollup
1714 (e.g., sometimes resolving can leave rollup wrappers in place for temporary
1715 tables that are created before grouping, which should then effectively be
1716 disabled).
1717 */
1718class Item_rollup_group_item final : public Item_func {
1719 public:
1724 // We're going to replace inner_item in the SELECT list, so copy its hidden
1725 // status. (We could have done this in the caller, but it fits naturally in
1726 // with all the other copying done here.)
1728 set_nullable(true);
1730 }
1731 double val_real() override;
1732 longlong val_int() override;
1733 String *val_str(String *str) override;
1735 bool val_json(Json_wrapper *result) override;
1736 bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override;
1737 bool get_time(MYSQL_TIME *ltime) override;
1738 const char *func_name() const override { return "rollup_group_item"; }
1739 table_map used_tables() const override {
1740 /*
1741 If underlying item is non-constant, return its used_tables value.
1742 Otherwise, ensure it is non-constant by adding RAND_TABLE_BIT.
1743 */
1744 return args[0]->const_for_execution()
1745 ? (args[0]->used_tables() | RAND_TABLE_BIT)
1746 : args[0]->used_tables();
1747 }
1748 void update_used_tables() override {
1751 }
1752 Item_result result_type() const override { return args[0]->result_type(); }
1753 bool resolve_type(THD *) override {
1754 // needn't handle dynamic parameter as its const_item() is false.
1756
1757 // The item could be a NULL constant.
1758 null_value = args[0]->is_null();
1759 return false;
1760 }
1761 Item *inner_item() { return args[0]; }
1762 const Item *inner_item() const { return args[0]; }
1763 bool rollup_null() const {
1765 }
1766 enum Functype functype() const override { return ROLLUP_GROUP_ITEM_FUNC; }
1767 void print(const THD *thd, String *str,
1768 enum_query_type query_type) const override;
1769 bool eq_specific(const Item *item) const override;
1770 TYPELIB *get_typelib() const override;
1771
1772 // Used by AggregateIterator.
1774
1775 // Used when cloning the item only.
1776 int min_rollup_level() const { return m_min_rollup_level; }
1777
1778 private:
1781};
1782
1785
1786 public:
1787 Item_func_length(const POS &pos, Item *a) : Item_int_func(pos, a) {}
1788 longlong val_int() override;
1789 const char *func_name() const override { return "length"; }
1790 bool resolve_type(THD *thd) override {
1791 if (param_type_is_default(thd, 0, 1)) return true;
1792 max_length = 10;
1793 return false;
1794 }
1795};
1796
1799
1800 public:
1801 Item_func_vector_dim(const POS &pos, Item *a) : Item_int_func(pos, a) {}
1802 longlong val_int() override;
1803 const char *func_name() const override { return "vector_dim"; }
1804 bool resolve_type(THD *thd) override {
1805 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_VECTOR)) {
1806 return true;
1807 }
1808 bool valid_type = (args[0]->data_type() == MYSQL_TYPE_VECTOR) ||
1809 (args[0]->result_type() == STRING_RESULT &&
1811 if (!valid_type) {
1812 my_error(ER_WRONG_ARGUMENTS, MYF(0), func_name());
1813 return true;
1814 }
1815 max_length = 10;
1816 return false;
1817 }
1818};
1819
1821 public:
1822 Item_func_bit_length(const POS &pos, Item *a) : Item_func_length(pos, a) {}
1823 longlong val_int() override {
1824 assert(fixed);
1825 return Item_func_length::val_int() * 8;
1826 }
1827 const char *func_name() const override { return "bit_length"; }
1828};
1829
1832
1833 public:
1835 Item_func_char_length(const POS &pos, Item *a) : Item_int_func(pos, a) {}
1836 longlong val_int() override;
1837 const char *func_name() const override { return "char_length"; }
1838 bool resolve_type(THD *thd) override {
1839 max_length = 10;
1840 return Item_int_func::resolve_type(thd);
1841 }
1842};
1843
1845 public:
1846 Item_func_coercibility(const POS &pos, Item *a) : Item_int_func(pos, a) {
1847 null_on_null = false;
1848 }
1849 longlong val_int() override;
1850 const char *func_name() const override { return "coercibility"; }
1851 bool resolve_type(THD *thd) override {
1852 max_length = 10;
1853 set_nullable(false);
1854 return Item_int_func::resolve_type(thd);
1855 }
1856};
1857
1860
1861 public:
1863 Item_func_locate(const POS &pos, Item *a, Item *b)
1864 : Item_int_func(pos, a, b) {}
1865 Item_func_locate(const POS &pos, Item *a, Item *b, Item *c)
1866 : Item_int_func(pos, a, b, c) {}
1867
1868 const char *func_name() const override { return "locate"; }
1869 longlong val_int() override;
1870 bool resolve_type(THD *thd) override;
1871 void print(const THD *thd, String *str,
1872 enum_query_type query_type) const override;
1873};
1874
1875class Item_func_instr final : public Item_func_locate {
1876 public:
1877 Item_func_instr(const POS &pos, Item *a, Item *b)
1878 : Item_func_locate(pos, a, b) {}
1879
1880 const char *func_name() const override { return "instr"; }
1881};
1882
1884 public:
1886 : Item_int_func(pos, a) {}
1887 longlong val_int() override;
1888 const char *func_name() const override {
1889 return "validate_password_strength";
1890 }
1891 bool resolve_type(THD *thd) override {
1892 max_length = 10;
1893 set_nullable(true);
1894 return Item_int_func::resolve_type(thd);
1895 }
1896};
1897
1898class Item_func_field final : public Item_int_func {
1901
1902 public:
1903 Item_func_field(const POS &pos, PT_item_list *opt_list)
1904 : Item_int_func(pos, opt_list) {}
1905 longlong val_int() override;
1906 const char *func_name() const override { return "field"; }
1907 bool resolve_type(THD *thd) override;
1908};
1909
1910class Item_func_ascii final : public Item_int_func {
1912
1913 public:
1914 Item_func_ascii(const POS &pos, Item *a) : Item_int_func(pos, a) {}
1915 longlong val_int() override;
1916 const char *func_name() const override { return "ascii"; }
1917 bool resolve_type(THD *thd) override {
1918 max_length = 3;
1919 return Item_int_func::resolve_type(thd);
1920 }
1921};
1922
1923class Item_func_ord final : public Item_int_func {
1925
1926 public:
1927 Item_func_ord(const POS &pos, Item *a) : Item_int_func(pos, a) {}
1928 longlong val_int() override;
1929 const char *func_name() const override { return "ord"; }
1930};
1931
1934 /*
1935 if m_enum_value is non-zero, it indicates the index of the value of
1936 argument 0 in the set in argument 1, given that argument 0 is
1937 a constant value and argument 1 is a field of type SET.
1938 */
1941
1942 public:
1944 : Item_int_func(pos, a, b) {}
1945 longlong val_int() override;
1946 const char *func_name() const override { return "find_in_set"; }
1947 bool resolve_type(THD *) override;
1948 const CHARSET_INFO *compare_collation() const override {
1949 return cmp_collation.collation;
1950 }
1951};
1952
1953/* Base class for all bit functions: '~', '|', '^', '&', '>>', '<<' */
1954
1955class Item_func_bit : public Item_func {
1956 protected:
1957 /// Stores the Item's result type. Can only be INT_RESULT or STRING_RESULT
1959 /// Buffer storing the determined value
1961 /**
1962 @returns true if the second argument should be of binary type for the
1963 result to be of binary type.
1964 */
1966
1967 public:
1968 Item_func_bit(const POS &pos, Item *a, Item *b) : Item_func(pos, a, b) {}
1969 Item_func_bit(const POS &pos, Item *a) : Item_func(pos, a) {}
1970
1971 bool resolve_type(THD *) override;
1972 enum Item_result result_type() const override { return hybrid_type; }
1973
1974 longlong val_int() override;
1975 String *val_str(String *str) override;
1976 double val_real() override;
1977 my_decimal *val_decimal(my_decimal *decimal_value) override;
1978
1979 void print(const THD *thd, String *str,
1980 enum_query_type query_type) const override {
1981 print_op(thd, str, query_type);
1982 }
1983 bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override {
1984 if (hybrid_type == INT_RESULT)
1985 return get_date_from_int(ltime, fuzzydate);
1986 else
1987 return get_date_from_string(ltime, fuzzydate);
1988 }
1989 bool get_time(MYSQL_TIME *ltime) override {
1990 if (hybrid_type == INT_RESULT)
1991 return get_time_from_int(ltime);
1992 else
1993 return get_time_from_string(ltime);
1994 }
1995
1996 private:
1997 /**
1998 @brief Performs the operation on integers to produce a result of type
1999 INT_RESULT.
2000 @return The result of the operation.
2001 */
2002 virtual longlong int_op() = 0;
2003
2004 /**
2005 @brief Performs the operation on binary strings to produce a result of
2006 type STRING_RESULT.
2007 @return The result of the operation.
2008 */
2009 virtual String *str_op(String *) = 0;
2010};
2011
2012/**
2013 Base class for all the bit functions that work with two binary
2014 arguments: '&', '|', '^'.
2015*/
2016
2018 protected:
2020 return true;
2021 }
2022 template <class Char_func, class Int_func>
2023 String *eval_str_op(String *, Char_func char_func, Int_func int_func);
2024 template <class Int_func>
2025 longlong eval_int_op(Int_func int_func);
2026
2027 public:
2029 : Item_func_bit(pos, a, b) {}
2030};
2031
2033 public:
2034 Item_func_bit_or(const POS &pos, Item *a, Item *b)
2035 : Item_func_bit_two_param(pos, a, b) {}
2036 const char *func_name() const override { return "|"; }
2037
2038 private:
2039 longlong int_op() override { return eval_int_op(std::bit_or<ulonglong>()); }
2040 String *str_op(String *str) override {
2041 return eval_str_op(str, std::bit_or<char>(), std::bit_or<ulonglong>());
2042 }
2043};
2044
2046 public:
2047 Item_func_bit_and(const POS &pos, Item *a, Item *b)
2048 : Item_func_bit_two_param(pos, a, b) {}
2049 const char *func_name() const override { return "&"; }
2050
2051 private:
2052 longlong int_op() override { return eval_int_op(std::bit_and<ulonglong>()); }
2053 String *str_op(String *str) override {
2054 return eval_str_op(str, std::bit_and<char>(), std::bit_and<ulonglong>());
2055 }
2056};
2057
2059 public:
2060 Item_func_bit_xor(const POS &pos, Item *a, Item *b)
2061 : Item_func_bit_two_param(pos, a, b) {}
2062 const char *func_name() const override { return "^"; }
2063
2064 private:
2065 longlong int_op() override { return eval_int_op(std::bit_xor<ulonglong>()); }
2066 String *str_op(String *str) override {
2067 return eval_str_op(str, std::bit_xor<char>(), std::bit_xor<ulonglong>());
2068 }
2069};
2070
2072 public:
2073 Item_func_bit_count(const POS &pos, Item *a) : Item_int_func(pos, a) {}
2074 longlong val_int() override;
2075 const char *func_name() const override { return "bit_count"; }
2076 bool resolve_type(THD *thd) override {
2077 // Default: binary string; reprepare if integer
2078 if (args[0]->data_type() == MYSQL_TYPE_INVALID &&
2079 args[0]->propagate_type(
2081 return true;
2083 return false;
2084 }
2085};
2086
2088 protected:
2090 return false;
2091 }
2092 template <bool to_left>
2094 template <bool to_left>
2096
2097 public:
2098 Item_func_shift(const POS &pos, Item *a, Item *b)
2099 : Item_func_bit(pos, a, b) {}
2100};
2101
2103 public:
2104 Item_func_shift_left(const POS &pos, Item *a, Item *b)
2105 : Item_func_shift(pos, a, b) {}
2106 const char *func_name() const override { return "<<"; }
2107
2108 private:
2109 longlong int_op() override;
2110 String *str_op(String *str) override;
2111};
2112
2114 public:
2116 : Item_func_shift(pos, a, b) {}
2117 const char *func_name() const override { return ">>"; }
2118
2119 private:
2120 longlong int_op() override;
2121 String *str_op(String *str) override;
2122};
2123
2124class Item_func_bit_neg final : public Item_func_bit {
2125 protected:
2127 return false;
2128 }
2129
2130 public:
2131 Item_func_bit_neg(const POS &pos, Item *a) : Item_func_bit(pos, a) {}
2132 const char *func_name() const override { return "~"; }
2133 void print(const THD *thd, String *str,
2134 enum_query_type query_type) const override {
2135 Item_func::print(thd, str, query_type);
2136 }
2137
2138 private:
2139 longlong int_op() override;
2140 String *str_op(String *str) override;
2141};
2142
2145
2146 public:
2148 explicit Item_func_last_insert_id(const POS &pos) : Item_int_func(pos) {}
2149 Item_func_last_insert_id(const POS &pos, Item *a) : Item_int_func(pos, a) {}
2150
2151 bool do_itemize(Parse_context *pc, Item **res) override;
2152 longlong val_int() override;
2153 const char *func_name() const override { return "last_insert_id"; }
2154
2156 return INNER_TABLE_BIT;
2157 }
2158
2159 bool resolve_type(THD *thd) override {
2160 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_LONGLONG)) return true;
2161 unsigned_flag = true;
2162 return false;
2163 }
2164 bool check_function_as_value_generator(uchar *checker_args) override {
2166 pointer_cast<Check_function_as_value_generator_parameters *>(
2167 checker_args);
2168 func_arg->banned_function_name = func_name();
2169 return true;
2170 }
2171};
2172
2175
2176 public:
2177 Item_func_benchmark(const POS &pos, Item *count_expr, Item *expr)
2178 : Item_int_func(pos, count_expr, expr) {}
2179
2180 /// Ensure that "benchmark()" is never optimized away
2182 return RAND_TABLE_BIT;
2183 }
2184
2185 bool do_itemize(Parse_context *pc, Item **res) override;
2186 longlong val_int() override;
2187 const char *func_name() const override { return "benchmark"; }
2188 bool resolve_type(THD *thd) override {
2189 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_LONGLONG)) return true;
2190 if (param_type_is_default(thd, 1, 2)) return true;
2191 max_length = 1;
2192 set_nullable(true);
2193 return false;
2194 }
2195 void print(const THD *thd, String *str,
2196 enum_query_type query_type) const override;
2197 bool check_function_as_value_generator(uchar *checker_args) override {
2199 pointer_cast<Check_function_as_value_generator_parameters *>(
2200 checker_args);
2201 func_arg->banned_function_name = func_name();
2202 return true;
2203 }
2204};
2205
2208
2209class Item_func_sleep final : public Item_int_func {
2211
2212 public:
2213 Item_func_sleep(const POS &pos, Item *a) : Item_int_func(pos, a) {}
2214
2215 bool do_itemize(Parse_context *pc, Item **res) override;
2216 const char *func_name() const override { return "sleep"; }
2217 /**
2218 This function is non-deterministic and hence depends on the
2219 'RAND' pseudo-table.
2220
2221 @returns RAND_TABLE_BIT
2222 */
2224 return RAND_TABLE_BIT;
2225 }
2226 bool check_function_as_value_generator(uchar *checker_args) override {
2228 pointer_cast<Check_function_as_value_generator_parameters *>(
2229 checker_args);
2230 func_arg->banned_function_name = func_name();
2231 return true;
2232 }
2233 bool resolve_type(THD *thd) override {
2234 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_DOUBLE)) return true;
2235 return Item_int_func::resolve_type(thd);
2236 }
2237 longlong val_int() override;
2238};
2239
2240class Item_udf_func : public Item_func {
2242
2243 protected:
2245
2246 public:
2247 Item_udf_func(const POS &pos, udf_func *udf_arg, PT_item_list *opt_list)
2248 : Item_func(pos, opt_list), udf(udf_arg) {
2249 null_on_null = false;
2250 }
2251 ~Item_udf_func() override = default;
2252
2253 bool do_itemize(Parse_context *pc, Item **res) override;
2254 const char *func_name() const override { return udf.name(); }
2255 enum Functype functype() const override { return UDF_FUNC; }
2258 }
2259 bool fix_fields(THD *thd, Item **ref) override;
2260 void cleanup() override;
2261 Item_result result_type() const override { return udf.result_type(); }
2262 void print(const THD *thd, String *str,
2263 enum_query_type query_type) const override;
2264
2265 bool check_function_as_value_generator(uchar *checker_args) override {
2267 pointer_cast<Check_function_as_value_generator_parameters *>(
2268 checker_args);
2269 func_arg->banned_function_name = func_name();
2270 return true;
2271 }
2272
2273 void compute_cost(CostOfItem *root_cost) const override {
2274 root_cost->MarkExpensive();
2275 }
2276
2277 protected:
2278 bool may_have_named_parameters() const override { return true; }
2279
2280 private:
2281 /**
2282 This member is set during resolving and is used by update_used_tables() and
2283 fix_after_pullout() to preserve the non-deterministic property.
2284 */
2286};
2287
2289 public:
2290 Item_func_udf_float(const POS &pos, udf_func *udf_arg, PT_item_list *opt_list)
2291 : Item_udf_func(pos, udf_arg, opt_list) {}
2292 longlong val_int() override {
2293 assert(fixed);
2295 }
2296 my_decimal *val_decimal(my_decimal *dec_buf) override {
2297 const double res = val_real();
2298 if (null_value) return nullptr;
2299 double2my_decimal(E_DEC_FATAL_ERROR, res, dec_buf);
2300 return dec_buf;
2301 }
2302 double val_real() override;
2303 String *val_str(String *str) override;
2304 bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override {
2305 return get_date_from_real(ltime, fuzzydate);
2306 }
2307 bool get_time(MYSQL_TIME *ltime) override {
2308 return get_time_from_real(ltime);
2309 }
2310 bool resolve_type(THD *) override {
2312 fix_num_length_and_dec(); // @todo - needed?
2313 return false;
2314 }
2315};
2316
2317class Item_func_udf_int final : public Item_udf_func {
2318 public:
2319 Item_func_udf_int(const POS &pos, udf_func *udf_arg, PT_item_list *opt_list)
2320 : Item_udf_func(pos, udf_arg, opt_list) {}
2321 longlong val_int() override;
2322 double val_real() override {
2323 return static_cast<double>(Item_func_udf_int::val_int());
2324 }
2325 String *val_str(String *str) override;
2326 bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override {
2327 return get_date_from_int(ltime, fuzzydate);
2328 }
2329 bool get_time(MYSQL_TIME *ltime) override { return get_time_from_int(ltime); }
2330 enum Item_result result_type() const override { return INT_RESULT; }
2331 bool resolve_type(THD *) override {
2333 return false;
2334 }
2335};
2336
2338 public:
2339 Item_func_udf_decimal(const POS &pos, udf_func *udf_arg,
2340 PT_item_list *opt_list)
2341 : Item_udf_func(pos, udf_arg, opt_list) {}
2342 longlong val_int() override;
2343 double val_real() override;
2344 my_decimal *val_decimal(my_decimal *) override;
2345 String *val_str(String *str) override;
2346 bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override {
2347 return get_date_from_decimal(ltime, fuzzydate);
2348 }
2349 bool get_time(MYSQL_TIME *ltime) override {
2350 return get_time_from_decimal(ltime);
2351 }
2352 enum Item_result result_type() const override { return DECIMAL_RESULT; }
2353 bool resolve_type(THD *thd) override;
2354};
2355
2357 public:
2358 Item_func_udf_str(const POS &pos, udf_func *udf_arg, PT_item_list *opt_list)
2359 : Item_udf_func(pos, udf_arg, opt_list) {}
2360
2361 String *val_str(String *) override;
2362 double val_real() override {
2363 int err_not_used;
2364 const char *end_not_used;
2365 String *res;
2366 res = val_str(&str_value);
2367 return res ? my_strntod(res->charset(), res->ptr(), res->length(),
2368 &end_not_used, &err_not_used)
2369 : 0.0;
2370 }
2371 longlong val_int() override {
2372 int err_not_used;
2373 String *res;
2374 res = val_str(&str_value);
2375 return res ? my_strntoll(res->charset(), res->ptr(), res->length(), 10,
2376 nullptr, &err_not_used)
2377 : (longlong)0;
2378 }
2379 my_decimal *val_decimal(my_decimal *dec_buf) override {
2380 String *res = val_str(&str_value);
2381 if (!res) return nullptr;
2382 str2my_decimal(E_DEC_FATAL_ERROR, res->ptr(), res->length(), res->charset(),
2383 dec_buf);
2384 return dec_buf;
2385 }
2386 bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override {
2387 return get_date_from_string(ltime, fuzzydate);
2388 }
2389 bool get_time(MYSQL_TIME *ltime) override {
2390 return get_time_from_string(ltime);
2391 }
2392 enum Item_result result_type() const override { return STRING_RESULT; }
2393 bool resolve_type(THD *thd) override;
2394};
2395
2396void mysql_ull_cleanup(THD *thd);
2398
2399class Item_func_get_lock final : public Item_int_func {
2401
2403
2404 public:
2405 Item_func_get_lock(const POS &pos, Item *a, Item *b)
2406 : Item_int_func(pos, a, b) {}
2407
2408 bool do_itemize(Parse_context *pc, Item **res) override;
2409 longlong val_int() override;
2410 const char *func_name() const override { return "get_lock"; }
2412 return INNER_TABLE_BIT;
2413 }
2414 bool resolve_type(THD *thd) override {
2415 if (param_type_is_default(thd, 0, 1)) return true;
2416 if (param_type_is_default(thd, 1, 2, MYSQL_TYPE_LONGLONG)) return true;
2417 max_length = 1;
2418 set_nullable(true);
2419 return false;
2420 }
2421 bool is_non_const_over_literals(uchar *) override { return true; }
2422 bool check_function_as_value_generator(uchar *checker_args) override {
2424 pointer_cast<Check_function_as_value_generator_parameters *>(
2425 checker_args);
2426 func_arg->banned_function_name = func_name();
2427 return true;
2428 }
2429};
2430
2433
2435
2436 public:
2437 Item_func_release_lock(const POS &pos, Item *a) : Item_int_func(pos, a) {}
2438 bool do_itemize(Parse_context *pc, Item **res) override;
2439
2440 longlong val_int() override;
2441 const char *func_name() const override { return "release_lock"; }
2443 return INNER_TABLE_BIT;
2444 }
2445 bool resolve_type(THD *thd) override {
2446 if (param_type_is_default(thd, 0, 1)) return true;
2447 max_length = 1;
2448 set_nullable(true);
2449 return false;
2450 }
2451 bool is_non_const_over_literals(uchar *) override { return true; }
2452 bool check_function_as_value_generator(uchar *checker_args) override {
2454 pointer_cast<Check_function_as_value_generator_parameters *>(
2455 checker_args);
2456 func_arg->banned_function_name = func_name();
2457 return true;
2458 }
2459};
2460
2463
2464 public:
2465 explicit Item_func_release_all_locks(const POS &pos) : Item_int_func(pos) {}
2466 bool do_itemize(Parse_context *pc, Item **res) override;
2467
2468 longlong val_int() override;
2469 const char *func_name() const override { return "release_all_locks"; }
2471 return INNER_TABLE_BIT;
2472 }
2473 bool resolve_type(THD *) override {
2474 unsigned_flag = true;
2475 return false;
2476 }
2477 bool is_non_const_over_literals(uchar *) override { return true; }
2478 bool check_function_as_value_generator(uchar *checker_args) override {
2480 pointer_cast<Check_function_as_value_generator_parameters *>(
2481 checker_args);
2482 func_arg->banned_function_name = func_name();
2483 return true;
2484 }
2485};
2486
2487/* replication functions */
2488
2492
2493 public:
2494 Item_source_pos_wait(const POS &pos, Item *a, Item *b)
2495 : Item_int_func(pos, a, b) {}
2496 Item_source_pos_wait(const POS &pos, Item *a, Item *b, Item *c)
2497 : Item_int_func(pos, a, b, c) {}
2498 Item_source_pos_wait(const POS &pos, Item *a, Item *b, Item *c, Item *d)
2499 : Item_int_func(pos, a, b, c, d) {}
2500
2501 bool do_itemize(Parse_context *pc, Item **res) override;
2502 longlong val_int() override;
2503 const char *func_name() const override { return "source_pos_wait"; }
2505 return INNER_TABLE_BIT;
2506 }
2507 bool resolve_type(THD *thd) override {
2508 if (param_type_is_default(thd, 0, 1)) return true;
2509 if (param_type_is_default(thd, 1, 3, MYSQL_TYPE_LONGLONG)) return true;
2510 if (param_type_is_default(thd, 3, 4)) return true;
2511 max_length = 21;
2512 set_nullable(true);
2513 return false;
2514 }
2515 bool check_function_as_value_generator(uchar *checker_args) override {
2517 pointer_cast<Check_function_as_value_generator_parameters *>(
2518 checker_args);
2519 func_arg->banned_function_name = func_name();
2520 return true;
2521 }
2522};
2523
2525 public:
2526 Item_master_pos_wait(const POS &pos, Item *a, Item *b)
2527 : Item_source_pos_wait(pos, a, b) {}
2528 Item_master_pos_wait(const POS &pos, Item *a, Item *b, Item *c)
2529 : Item_source_pos_wait(pos, a, b, c) {}
2530 Item_master_pos_wait(const POS &pos, Item *a, Item *b, Item *c, Item *d)
2531 : Item_source_pos_wait(pos, a, b, c, d) {}
2532 longlong val_int() override;
2533};
2534
2535/**
2536 Internal functions used by INFORMATION_SCHEMA implementation to check
2537 if user have access to given database/table/column.
2538*/
2539
2541 public:
2543 : Item_int_func(pos, a) {}
2544 longlong val_int() override;
2545 const char *func_name() const override { return "can_access_database"; }
2546 bool resolve_type(THD *) override {
2547 set_nullable(true);
2548 return false;
2549 }
2550};
2551
2553 public:
2555 : Item_int_func(pos, a, b) {}
2556 longlong val_int() override;
2557 const char *func_name() const override { return "can_access_table"; }
2558 bool resolve_type(THD *) override {
2559 set_nullable(true);
2560 return false;
2561 }
2562};
2563
2565 public:
2567 : Item_int_func(pos, a, b) {}
2568 longlong val_int() override;
2569 const char *func_name() const override { return "can_access_user"; }
2570 bool resolve_type(THD *) override {
2571 set_nullable(true);
2572 return false;
2573 }
2574};
2575
2577 public:
2579 : Item_int_func(pos, a, b) {}
2580 longlong val_int() override;
2581 const char *func_name() const override { return "can_access_trigger"; }
2582 bool resolve_type(THD *) override {
2583 max_length = 4;
2584 set_nullable(true);
2585 return false;
2586 }
2587};
2588
2590 public:
2592 : Item_int_func(pos, list) {}
2593 longlong val_int() override;
2594 const char *func_name() const override { return "can_access_routine"; }
2595 bool resolve_type(THD *) override {
2596 max_length = 4;
2597 set_nullable(true);
2598 return false;
2599 }
2600};
2601
2603 public:
2605 longlong val_int() override;
2606 const char *func_name() const override { return "can_access_event"; }
2607 bool resolve_type(THD *) override {
2608 set_nullable(true);
2609 return false;
2610 }
2611};
2612
2614 public:
2616 : Item_int_func(pos, a) {}
2617 longlong val_int() override;
2618 const char *func_name() const override { return "can_access_resource_group"; }
2619 bool resolve_type(THD *) override {
2620 max_length = 1; // Function can return 0 or 1.
2621 set_nullable(true);
2622 return false;
2623 }
2624};
2625
2627 public:
2628 Item_func_can_access_view(const POS &pos, Item *a, Item *b, Item *c, Item *d)
2629 : Item_int_func(pos, a, b, c, d) {}
2630 longlong val_int() override;
2631 const char *func_name() const override { return "can_access_view"; }
2632 bool resolve_type(THD *) override {
2633 set_nullable(true);
2634 return false;
2635 }
2636};
2637
2639 public:
2641 : Item_int_func(pos, a, b, c) {}
2642 longlong val_int() override;
2643 const char *func_name() const override { return "can_access_column"; }
2644 bool resolve_type(THD *) override {
2645 set_nullable(true);
2646 return false;
2647 }
2648};
2649
2651 public:
2653 : Item_int_func(pos, a) {}
2655 : Item_int_func(pos, a, b) {}
2657 : Item_int_func(pos, a, b, c) {}
2658 longlong val_int() override;
2659 const char *func_name() const override { return "is_visible_dd_object"; }
2660 bool resolve_type(THD *) override {
2661 max_length = 1;
2662 set_nullable(true);
2663 return false;
2664 }
2665};
2666
2668 public:
2670 : Item_int_func(pos, list) {}
2671 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
2672 longlong val_int() override;
2673 const char *func_name() const override { return "internal_table_rows"; }
2674 bool resolve_type(THD *) override {
2675 set_nullable(true);
2676 unsigned_flag = true;
2677 null_on_null = false;
2678 return false;
2679 }
2680};
2681
2683 public:
2685 : Item_int_func(pos, list) {}
2686 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
2687 longlong val_int() override;
2688 const char *func_name() const override { return "internal_avg_row_length"; }
2689 bool resolve_type(THD *) override {
2690 set_nullable(true);
2691 unsigned_flag = true;
2692 null_on_null = false;
2693 return false;
2694 }
2695};
2696
2698 public:
2700 : Item_int_func(pos, list) {}
2701 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
2702 longlong val_int() override;
2703 const char *func_name() const override { return "internal_data_length"; }
2704 bool resolve_type(THD *) override {
2705 set_nullable(true);
2706 unsigned_flag = true;
2707 null_on_null = false;
2708 return false;
2709 }
2710};
2711
2713 public:
2715 : Item_int_func(pos, list) {}
2716 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
2717 longlong val_int() override;
2718 const char *func_name() const override { return "internal_max_data_length"; }
2719 bool resolve_type(THD *) override {
2720 set_nullable(true);
2721 unsigned_flag = true;
2722 null_on_null = false;
2723 return false;
2724 }
2725};
2726
2728 public:
2730 : Item_int_func(pos, list) {}
2731 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
2732 longlong val_int() override;
2733 const char *func_name() const override { return "internal_index_length"; }
2734 bool resolve_type(THD *) override {
2735 set_nullable(true);
2736 unsigned_flag = true;
2737 null_on_null = false;
2738 return false;
2739 }
2740};
2741
2743 public:
2745 : Item_int_func(pos, list) {}
2746 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
2747 longlong val_int() override;
2748 const char *func_name() const override { return "internal_data_free"; }
2749 bool resolve_type(THD *) override {
2750 set_nullable(true);
2751 unsigned_flag = true;
2752 null_on_null = false;
2753 return false;
2754 }
2755};
2756
2758 public:
2760 : Item_int_func(pos, list) {}
2761 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
2762 longlong val_int() override;
2763 const char *func_name() const override { return "internal_auto_increment"; }
2764 bool resolve_type(THD *) override {
2765 set_nullable(true);
2766 unsigned_flag = true;
2767 null_on_null = false;
2768 return false;
2769 }
2770};
2771
2773 public:
2775 : Item_int_func(pos, list) {}
2776 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
2777 longlong val_int() override;
2778 const char *func_name() const override { return "internal_checksum"; }
2779 bool resolve_type(THD *) override {
2780 set_nullable(true);
2781 null_on_null = false;
2782 return false;
2783 }
2784};
2785
2787 public:
2789 : Item_int_func(pos, a) {}
2790 longlong val_int() override;
2791 const char *func_name() const override { return "internal_keys_disabled"; }
2792 bool resolve_type(THD *) override {
2793 set_nullable(false);
2794 null_on_null = false;
2795 return false;
2796 }
2797};
2798
2800 public:
2803 : Item_int_func(pos, list) {}
2804 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
2805 longlong val_int() override;
2806 const char *func_name() const override {
2807 return "internal_index_column_cardinality";
2808 }
2809 bool resolve_type(THD *) override {
2810 set_nullable(true);
2811 null_on_null = false;
2812 return false;
2813 }
2814};
2815
2817 public:
2819 Item *d)
2820 : Item_int_func(pos, a, b, c, d) {}
2821 longlong val_int() override;
2822 const char *func_name() const override { return "internal_dd_char_length"; }
2823 bool resolve_type(THD *) override {
2824 set_nullable(true);
2825 null_on_null = false;
2826 return false;
2827 }
2828};
2829
2831 : public Item_int_func {
2832 public:
2835 : Item_int_func(pos, list) {}
2836 longlong val_int() override;
2837 const char *func_name() const override {
2838 return "internal_get_view_warning_or_error";
2839 }
2840 bool resolve_type(THD *) override {
2841 max_length = 1;
2842 set_nullable(false);
2843 null_on_null = false;
2844 return false;
2845 }
2846};
2847
2849 public:
2851 : Item_int_func(pos, list) {}
2852 longlong val_int() override;
2853 bool resolve_type(THD *) override {
2854 set_nullable(true);
2855 null_on_null = false;
2856 return false;
2857 }
2858 const char *func_name() const override {
2859 return "get_dd_index_sub_part_length";
2860 }
2861};
2862
2864 public:
2866 Item *d)
2867 : Item_int_func(pos, a, b, c, d) {}
2868 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
2869 longlong val_int() override;
2870 const char *func_name() const override { return "internal_tablespace_id"; }
2871 bool resolve_type(THD *) override {
2872 set_nullable(true);
2873 null_on_null = false;
2874 return false;
2875 }
2876};
2877
2879 : public Item_int_func {
2880 public:
2882 Item *b, Item *c, Item *d)
2883 : Item_int_func(pos, a, b, c, d) {}
2884
2885 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
2886 longlong val_int() override;
2887
2888 const char *func_name() const override {
2889 return "internal_tablespace_logfile_group_number";
2890 }
2891
2892 bool resolve_type(THD *) override {
2893 set_nullable(true);
2894 null_on_null = false;
2895 return false;
2896 }
2897};
2898
2900 public:
2902 Item *c, Item *d)
2903 : Item_int_func(pos, a, b, c, d) {}
2904
2905 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
2906 longlong val_int() override;
2907
2908 const char *func_name() const override {
2909 return "internal_tablespace_free_extents";
2910 }
2911
2912 bool resolve_type(THD *) override {
2913 set_nullable(true);
2914 null_on_null = false;
2915 return false;
2916 }
2917};
2918
2920 public:
2922 Item *c, Item *d)
2923 : Item_int_func(pos, a, b, c, d) {}
2924
2925 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
2926 longlong val_int() override;
2927
2928 const char *func_name() const override {
2929 return "internal_tablespace_total_extents";
2930 }
2931
2932 bool resolve_type(THD *) override {
2933 set_nullable(true);
2934 null_on_null = false;
2935 return false;
2936 }
2937};
2938
2940 public:
2942 Item *c, Item *d)
2943 : Item_int_func(pos, a, b, c, d) {}
2944
2945 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
2946 longlong val_int() override;
2947
2948 const char *func_name() const override {
2949 return "internal_tablespace_extent_size";
2950 }
2951
2952 bool resolve_type(THD *) override {
2953 set_nullable(true);
2954 null_on_null = false;
2955 return false;
2956 }
2957};
2958
2960 public:
2962 Item *c, Item *d)
2963 : Item_int_func(pos, a, b, c, d) {}
2964
2965 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
2966 longlong val_int() override;
2967
2968 const char *func_name() const override {
2969 return "internal_tablespace_initial_size";
2970 }
2971
2972 bool resolve_type(THD *) override {
2973 set_nullable(true);
2974 null_on_null = false;
2975 return false;
2976 }
2977};
2978
2980 public:
2982 Item *c, Item *d)
2983 : Item_int_func(pos, a, b, c, d) {}
2984
2985 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
2986 longlong val_int() override;
2987
2988 const char *func_name() const override {
2989 return "internal_tablespace_maximum_size";
2990 }
2991
2992 bool resolve_type(THD *) override {
2993 set_nullable(true);
2994 null_on_null = false;
2995 return false;
2996 }
2997};
2998
3000 public:
3002 Item *b, Item *c, Item *d)
3003 : Item_int_func(pos, a, b, c, d) {}
3004
3005 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
3006 longlong val_int() override;
3007
3008 const char *func_name() const override {
3009 return "internal_tablespace_autoextend_size";
3010 }
3011
3012 bool resolve_type(THD *) override {
3013 set_nullable(true);
3014 null_on_null = false;
3015 return false;
3016 }
3017};
3018
3020 public:
3022 Item *c, Item *d)
3023 : Item_int_func(pos, a, b, c, d) {}
3024
3025 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
3026 longlong val_int() override;
3027
3028 const char *func_name() const override {
3029 return "internal_tablespace_version";
3030 }
3031
3032 bool resolve_type(THD *) override {
3033 set_nullable(true);
3034 null_on_null = false;
3035 return false;
3036 }
3037};
3038
3040 public:
3042 Item *c, Item *d)
3043 : Item_int_func(pos, a, b, c, d) {}
3044
3045 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
3046 longlong val_int() override;
3047
3048 const char *func_name() const override {
3049 return "internal_tablespace_data_free";
3050 }
3051
3052 bool resolve_type(THD *) override {
3053 set_nullable(true);
3054 null_on_null = false;
3055 return false;
3056 }
3057};
3058
3059/**
3060 Common class for:
3061 Item_func_get_system_var
3062 Item_func_get_user_var
3063 Item_func_set_user_var
3064*/
3065class Item_var_func : public Item_func {
3066 public:
3068 explicit Item_var_func(const POS &pos) : Item_func(pos) {}
3069
3070 Item_var_func(THD *thd, Item_var_func *item) : Item_func(thd, item) {}
3071
3073 Item_var_func(const POS &pos, Item *a) : Item_func(pos, a) {}
3074
3075 bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override {
3076 return get_date_from_non_temporal(ltime, fuzzydate);
3077 }
3078 bool get_time(MYSQL_TIME *ltime) override {
3079 return get_time_from_non_temporal(ltime);
3080 }
3081 bool check_function_as_value_generator(uchar *checker_args) override {
3083 pointer_cast<Check_function_as_value_generator_parameters *>(
3084 checker_args);
3085 func_arg->err_code = (func_arg->source == VGS_CHECK_CONSTRAINT)
3086 ? ER_CHECK_CONSTRAINT_VARIABLES
3087 : ER_DEFAULT_VAL_GENERATED_VARIABLES;
3088 return true;
3089 }
3090};
3091
3092/* Handling of user definable variables */
3093
3094// this is needed for user_vars hash
3097 m_ptr = nullptr;
3098 m_length = 0;
3099 }
3100 void set_value(char *value, size_t length) {
3101 m_ptr = value;
3102 m_length = length;
3103 }
3104
3105 /**
3106 Position inside a user_var_entry where small values are stored:
3107 double values, longlong values and string values with length
3108 up to extra_size (should be 8 bytes on all platforms).
3109 String values with length longer than 8 are stored in a separate
3110 memory buffer, which is allocated when needed using the method realloc().
3111 */
3113 return pointer_cast<char *>(this) + ALIGN_SIZE(sizeof(user_var_entry));
3114 }
3115
3116 /**
3117 Position inside a user_var_entry where a null-terminates array
3118 of characters representing the variable name is stored.
3119 */
3121
3122 /**
3123 Initialize m_ptr to the internal buffer (if the value is small enough),
3124 or allocate a separate buffer.
3125 @param length - length of the value to be stored.
3126 */
3127 bool mem_realloc(size_t length);
3128
3129 /**
3130 Check if m_ptr points to an external buffer previously allocated by
3131 realloc().
3132 @retval true - an external buffer is allocated.
3133 @retval false - m_ptr is null, or points to the internal buffer.
3134 */
3135 bool alloced() { return m_ptr && m_ptr != internal_buffer_ptr(); }
3136
3137 /**
3138 Free the external value buffer, if it's allocated.
3139 */
3140 void free_value() {
3141 if (alloced()) my_free(m_ptr);
3142 }
3143
3144 /**
3145 Copy the array of characters from the given name into the internal
3146 name buffer and initialize entry_name to point to it.
3147 */
3149 name.strcpy(name_ptr());
3150 entry_name = Name_string(name_ptr(), name.length());
3151 }
3152
3153 /**
3154 Initialize all members
3155
3156 @param thd Current session.
3157 @param name Name of the user_var_entry instance.
3158 @param cs charset information of the user_var_entry instance.
3159 */
3160 void init(THD *thd, const Simple_cstring &name, const CHARSET_INFO *cs);
3161
3162 /**
3163 Store a value of the given type into a user_var_entry instance.
3164 @param from Value
3165 @param length Size of the value
3166 @param type type
3167 @retval false on success
3168 @retval true on memory allocation error
3169 */
3170 bool store(const void *from, size_t length, Item_result type);
3171
3172 /**
3173 Assert the user variable is locked.
3174 This is debug code only.
3175 The thread LOCK_thd_data mutex protects:
3176 - the thd->user_vars hash itself
3177 - the values in the user variable itself.
3178 The protection is required for monitoring,
3179 as a different thread can inspect this session
3180 user variables, on a live session.
3181 */
3182 void assert_locked() const;
3183
3184 static const size_t extra_size = sizeof(double);
3185 char *m_ptr; ///< Value
3186 size_t m_length; ///< Value length
3187 Item_result m_type; ///< Value type
3189 /**
3190 Set to the id of the most recent query that has used the variable.
3191 Used in binlogging: When set, there is no need to add a reference to this
3192 variable to the binlog. Imagine it is this:
3193
3194 INSERT INTO t SELECT @a:=10, @a:=@a+1.
3195
3196 Then we have a Item_func_get_user_var (because of the `@a+1`) so we
3197 think we have to write the value of `@a` to the binlog. But before that,
3198 we have a Item_func_set_user_var to create `@a` (`@a:=10`), in this we mark
3199 the variable as "already logged" so that it won't be logged
3200 by Item_func_get_user_var (because that's not necessary).
3201 */
3203
3204 public:
3205 user_var_entry() = default; /* Remove gcc warning */
3206
3207 THD *owner_session() const { return m_owner; }
3208
3209 Simple_cstring entry_name; // Variable name
3210 DTCollation collation; // Collation with attributes
3211 bool unsigned_flag; // true if unsigned, false if signed
3212
3213 /**
3214 Set value to user variable.
3215
3216 @param ptr pointer to buffer with new value
3217 @param length length of new value
3218 @param type type of new value
3219 @param cs charset info for new value
3220 @param dv derivation for new value
3221 @param unsigned_arg indicates if a value of type INT_RESULT is unsigned
3222
3223 @note Sets error and fatal error if allocation fails.
3224
3225 @retval
3226 false success
3227 @retval
3228 true failure
3229 */
3230 bool store(const void *ptr, size_t length, Item_result type,
3231 const CHARSET_INFO *cs, Derivation dv, bool unsigned_arg);
3232 /**
3233 Set type of to the given value.
3234 @param type Data type.
3235 */
3237 assert_locked();
3238 m_type = type;
3239 }
3240 /**
3241 Set value to NULL
3242 @param type Data type.
3243 */
3244
3246 assert_locked();
3247 free_value();
3248 reset_value();
3249 m_type = type;
3250 }
3251
3252 void set_used_query_id(query_id_t query_id) { m_used_query_id = query_id; }
3254
3255 /**
3256 Allocates and initializes a user variable instance.
3257
3258 @param thd Current session.
3259 @param name Name of the variable.
3260 @param cs Charset of the variable.
3261
3262 @return Address of the allocated and initialized user_var_entry instance.
3263 @retval NULL On allocation error.
3264 */
3265 static user_var_entry *create(THD *thd, const Name_string &name,
3266 const CHARSET_INFO *cs);
3267
3268 /**
3269 Free all memory used by a user_var_entry instance
3270 previously created by create().
3271 */
3272 void destroy() {
3273 assert_locked();
3274 free_value(); // Free the external value buffer
3275 my_free(this); // Free the instance itself
3276 }
3277
3278 void lock();
3279 void unlock();
3280
3281 /* Routines to access the value and its type */
3282 const char *ptr() const { return m_ptr; }
3283 size_t length() const { return m_length; }
3284 /// The data type of this variable.
3285 Item_result type() const { return m_type; }
3286 /* Item-alike routines to access the value */
3287 double val_real(bool *null_value) const;
3288 longlong val_int(bool *null_value) const;
3289 String *val_str(bool *null_value, String *str, uint decimals) const;
3290 my_decimal *val_decimal(bool *null_value, my_decimal *result) const;
3291};
3292
3293/**
3294 This class is used to implement operations like
3295 SET \@variable or \@variable:= expression.
3296*/
3297
3304 union {
3306 double vreal;
3310
3311 public:
3312 Name_string name; // keep it public
3313
3316 : Item_var_func(pos, b), name(a) {}
3317
3319 : Item_var_func(thd, item),
3321 entry(item->entry),
3322 value(item->value),
3324 null_item(item->null_item),
3325 save_result(item->save_result),
3326 name(item->name) {}
3327 enum Functype functype() const override { return SUSERVAR_FUNC; }
3328 double val_real() override;
3329 longlong val_int() override;
3330 String *val_str(String *str) override;
3331 my_decimal *val_decimal(my_decimal *) override;
3332 bool update_hash(const void *ptr, uint length, enum Item_result type,
3333 const CHARSET_INFO *cs, Derivation dv, bool unsigned_arg);
3334 bool send(Protocol *protocol, String *str_arg) override;
3335 void make_field(Send_field *tmp_field) override;
3336 bool check(bool use_result_field);
3337 void save_item_result(Item *item);
3338 bool update();
3339 enum Item_result result_type() const override { return cached_result_type; }
3340 bool fix_fields(THD *thd, Item **ref) override;
3341 bool resolve_type(THD *) override;
3342 void print(const THD *thd, String *str,
3343 enum_query_type query_type) const override;
3344 void print_assignment(const THD *thd, String *str,
3345 enum_query_type query_type) const;
3346 const char *func_name() const override { return "set_user_var"; }
3347
3348 type_conversion_status save_in_field(Field *field, bool no_conversions,
3349 bool can_use_result_field);
3350
3351 void save_org_in_field(Field *field) override {
3352 save_in_field(field, true, false);
3353 }
3354
3355 bool set_entry(THD *thd, bool create_if_not_exists);
3356 void cleanup() override;
3357
3358 protected:
3360 bool no_conversions) override {
3361 return save_in_field(field, no_conversions, true);
3362 }
3363};
3364
3369
3370 public:
3371 Name_string name; // keep it public
3372
3377
3378 enum Functype functype() const override { return GUSERVAR_FUNC; }
3379 double val_real() override;
3380 longlong val_int() override;
3381 my_decimal *val_decimal(my_decimal *) override;
3382 String *val_str(String *str) override;
3383 const CHARSET_INFO *charset_for_protocol() override;
3384 bool resolve_type(THD *) override;
3385 bool propagate_type(THD *thd, const Type_properties &type) override;
3386 void cleanup() override;
3387 void update_used_tables() override {} // Keep existing used tables
3388 void print(const THD *thd, String *str,
3389 enum_query_type query_type) const override;
3390 enum Item_result result_type() const override;
3391 /*
3392 We must always return variables as strings to guard against selects of type
3393 select @t1:=1,@t1,@t:="hello",@t from foo where (@t1:= t2.b)
3394 */
3395 const char *func_name() const override { return "get_user_var"; }
3396 bool is_non_const_over_literals(uchar *) override { return true; }
3397 bool eq_specific(const Item *item) const override;
3398
3399 private:
3400 bool set_value(THD *thd, sp_rcontext *ctx, Item **it) override;
3401
3402 public:
3404 return this;
3405 }
3406};
3407
3408/*
3409 This item represents user variable used as out parameter (e.g in LOAD DATA),
3410 and it is supposed to be used only for this purprose. So it is simplified
3411 a lot. Actually you should never obtain its value.
3412
3413 The only two reasons for this thing being an Item is possibility to store it
3414 in const mem_root_deque<Item> and desire to place this code somewhere near
3415 other functions working with user variables.
3416*/
3420
3421 public:
3423 : Item(pos), name(a) {
3424 item_name.copy(a);
3425 }
3426 /* We should return something different from FIELD_ITEM here */
3427 enum Type type() const override { return STRING_ITEM; }
3428 double val_real() override;
3429 longlong val_int() override;
3430 String *val_str(String *str) override;
3431 my_decimal *val_decimal(my_decimal *decimal_buffer) override;
3433 assert(0);
3434 return true;
3435 }
3436 bool get_time(MYSQL_TIME *) override {
3437 assert(0);
3438 return true;
3439 }
3440
3441 /* fix_fields() binds variable name with its entry structure */
3442 bool fix_fields(THD *thd, Item **ref) override;
3443 void print(const THD *thd, String *str,
3444 enum_query_type query_type) const override;
3445 void set_null_value(const CHARSET_INFO *cs);
3446 void set_value(const char *str, size_t length, const CHARSET_INFO *cs);
3447};
3448
3449/* A system variable */
3450
3451#define GET_SYS_VAR_CACHE_LONG 1
3452#define GET_SYS_VAR_CACHE_DOUBLE 2
3453#define GET_SYS_VAR_CACHE_STRING 4
3454
3456
3457/** Class to log audit event EVENT_TRACKING_GLOBAL_VARIABLE_GET. */
3459 public:
3463
3464 private:
3465 // Thread handle.
3467
3468 // Item_func_get_system_var instance.
3470
3471 /*
3472 Value conversion type.
3473 Depending on the value conversion type GET_SYS_VAR_CACHE_* is stored in this
3474 member while creating the object. While converting value if there are any
3475 intermediate conversions in the same query then this member is used to avoid
3476 auditing more than once.
3477 */
3479
3480 /*
3481 To indicate event auditing is required or not. Event is not audited if
3482 * scope of the variable is *not* GLOBAL.
3483 * or the event is already audited for global variable for the same query.
3484 */
3486};
3487
3497
3498 template <typename T>
3500
3502
3503 public:
3505 enum_var_type scope);
3506 enum Functype functype() const override { return GSYSVAR_FUNC; }
3508 return INNER_TABLE_BIT;
3509 }
3510 bool resolve_type(THD *) override;
3511 void print(const THD *thd, String *str,
3512 enum_query_type query_type) const override;
3513 bool is_non_const_over_literals(uchar *) override { return true; }
3514 enum Item_result result_type() const override {
3515 assert(fixed);
3516 return type_to_result(data_type());
3517 }
3518 double val_real() override;
3519 longlong val_int() override;
3520 String *val_str(String *) override;
3521 my_decimal *val_decimal(my_decimal *dec_buf) override {
3522 return val_decimal_from_real(dec_buf);
3523 }
3524 /* TODO: fix to support views */
3525 const char *func_name() const override { return "get_system_var"; }
3526 bool eq_specific(const Item *item) const override;
3527 bool is_valid_for_pushdown(uchar *arg [[maybe_unused]]) override {
3528 // Expressions which have system variables cannot be pushed as of
3529 // now because Item_func_get_system_var::print does not print the
3530 // original expression which leads to an incorrect clone.
3531 return true;
3532 }
3533
3534 void cleanup() override;
3535};
3536
3537class JOIN;
3538
3539class Item_func_match final : public Item_real_func {
3541
3542 protected:
3543 void add_json_info(Json_object *obj) override;
3544
3545 public:
3547 uint key, flags;
3548 /// True if we are doing a full-text index scan with this MATCH function as a
3549 /// predicate, and the score can be retrieved with get_relevance(). If it is
3550 /// false, the score of the document must be retrieved with find_relevance().
3555 /**
3556 Master item means that if identical items are present in the
3557 statement, they use the same FT handler. FT handler is initialized
3558 only for master item and slave items just use it. FT hints initialized
3559 for master only, slave items HINTS are not accessed.
3560 */
3562 Item *concat_ws; // Item_func_concat_ws
3563 String value; // value of concat_ws
3564 String search_value; // key_item()'s value converted to cmp_collation
3565
3566 /**
3567 Constructor for Item_func_match class.
3568
3569 @param pos Position of token in the parser.
3570 @param a List of arguments.
3571 @param against_arg Expression to match against.
3572 @param b FT Flags.
3573 */
3574 Item_func_match(const POS &pos, PT_item_list *a, Item *against_arg, uint b)
3575 : Item_real_func(pos, a),
3576 against(against_arg),
3577 key(0),
3578 flags(b),
3581 master(nullptr),
3583 hints(nullptr),
3584 simple_expression(false),
3585 used_in_where_only(false) {
3586 null_on_null = false;
3587 }
3588
3589 bool do_itemize(Parse_context *pc, Item **res) override;
3590
3591 void cleanup() override {
3592 DBUG_TRACE;
3594 if (master == nullptr && ft_handler != nullptr) {
3596 }
3597 score_from_index_scan = false;
3598 ft_handler = nullptr;
3599 concat_ws = nullptr;
3600 return;
3601 }
3602 Item *key_item() const override { return against; }
3603 enum Functype functype() const override { return FT_FUNC; }
3604 const char *func_name() const override { return "match"; }
3605 bool fix_fields(THD *thd, Item **ref) override;
3606 void update_used_tables() override;
3607 bool eq_specific(const Item *item) const override;
3608 /* The following should be safe, even if we compare doubles */
3609 longlong val_int() override {
3610 assert(fixed);
3611 return val_real() != 0.0;
3612 }
3613 double val_real() override;
3614 void print(const THD *thd, String *str,
3615 enum_query_type query_type) const override;
3616
3617 bool fix_index(const THD *thd);
3618 bool init_search(THD *thd);
3619 bool check_function_as_value_generator(uchar *checker_args) override {
3621 pointer_cast<Check_function_as_value_generator_parameters *>(
3622 checker_args);
3623 func_arg->banned_function_name = func_name();
3624 return true;
3625 }
3626
3627 /**
3628 Get number of matching rows from FT handler.
3629
3630 @note Requires that FT handler supports the extended API
3631
3632 @return Number of matching rows in result
3633 */
3635 assert(ft_handler);
3637
3638 return ((FT_INFO_EXT *)ft_handler)
3639 ->could_you->count_matches((FT_INFO_EXT *)ft_handler);
3640 }
3641
3642 /**
3643 Check whether FT result is ordered on rank
3644
3645 @return true if result is ordered
3646 @return false otherwise
3647 */
3649 assert(!master);
3650 if (hints->get_flags() & FT_SORTED) return true;
3651
3653 return false;
3654
3655 assert(ft_handler);
3656 return ((FT_INFO_EXT *)ft_handler)->could_you->get_flags() &
3658 }
3659
3660 /**
3661 Check whether FT result contains the document ID
3662
3663 @return true if document ID is available
3664 @return false otherwise
3665 */
3667 assert(ft_handler);
3668
3670 return false;
3671
3672 return ((FT_INFO_EXT *)ft_handler)->could_you->get_flags() &
3674 }
3675
3676 float get_filtering_effect(THD *thd, table_map filter_for_table,
3677 table_map read_tables,
3678 const MY_BITMAP *fields_to_ignore,
3679 double rows_in_table) override;
3680
3681 /**
3682 Returns master MATCH function.
3683
3684 @return pointer to master MATCH function.
3685 */
3687 if (master) return master->get_master();
3688 return this;
3689 }
3690
3691 /**
3692 Set master MATCH function and adjust used_in_where_only value.
3693
3694 @param item item for which master should be set.
3695 */
3698 item->master = this;
3699 }
3700
3701 /**
3702 Returns pointer to Ft_hints object belonging to master MATCH function.
3703
3704 @return pointer to Ft_hints object
3705 */
3707 assert(!master);
3708 return hints;
3709 }
3710
3711 /**
3712 Set comparison operation type and and value for master MATCH function.
3713
3714 @param type comparison operation type
3715 @param value_arg comparison operation value
3716 */
3717 void set_hints_op(enum ft_operation type, double value_arg) {
3718 assert(!master);
3719 hints->set_hint_op(type, value_arg);
3720 }
3721
3722 /**
3723 Set FT hints.
3724 */
3725 void set_hints(JOIN *join, uint ft_flag, ha_rows ft_limit, bool no_cond);
3726
3727 /**
3728 Check if ranking is not needed.
3729
3730 @return true if ranking is not needed
3731 @return false otherwise
3732 */
3734 assert(!master);
3735 return (!(hints->get_flags() & FT_SORTED) && // FT_SORTED is no set
3736 used_in_where_only && // MATCH result is not used
3737 // in expression
3738 hints->get_op_type() == FT_OP_NO); // MATCH is single function
3739 }
3740
3741 /**
3742 Set flag that the function is a simple expression.
3743
3744 @param val true if the function is a simple expression, false otherwise
3745 */
3746 void set_simple_expression(bool val) {
3747 assert(!master);
3748 simple_expression = val;
3749 }
3750
3751 /**
3752 Check if this MATCH function is a simple expression in WHERE condition.
3753
3754 @return true if simple expression
3755 @return false otherwise
3756 */
3758 assert(!master);
3759 return simple_expression;
3760 }
3761
3762 private:
3763 /**
3764 Fulltext index hints, initialized for master MATCH function only.
3765 */
3767 /**
3768 Flag is true when MATCH function is used as a simple expression in
3769 WHERE condition, i.e. there is no AND/OR combinations, just simple
3770 MATCH function or [MATCH, rank] comparison operation.
3771 */
3773 /**
3774 true if MATCH function is used in WHERE condition only.
3775 Used to determine what hints can be used for FT handler.
3776 Note that only master MATCH function has valid value.
3777 it's ok since only master function is involved in the hint processing.
3778 */
3780 /**
3781 Check whether storage engine for given table,
3782 allows FTS Boolean search on non-indexed columns.
3783
3784 @todo A flag should be added to the extended fulltext API so that
3785 it may be checked whether search on non-indexed columns are
3786 supported. Currently, it is not possible to check for such a
3787 flag since @c this->ft_handler is not yet set when this function is
3788 called. The current hack is to assume that search on non-indexed
3789 columns are supported for engines that does not support the extended
3790 fulltext API (e.g., MyISAM), while it is not supported for other
3791 engines (e.g., InnoDB)
3792
3793 @param tr Table for which storage engine to check
3794
3795 @retval true if BOOLEAN search on non-indexed columns is supported
3796 @retval false otherwise
3797 */
3799 // Only Boolean search may support non_indexed columns
3800 if (!(flags & FT_BOOL)) return false;
3801
3802 assert(tr && tr->file);
3803
3804 // Assume that if extended fulltext API is not supported,
3805 // non-indexed columns are allowed. This will be true for MyISAM.
3806 if ((tr->file->ha_table_flags() & HA_CAN_FULLTEXT_EXT) == 0) return true;
3807
3808 return false;
3809 }
3810};
3811
3812/**
3813 A visitor that calls the specified function on every non-aggregated full-text
3814 search function (Item_func_match) it encounters when it is used in a
3815 PREFIX+POSTFIX walk with WalkItem(). It skips every item that is wrapped in an
3816 aggregate function, and also every item wrapped in a reference, as the items
3817 behind the reference are already handled elsewhere (in another query block or
3818 in another element of the SELECT list).
3819 */
3821 public:
3823 std::function<bool(Item_func_match *)> func);
3824 bool operator()(Item *item);
3825
3826 private:
3827 std::function<bool(Item_func_match *)> m_func;
3828};
3829
3832
3834
3835 public:
3836 Item_func_is_free_lock(const POS &pos, Item *a) : Item_int_func(pos, a) {}
3837
3838 bool do_itemize(Parse_context *pc, Item **res) override;
3839 longlong val_int() override;
3840 const char *func_name() const override { return "is_free_lock"; }
3842 return INNER_TABLE_BIT;
3843 }
3844 bool resolve_type(THD *thd) override {
3845 if (param_type_is_default(thd, 0, 1)) return true;
3846 max_length = 1;
3847 set_nullable(true);
3848 return false;
3849 }
3850 bool is_non_const_over_literals(uchar *) override { return true; }
3851 bool check_function_as_value_generator(uchar *checker_args) override {
3853 pointer_cast<Check_function_as_value_generator_parameters *>(
3854 checker_args);
3855 func_arg->banned_function_name = func_name();
3856 return true;
3857 }
3858};
3859
3862
3864
3865 public:
3866 Item_func_is_used_lock(const POS &pos, Item *a) : Item_int_func(pos, a) {}
3867
3868 bool do_itemize(Parse_context *pc, Item **res) override;
3869 longlong val_int() override;
3870 const char *func_name() const override { return "is_used_lock"; }
3872 return INNER_TABLE_BIT;
3873 }
3874 bool resolve_type(THD *thd) override {
3875 if (param_type_is_default(thd, 0, 1)) return true;
3876 unsigned_flag = true;
3877 set_nullable(true);
3878 return false;
3879 }
3880 bool is_non_const_over_literals(uchar *) override { return true; }
3881 bool check_function_as_value_generator(uchar *checker_args) override {
3883 pointer_cast<Check_function_as_value_generator_parameters *>(
3884 checker_args);
3885 func_arg->banned_function_name = func_name();
3886 return true;
3887 }
3888};
3889
3892
3893 public:
3894 explicit Item_func_row_count(const POS &pos) : Item_int_func(pos) {}
3895
3896 bool do_itemize(Parse_context *pc, Item **res) override;
3897
3898 longlong val_int() override;
3899 const char *func_name() const override { return "row_count"; }
3900 bool resolve_type(THD *) override {
3901 set_nullable(false);
3902 return false;
3903 }
3904 bool check_function_as_value_generator(uchar *checker_args) override {
3906 pointer_cast<Check_function_as_value_generator_parameters *>(
3907 checker_args);
3908 func_arg->banned_function_name = func_name();
3909 return true;
3910 }
3911};
3912
3913/*
3914 *
3915 * Stored FUNCTIONs
3916 *
3917 */
3918
3919class sp_head;
3920class sp_name;
3921
3922class Item_func_sp final : public Item_func {
3924
3925 private:
3926 /// Holds the security definer context(if defined with SQL SECURITY DEFINER)
3927 /// and the error the handler.
3929 /// The name of the stored function
3930 sp_name *m_name{nullptr};
3931 /// Pointer to actual function instance (null when not resolved or executing)
3932 sp_head *m_sp{nullptr};
3933 /// The result field of the concrete stored function.
3935 /// true when function execution is deterministic
3936 bool m_deterministic{false};
3937
3938 bool execute();
3939 bool execute_impl(THD *thd);
3940 bool init_result_field(THD *thd);
3941
3942 protected:
3943 public:
3944 Item_func_sp(const POS &pos, const LEX_STRING &db_name,
3945 const LEX_STRING &fn_name, bool use_explicit_name,
3946 PT_item_list *opt_list);
3947
3948 bool do_itemize(Parse_context *pc, Item **res) override;
3949 /**
3950 Must not be called before the procedure is resolved,
3951 i.e. @c init_result_field().
3952 */
3953 table_map get_initial_pseudo_tables() const override;
3954 void update_used_tables() override;
3955 void fix_after_pullout(Query_block *parent_query_block,
3956 Query_block *removed_query_block) override;
3957 void cleanup() override;
3958
3959 const char *func_name() const override;
3960
3961 Field *tmp_table_field(TABLE *t_arg) override;
3962
3963 void make_field(Send_field *tmp_field) override;
3964
3965 Item_result result_type() const override;
3966
3967 longlong val_int() override;
3968 double val_real() override;
3969 bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override;
3970 bool get_time(MYSQL_TIME *ltime) override;
3971 my_decimal *val_decimal(my_decimal *dec_buf) override;
3972 String *val_str(String *str) override;
3973 bool val_json(Json_wrapper *result) override;
3974
3975 bool change_context_processor(uchar *arg) override {
3977 pointer_cast<Item_ident::Change_context *>(arg)->m_context;
3978 return false;
3979 }
3980
3981 bool sp_check_access(THD *thd);
3982 enum Functype functype() const override { return FUNC_SP; }
3983
3984 bool fix_fields(THD *thd, Item **ref) override;
3985 bool resolve_type(THD *thd) override;
3986
3988 bool check_function_as_value_generator(uchar *checker_args) override {
3990 pointer_cast<Check_function_as_value_generator_parameters *>(
3991 checker_args);
3992 func_arg->banned_function_name = func_name();
3993 return true;
3994 }
3995
3996 void compute_cost(CostOfItem *root_cost) const override {
3997 root_cost->MarkExpensive();
3998 }
3999};
4000
4003
4004 public:
4005 explicit Item_func_found_rows(const POS &pos) : Item_int_func(pos) {}
4006
4007 bool do_itemize(Parse_context *pc, Item **res) override;
4008 longlong val_int() override;
4009 const char *func_name() const override { return "found_rows"; }
4010 bool resolve_type(THD *) override {
4011 set_nullable(false);
4012 return false;
4013 }
4014 bool check_function_as_value_generator(uchar *checker_args) override {
4016 pointer_cast<Check_function_as_value_generator_parameters *>(
4017 checker_args);
4018 func_arg->banned_function_name = func_name();
4019 return true;
4020 }
4021};
4022
4023void uuid_short_init();
4024
4027
4028 public:
4030
4031 bool do_itemize(Parse_context *pc, Item **res) override;
4032 const char *func_name() const override { return "uuid_short"; }
4033 longlong val_int() override;
4034 bool resolve_type(THD *) override {
4035 unsigned_flag = true;
4036 return false;
4037 }
4038 bool check_partition_func_processor(uchar *) override { return false; }
4039 bool check_function_as_value_generator(uchar *checker_args) override {
4041 pointer_cast<Check_function_as_value_generator_parameters *>(
4042 checker_args);
4043 func_arg->banned_function_name = func_name();
4044 return ((func_arg->source == VGS_GENERATED_COLUMN) ||
4045 (func_arg->source == VGS_CHECK_CONSTRAINT));
4046 }
4047 // This function is random, see uuid_short_init().
4049 return RAND_TABLE_BIT;
4050 }
4051};
4052
4055
4056 public:
4057 explicit Item_func_version(const POS &pos);
4058
4059 bool do_itemize(Parse_context *pc, Item **res) override;
4060};
4061
4062/**
4063 Internal function used by INFORMATION_SCHEMA implementation to check
4064 if a role is a mandatory role.
4065*/
4066
4068 public:
4070 : Item_int_func(pos, a, b) {}
4071 longlong val_int() override;
4072 const char *func_name() const override {
4073 return "internal_is_mandatory_role";
4074 }
4075 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
4076 bool resolve_type(THD *) override {
4077 set_nullable(true);
4078 return false;
4079 }
4080};
4081
4083 public:
4085 : Item_int_func(pos) {}
4086 longlong val_int() override;
4087 const char *func_name() const override {
4088 return "internal_use_terminology_previous";
4089 }
4090 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
4091 bool resolve_type(THD *) override {
4092 set_nullable(true);
4093 return false;
4094 }
4095};
4096
4097/**
4098 Internal function used by INFORMATION_SCHEMA implementation to check
4099 if a role is enabled.
4100*/
4101
4103 public:
4105 : Item_int_func(pos, a, b) {}
4106 longlong val_int() override;
4107 const char *func_name() const override { return "internal_is_enabled_role"; }
4108 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
4109 bool resolve_type(THD *) override {
4110 set_nullable(true);
4111 return false;
4112 }
4113};
4114
4115/**
4116 Create new Item_func_get_system_var object
4117
4118 @param pc Parse context
4119
4120 @param scope Scope of the variable (GLOBAL, SESSION, PERSISTENT ...)
4121
4122 @param prefix Empty LEX_CSTRING{} or the left hand side of the composite
4123 variable name, e.g.:
4124 * component name of the component-registered variable
4125 * name of MyISAM Multiple Key Cache.
4126
4127 @param suffix Name of the variable (if prefix is empty) or the right
4128 hand side of the composite variable name, e.g.:
4129 * name of the component-registered variable
4130 * property name of MyISAM Multiple Key Cache variable.
4131
4132 @param unsafe_for_replication force writing this system variable to binlog
4133 (if not written yet)
4134
4135 @returns new item on success, otherwise nullptr
4136*/
4138 const LEX_CSTRING &prefix, const LEX_CSTRING &suffix,
4139 bool unsafe_for_replication);
4140
4142 const LEX_CSTRING &trivial_name,
4143 bool unsafe_for_replication) {
4144 return get_system_variable(pc, scope, {}, trivial_name,
4145 unsafe_for_replication);
4146}
4147
4148extern bool check_reserved_words(const char *name);
4149extern enum_field_types agg_field_type(Item **items, uint nitems);
4150double my_double_round(double value, longlong dec, bool dec_unsigned,
4151 bool truncate);
4152bool eval_const_cond(THD *thd, Item *cond, bool *value);
4154 Field **found = nullptr);
4155
4156void retrieve_tablespace_statistics(THD *thd, Item **args, bool *null_value);
4157
4159
4160extern bool volatile mqh_used;
4161
4162/// Checks if "item" is a function of the specified type.
4164
4165/// Checks if "item" contains a function of the specified type.
4167
4168#endif /* ITEM_FUNC_INCLUDED */
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:251
int64 query_id_t
Definition: binlog.h:72
Class to log audit event EVENT_TRACKING_GLOBAL_VARIABLE_GET.
Definition: item_func.h:3458
Audit_global_variable_get_event(THD *thd, Item_func_get_system_var *item, uchar cache_type)
Definition: item_func.cc:7200
THD * m_thd
Definition: item_func.h:3466
~Audit_global_variable_get_event()
Definition: item_func.cc:7213
bool m_audit_event
Definition: item_func.h:3485
Item_func_get_system_var * m_item
Definition: item_func.h:3469
uchar m_val_type
Definition: item_func.h:3478
This class represents the cost of evaluating an Item.
Definition: item.h:791
void MarkExpensive()
Definition: item.h:800
Definition: item.h:185
void set_numeric()
Definition: item.h:221
const CHARSET_INFO * collation
Definition: item.h:187
Definition: field.h:577
Wrapper for struct ft_hints.
Definition: handler.h:4137
uint get_flags() const
Get Ft_hints flags.
Definition: handler.h:4200
enum ft_operation get_op_type() const
Get Ft_hints operation type.
Definition: handler.h:4193
void set_hint_op(enum ft_operation type, double value)
Set comparison operation type and and value for master MATCH function.
Definition: handler.h:4155
Definition: item_func.h:1343
Item_dec_func(const POS &pos, Item *a)
Definition: item_func.h:1346
Item_dec_func(const POS &pos, Item *a, Item *b)
Definition: item_func.h:1348
Item_dec_func(Item *a)
Definition: item_func.h:1345
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.cc:2824
Definition: item.h:4385
Definition: item_func.h:1328
enum Functype functype() const override
Definition: item_func.h:1338
double real_op() override
Performs the operation that this functions implements when the result type is REAL.
Definition: item_func.cc:2793
bool check_function_as_value_generator(uchar *) override
Check if this item is allowed for a virtual column or inside a default expression.
Definition: item_func.h:1337
my_decimal * decimal_op(my_decimal *) override
Performs the operation that this functions implements when the result type is DECIMAL.
Definition: item_func.cc:2808
const char * func_name() const override
Definition: item_func.h:1334
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_func.h:1336
longlong int_op() override
Performs the operation that this functions implements when the result type is INT.
Definition: item_func.cc:2799
Item_func_abs(const POS &pos, Item *a)
Definition: item_func.h:1330
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.cc:2818
Definition: item_func.h:1408
const char * func_name() const override
Definition: item_func.h:1412
double val_real() override
Definition: item_func.cc:2922
enum Functype functype() const override
Definition: item_func.h:1413
Item_func_acos(const POS &pos, Item *a)
Definition: item_func.h:1410
Definition: item_func.h:1198
Item_func_additive_op(const POS &pos, Item *a, Item *b)
Definition: item_func.h:1201
Item_func_additive_op(Item *a, Item *b)
Definition: item_func.h:1200
void result_precision() override
Set precision of results for additive operations (+ and -)
Definition: item_func.cc:2205
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_func.h:1205
bool check_function_as_value_generator(uchar *) override
Check if this item is allowed for a virtual column or inside a default expression.
Definition: item_func.h:1206
Definition: item_func.h:1910
const char * func_name() const override
Definition: item_func.h:1916
longlong val_int() override
Definition: item_func.cc:4388
String value
Definition: item_func.h:1911
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:1917
Item_func_ascii(const POS &pos, Item *a)
Definition: item_func.h:1914
Definition: item_func.h:1416
double val_real() override
Definition: item_func.cc:2932
enum Functype functype() const override
Definition: item_func.h:1421
const char * func_name() const override
Definition: item_func.h:1420
Item_func_asin(const POS &pos, Item *a)
Definition: item_func.h:1418
Definition: item_func.h:1424
enum Functype functype() const override
Definition: item_func.h:1430
double val_real() override
Definition: item_func.cc:2940
Item_func_atan(const POS &pos, Item *a, Item *b)
Definition: item_func.h:1427
Item_func_atan(const POS &pos, Item *a)
Definition: item_func.h:1426
const char * func_name() const override
Definition: item_func.h:1429
Definition: item_func.h:2173
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_func.cc:5878
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2188
table_map get_initial_pseudo_tables() const override
Ensure that "benchmark()" is never optimized away.
Definition: item_func.h:2181
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_func.cc:5819
bool check_function_as_value_generator(uchar *checker_args) override
Check if this item is allowed for a virtual column or inside a default expression.
Definition: item_func.h:2197
Item_int_func super
Definition: item_func.h:2174
Item_func_benchmark(const POS &pos, Item *count_expr, Item *expr)
Definition: item_func.h:2177
longlong val_int() override
Definition: item_func.cc:5828
const char * func_name() const override
Definition: item_func.h:2187
Definition: item_func.h:2045
longlong int_op() override
Performs the operation on integers to produce a result of type INT_RESULT.
Definition: item_func.h:2052
const char * func_name() const override
Definition: item_func.h:2049
Item_func_bit_and(const POS &pos, Item *a, Item *b)
Definition: item_func.h:2047
String * str_op(String *str) override
Performs the operation on binary strings to produce a result of type STRING_RESULT.
Definition: item_func.h:2053
Definition: item_func.h:2071
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2076
longlong val_int() override
Definition: item_func.cc:4528
const char * func_name() const override
Definition: item_func.h:2075
Item_func_bit_count(const POS &pos, Item *a)
Definition: item_func.h:2073
Definition: item_func.h:1820
const char * func_name() const override
Definition: item_func.h:1827
longlong val_int() override
Definition: item_func.h:1823
Item_func_bit_length(const POS &pos, Item *a)
Definition: item_func.h:1822
Definition: item_func.h:2124
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_func.h:2133
Item_func_bit_neg(const POS &pos, Item *a)
Definition: item_func.h:2131
longlong int_op() override
Performs the operation on integers to produce a result of type INT_RESULT.
Definition: item_func.cc:3174
bool binary_result_requires_binary_second_arg() const override
Definition: item_func.h:2126
String * str_op(String *str) override
Performs the operation on binary strings to produce a result of type STRING_RESULT.
Definition: item_func.cc:3182
const char * func_name() const override
Definition: item_func.h:2132
Definition: item_func.h:2032
const char * func_name() const override
Definition: item_func.h:2036
String * str_op(String *str) override
Performs the operation on binary strings to produce a result of type STRING_RESULT.
Definition: item_func.h:2040
longlong int_op() override
Performs the operation on integers to produce a result of type INT_RESULT.
Definition: item_func.h:2039
Item_func_bit_or(const POS &pos, Item *a, Item *b)
Definition: item_func.h:2034
Base class for all the bit functions that work with two binary arguments: '&', '|',...
Definition: item_func.h:2017
String * eval_str_op(String *, Char_func char_func, Int_func int_func)
Template function that evaluates the bitwise operation over binary arguments.
Definition: item_func.cc:3240
bool binary_result_requires_binary_second_arg() const override
Definition: item_func.h:2019
longlong eval_int_op(Int_func int_func)
Template function used to evaluate the bitwise operation over int arguments.
Definition: item_func.cc:3214
Item_func_bit_two_param(const POS &pos, Item *a, Item *b)
Definition: item_func.h:2028
Definition: item_func.h:2058
const char * func_name() const override
Definition: item_func.h:2062
Item_func_bit_xor(const POS &pos, Item *a, Item *b)
Definition: item_func.h:2060
longlong int_op() override
Performs the operation on integers to produce a result of type INT_RESULT.
Definition: item_func.h:2065
String * str_op(String *str) override
Performs the operation on binary strings to produce a result of type STRING_RESULT.
Definition: item_func.h:2066
Definition: item_func.h:1955
virtual longlong int_op()=0
Performs the operation on integers to produce a result of type INT_RESULT.
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_func.h:1979
String tmp_value
Buffer storing the determined value.
Definition: item_func.h:1960
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.cc:2986
virtual bool binary_result_requires_binary_second_arg() const =0
my_decimal * val_decimal(my_decimal *decimal_value) override
Definition: item_func.cc:3047
double val_real() override
Definition: item_func.cc:3031
String * val_str(String *str) override
Definition: item_func.cc:3055
Item_result hybrid_type
Stores the Item's result type. Can only be INT_RESULT or STRING_RESULT.
Definition: item_func.h:1958
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_func.h:1983
longlong val_int() override
Definition: item_func.cc:3015
Item_func_bit(const POS &pos, Item *a)
Definition: item_func.h:1969
virtual String * str_op(String *)=0
Performs the operation on binary strings to produce a result of type STRING_RESULT.
enum Item_result result_type() const override
Definition: item_func.h:1972
Item_func_bit(const POS &pos, Item *a, Item *b)
Definition: item_func.h:1968
bool get_time(MYSQL_TIME *ltime) override
Definition: item_func.h:1989
Definition: item_func.h:2638
const char * func_name() const override
Definition: item_func.h:2643
longlong val_int() override
INFORMATION_SCHEMA picks metadata from DD using system views.
Definition: item_func.cc:9126
Item_func_can_access_column(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_func.h:2640
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2644
Internal functions used by INFORMATION_SCHEMA implementation to check if user have access to given da...
Definition: item_func.h:2540
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2546
Item_func_can_access_database(const POS &pos, Item *a)
Definition: item_func.h:2542
longlong val_int() override
INFORMATION_SCHEMA picks metadata from DD using system views.
Definition: item_func.cc:8718
const char * func_name() const override
Definition: item_func.h:2545
Definition: item_func.h:2602
Item_func_can_access_event(const POS &pos, Item *a)
Definition: item_func.h:2604
const char * func_name() const override
Definition: item_func.h:2606
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2607
longlong val_int() override
INFORMATION_SCHEMA picks metadata from DD using system views.
Definition: item_func.cc:9011
Definition: item_func.h:2613
const char * func_name() const override
Definition: item_func.h:2618
Item_func_can_access_resource_group(const POS &pos, Item *a)
Definition: item_func.h:2615
longlong val_int() override
INFORMATION_SCHEMA picks metadata from DD using system views.
Definition: item_func.cc:9063
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2619
Definition: item_func.h:2589
Item_func_can_access_routine(const POS &pos, PT_item_list *list)
Definition: item_func.h:2591
const char * func_name() const override
Definition: item_func.h:2594
longlong val_int() override
INFORMATION_SCHEMA picks metadata from DD using system views.
Definition: item_func.cc:8928
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2595
Definition: item_func.h:2552
const char * func_name() const override
Definition: item_func.h:2557
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2558
Item_func_can_access_table(const POS &pos, Item *a, Item *b)
Definition: item_func.h:2554
longlong val_int() override
INFORMATION_SCHEMA picks metadata from new DD using system views.
Definition: item_func.cc:8842
Definition: item_func.h:2576
Item_func_can_access_trigger(const POS &pos, Item *a, Item *b)
Definition: item_func.h:2578
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2582
longlong val_int() override
INFORMATION_SCHEMA picks metadata from new DD using system views.
Definition: item_func.cc:8906
const char * func_name() const override
Definition: item_func.h:2581
Definition: item_func.h:2564
const char * func_name() const override
Definition: item_func.h:2569
Item_func_can_access_user(const POS &pos, Item *a, Item *b)
Definition: item_func.h:2566
longlong val_int() override
INFORMATION_SCHEMA picks metadata from new DD using system views.
Definition: item_func.cc:8865
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2570
Definition: item_func.h:2626
longlong val_int() override
INFORMATION_SCHEMA picks metadata from DD using system views.
Definition: item_func.cc:9201
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2632
Item_func_can_access_view(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_func.h:2628
const char * func_name() const override
Definition: item_func.h:2631
Definition: item_func.h:1472
bool check_function_as_value_generator(uchar *) override
Check if this item is allowed for a virtual column or inside a default expression.
Definition: item_func.h:1481
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_func.h:1480
const char * func_name() const override
Definition: item_func.h:1476
enum Functype functype() const override
Definition: item_func.h:1482
double real_op() override
Performs the operation that this functions implements when the result type is REAL.
Definition: item_func.cc:3401
my_decimal * decimal_op(my_decimal *) override
Performs the operation that this functions implements when the result type is DECIMAL.
Definition: item_func.cc:3407
Item_func_ceiling(const POS &pos, Item *a)
Definition: item_func.h:1475
longlong int_op() override
Performs the operation that this functions implements when the result type is INT.
Definition: item_func.cc:3380
Item_func_ceiling(Item *a)
Definition: item_func.h:1474
Definition: item_func.h:1830
Item_func_char_length(Item *a)
Definition: item_func.h:1834
Item_func_char_length(const POS &pos, Item *a)
Definition: item_func.h:1835
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:1838
longlong val_int() override
Definition: item_func.cc:4240
const char * func_name() const override
Definition: item_func.h:1837
String value
Definition: item_func.h:1831
Definition: item_func.h:1844
const char * func_name() const override
Definition: item_func.h:1850
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:1851
longlong val_int() override
Definition: item_func.cc:4251
Item_func_coercibility(const POS &pos, Item *a)
Definition: item_func.h:1846
Definition: item_func.h:1080
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.cc:1486
table_map get_initial_pseudo_tables() const override
Returns the pseudo tables depended upon in order to evaluate this function expression.
Definition: item_func.h:1086
Item_int_func super
Definition: item_func.h:1081
const char * func_name() const override
Definition: item_func.h:1090
bool check_function_as_value_generator(uchar *checker_args) override
Check if this item is allowed for a virtual column or inside a default expression.
Definition: item_func.h:1094
Item_func_connection_id(const POS &pos)
Definition: item_func.h:1084
longlong val_int() override
Definition: item_func.cc:1498
bool fix_fields(THD *thd, Item **ref) override
Definition: item_func.cc:1492
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_func.cc:1479
Definition: item_func.h:1433
enum Functype functype() const override
Definition: item_func.h:1438
const char * func_name() const override
Definition: item_func.h:1437
double val_real() override
Definition: item_func.cc:2952
Item_func_cos(const POS &pos, Item *a)
Definition: item_func.h:1435
Definition: item_func.h:1457
const char * func_name() const override
Definition: item_func.h:1461
enum Functype functype() const override
Definition: item_func.h:1462
double val_real() override
Definition: item_func.cc:2973
Item_func_cot(const POS &pos, Item *a)
Definition: item_func.h:1459
Definition: item_func.h:1584
Item_func_degrees(const POS &pos, Item *a)
Definition: item_func.h:1586
const char * func_name() const override
Definition: item_func.h:1588
enum Functype functype() const override
Definition: item_func.h:1589
Definition: item_func.h:1257
Item_func_div_base(const POS &pos, Item *a, Item *b)
Definition: item_func.h:1259
Item_func_div_base(Item *a, Item *b)
Definition: item_func.h:1261
uint m_prec_increment
Definition: item_func.h:1268
my_decimal * decimal_op(my_decimal *) override
Performs the operation that this functions implements when the result type is DECIMAL.
Definition: item_func.cc:2461
double real_op() override
Performs the operation that this functions implements when the result type is REAL.
Definition: item_func.cc:2446
longlong int_op() override
Performs the operation that this functions implements when the result type is INT.
Definition: item_func.cc:2551
enum Functype functype() const override
Definition: item_func.h:1265
Definition: item_func.h:1280
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.cc:2613
void set_numeric_type() override
Check arguments to determine the data type for a numeric function of two arguments.
Definition: item_func.cc:2624
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_func.h:1292
Item_func_div_int(const POS &pos, Item *a, Item *b)
Definition: item_func.h:1283
enum_field_types default_data_type() const override
Get the default data (output) type for the specific item.
Definition: item_func.h:1286
bool check_function_as_value_generator(uchar *) override
Check if this item is allowed for a virtual column or inside a default expression.
Definition: item_func.h:1293
void result_precision() override
Definition: item_func.cc:2497
const char * func_name() const override
Definition: item_func.h:1285
Item_func_div_int(Item *a, Item *b)
Definition: item_func.h:1282
Definition: item_func.h:1271
void result_precision() override
Definition: item_func.cc:2480
Item_func_div(const POS &pos, Item *a, Item *b)
Definition: item_func.h:1273
const char * func_name() const override
Definition: item_func.h:1275
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.cc:2517
Definition: item_func.h:1352
double val_real() override
Definition: item_func.cc:2895
enum Functype functype() const override
Definition: item_func.h:1357
const char * func_name() const override
Definition: item_func.h:1356
Item_func_exp(const POS &pos, Item *a)
Definition: item_func.h:1354
Definition: item_func.h:1898
String value
Definition: item_func.h:1899
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.cc:4373
const char * func_name() const override
Definition: item_func.h:1906
String tmp
Definition: item_func.h:1899
Item_func_field(const POS &pos, PT_item_list *opt_list)
Definition: item_func.h:1903
longlong val_int() override
Definition: item_func.cc:4330
Item_result cmp_type
Definition: item_func.h:1900
Definition: item_func.h:1932
const CHARSET_INFO * compare_collation() const override
Definition: item_func.h:1948
const char * func_name() const override
Definition: item_func.h:1946
Item_func_find_in_set(const POS &pos, Item *a, Item *b)
Definition: item_func.h:1943
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.cc:4422
longlong val_int() override
Definition: item_func.cc:4450
String value2
Definition: item_func.h:1933
DTCollation cmp_collation
Definition: item_func.h:1940
uint m_enum_value
Definition: item_func.h:1939
String value
Definition: item_func.h:1933
Definition: item_func.h:1485
my_decimal * decimal_op(my_decimal *) override
Performs the operation that this functions implements when the result type is DECIMAL.
Definition: item_func.cc:3443
const char * func_name() const override
Definition: item_func.h:1489
bool check_function_as_value_generator(uchar *) override
Check if this item is allowed for a virtual column or inside a default expression.
Definition: item_func.h:1494
double real_op() override
Performs the operation that this functions implements when the result type is REAL.
Definition: item_func.cc:3437
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_func.h:1493
Item_func_floor(const POS &pos, Item *a)
Definition: item_func.h:1488
Item_func_floor(Item *a)
Definition: item_func.h:1487
longlong int_op() override
Performs the operation that this functions implements when the result type is INT.
Definition: item_func.cc:3416
enum Functype functype() const override
Definition: item_func.h:1495
Definition: item_func.h:4001
Item_func_found_rows(const POS &pos)
Definition: item_func.h:4005
longlong val_int() override
Definition: item_func.cc:8479
bool check_function_as_value_generator(uchar *checker_args) override
Check if this item is allowed for a virtual column or inside a default expression.
Definition: item_func.h:4014
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_func.cc:8468
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:4010
Item_int_func super
Definition: item_func.h:4002
const char * func_name() const override
Definition: item_func.h:4009
Definition: item_func.h:2848
const char * func_name() const override
Definition: item_func.h:2858
longlong val_int() override
INFORMATION_SCHEMA picks metadata from DD using system views.
Definition: item_func.cc:10044
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2853
Item_func_get_dd_index_sub_part_length(const POS &pos, PT_item_list *list)
Definition: item_func.h:2850
Definition: item_func.h:2399
bool check_function_as_value_generator(uchar *checker_args) override
Check if this item is allowed for a virtual column or inside a default expression.
Definition: item_func.h:2422
table_map get_initial_pseudo_tables() const override
Returns the pseudo tables depended upon in order to evaluate this function expression.
Definition: item_func.h:2411
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2414
Item_int_func super
Definition: item_func.h:2400
Item_func_get_lock(const POS &pos, Item *a, Item *b)
Definition: item_func.h:2405
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_func.cc:5495
const char * func_name() const override
Definition: item_func.h:2410
String value
Definition: item_func.h:2402
bool is_non_const_over_literals(uchar *) override
Definition: item_func.h:2421
longlong val_int() override
Get a user level lock.
Definition: item_func.cc:5520
Definition: item_func.h:3488
const enum_var_type var_scope
Definition: item_func.h:3489
table_map get_initial_pseudo_tables() const override
Returns the pseudo tables depended upon in order to evaluate this function expression.
Definition: item_func.h:3507
longlong get_sys_var_safe(THD *thd, sys_var *var)
Definition: item_func.cc:7248
bool eq_specific(const Item *item) const override
Provide a more specific equality check for a function.
Definition: item_func.cc:7526
longlong cached_llval
Definition: item_func.h:3490
enum Functype functype() const override
Definition: item_func.h:3506
Item_func_get_system_var(const System_variable_tracker &, enum_var_type scope)
Definition: item_func.cc:7148
double val_real() override
Definition: item_func.cc:7439
String cached_strval
Definition: item_func.h:3492
const char * func_name() const override
Definition: item_func.h:3525
longlong val_int() override
Definition: item_func.cc:7263
const System_variable_tracker var_tracker
Definition: item_func.h:3496
query_id_t used_query_id
Definition: item_func.h:3494
bool is_valid_for_pushdown(uchar *arg) override
Check if all the columns present in this expression are from the derived table.
Definition: item_func.h:3527
bool cached_null_value
Definition: item_func.h:3493
uchar cache_present
Definition: item_func.h:3495
double cached_dval
Definition: item_func.h:3491
enum Item_result result_type() const override
Definition: item_func.h:3514
bool is_non_const_over_literals(uchar *) override
Definition: item_func.h:3513
String * val_str(String *) override
Definition: item_func.cc:7346
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.cc:7154
my_decimal * val_decimal(my_decimal *dec_buf) override
Definition: item_func.h:3521
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_func.cc:7532
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_func.cc:7195
Definition: item_func.h:3366
Name_string name
Definition: item_func.h:3371
enum Item_result result_type() const override
Definition: item_func.cc:7055
double val_real() override
Definition: item_func.cc:6705
const CHARSET_INFO * charset_for_protocol() override
Definition: item_func.cc:6739
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.cc:6903
Item_func_get_user_var(Name_string a)
Definition: item_func.h:3373
String * val_str(String *str) override
Definition: item_func.cc:6677
bool propagate_type(THD *thd, const Type_properties &type) override
Default implementation for all functions: Propagate base_item's type into all arguments.
Definition: item_func.cc:6962
enum Functype functype() const override
Definition: item_func.h:3378
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_func.cc:7059
Settable_routine_parameter * get_settable_routine_parameter() override
Definition: item_func.h:3403
user_var_entry * var_entry
Definition: item_func.h:3367
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_func.cc:7046
const char * func_name() const override
Definition: item_func.h:3395
bool set_value(THD *thd, sp_rcontext *ctx, Item **it) override
Definition: item_func.cc:7072
longlong val_int() override
Definition: item_func.cc:6725
Item_result m_cached_result_type
Definition: item_func.h:3368
my_decimal * val_decimal(my_decimal *) override
Definition: item_func.cc:6715
bool eq_specific(const Item *item) const override
Provide a more specific equality check for a function.
Definition: item_func.cc:7066
void update_used_tables() override
Updates used tables, not null tables information and accumulates properties up the item tree,...
Definition: item_func.h:3387
Item_func_get_user_var(const POS &pos, Name_string a)
Definition: item_func.h:3375
bool is_non_const_over_literals(uchar *) override
Definition: item_func.h:3396
Definition: item_func.h:1875
Item_func_instr(const POS &pos, Item *a, Item *b)
Definition: item_func.h:1877
const char * func_name() const override
Definition: item_func.h:1880
Definition: item_func.h:1465
bool resolve_type_inner(THD *thd) override
Resolve type of function after all arguments have had their data types resolved.
Definition: item_func.cc:3318
Item_func_int_val(const POS &pos, Item *a)
Definition: item_func.h:1468
Item_func_int_val(Item *a)
Definition: item_func.h:1467
Definition: item_func.h:2757
longlong val_int() override
Definition: item_func.cc:9551
Item_func_internal_auto_increment(const POS &pos, PT_item_list *list)
Definition: item_func.h:2759
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2764
const char * func_name() const override
Definition: item_func.h:2763
enum Functype functype() const override
Definition: item_func.h:2761
Definition: item_func.h:2682
const char * func_name() const override
Definition: item_func.h:2688
Item_func_internal_avg_row_length(const POS &pos, PT_item_list *list)
Definition: item_func.h:2684
longlong val_int() override
Definition: item_func.cc:9502
enum Functype functype() const override
Definition: item_func.h:2686
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2689
Definition: item_func.h:2772
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2779
const char * func_name() const override
Definition: item_func.h:2778
Item_func_internal_checksum(const POS &pos, PT_item_list *list)
Definition: item_func.h:2774
longlong val_int() override
Definition: item_func.cc:9563
enum Functype functype() const override
Definition: item_func.h:2776
Definition: item_func.h:2742
enum Functype functype() const override
Definition: item_func.h:2746
const char * func_name() const override
Definition: item_func.h:2748
Item_func_internal_data_free(const POS &pos, PT_item_list *list)
Definition: item_func.h:2744
longlong val_int() override
Definition: item_func.cc:9539
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2749
Definition: item_func.h:2697
longlong val_int() override
Definition: item_func.cc:9512
const char * func_name() const override
Definition: item_func.h:2703
Item_func_internal_data_length(const POS &pos, PT_item_list *list)
Definition: item_func.h:2699
enum Functype functype() const override
Definition: item_func.h:2701
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2704
Definition: item_func.h:2816
longlong val_int() override
Definition: item_func.cc:9905
Item_func_internal_dd_char_length(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_func.h:2818
const char * func_name() const override
Definition: item_func.h:2822
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2823
Item_func_internal_get_view_warning_or_error(const POS &pos, PT_item_list *list)
Definition: item_func.h:2833
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2840
longlong val_int() override
Definition: item_func.cc:9984
const char * func_name() const override
Definition: item_func.h:2837
longlong val_int() override
INFORMATION_SCHEMA picks metadata from DD using system views.
Definition: item_func.cc:9638
Item_func_internal_index_column_cardinality(const POS &pos, PT_item_list *list)
Definition: item_func.h:2801
enum Functype functype() const override
Definition: item_func.h:2804
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2809
const char * func_name() const override
Definition: item_func.h:2806
Definition: item_func.h:2727
Item_func_internal_index_length(const POS &pos, PT_item_list *list)
Definition: item_func.h:2729
longlong val_int() override
Definition: item_func.cc:9530
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2734
enum Functype functype() const override
Definition: item_func.h:2731
const char * func_name() const override
Definition: item_func.h:2733
Internal function used by INFORMATION_SCHEMA implementation to check if a role is enabled.
Definition: item_func.h:4102
longlong val_int() override
Internal function used by INFORMATION_SCHEMA implementation to check if a role enabled.
Definition: item_func.cc:10164
enum Functype functype() const override
Definition: item_func.h:4108
Item_func_internal_is_enabled_role(const POS &pos, Item *a, Item *b)
Definition: item_func.h:4104
const char * func_name() const override
Definition: item_func.h:4107
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:4109
Internal function used by INFORMATION_SCHEMA implementation to check if a role is a mandatory role.
Definition: item_func.h:4067
longlong val_int() override
Internal function used by INFORMATION_SCHEMA implementation to check if a role is a mandatory role.
Definition: item_func.cc:10101
Item_func_internal_is_mandatory_role(const POS &pos, Item *a, Item *b)
Definition: item_func.h:4069
const char * func_name() const override
Definition: item_func.h:4072
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:4076
enum Functype functype() const override
Definition: item_func.h:4075
Definition: item_func.h:2786
Item_func_internal_keys_disabled(const POS &pos, Item *a)
Definition: item_func.h:2788
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2792
longlong val_int() override
INFORMATION_SCHEMA picks metadata from DD using system views.
Definition: item_func.cc:9590
const char * func_name() const override
Definition: item_func.h:2791
Definition: item_func.h:2712
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2719
const char * func_name() const override
Definition: item_func.h:2718
Item_func_internal_max_data_length(const POS &pos, PT_item_list *list)
Definition: item_func.h:2714
enum Functype functype() const override
Definition: item_func.h:2716
longlong val_int() override
Definition: item_func.cc:9521
Definition: item_func.h:2667
enum Functype functype() const override
Definition: item_func.h:2671
longlong val_int() override
Definition: item_func.cc:9490
Item_func_internal_table_rows(const POS &pos, PT_item_list *list)
Definition: item_func.h:2669
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2674
const char * func_name() const override
Definition: item_func.h:2673
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:3012
Item_func_internal_tablespace_autoextend_size(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_func.h:3001
longlong val_int() override
Definition: item_func.cc:9848
enum Functype functype() const override
Definition: item_func.h:3005
const char * func_name() const override
Definition: item_func.h:3008
Definition: item_func.h:3039
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:3052
Item_func_internal_tablespace_data_free(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_func.h:3041
longlong val_int() override
Definition: item_func.cc:9881
const char * func_name() const override
Definition: item_func.h:3048
enum Functype functype() const override
Definition: item_func.h:3045
Definition: item_func.h:2939
Item_func_internal_tablespace_extent_size(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_func.h:2941
enum Functype functype() const override
Definition: item_func.h:2945
longlong val_int() override
Definition: item_func.cc:9801
const char * func_name() const override
Definition: item_func.h:2948
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2952
Definition: item_func.h:2899
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2912
enum Functype functype() const override
Definition: item_func.h:2905
const char * func_name() const override
Definition: item_func.h:2908
Item_func_internal_tablespace_free_extents(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_func.h:2901
longlong val_int() override
Definition: item_func.cc:9771
Definition: item_func.h:2863
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2871
enum Functype functype() const override
Definition: item_func.h:2868
Item_func_internal_tablespace_id(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_func.h:2865
longlong val_int() override
Definition: item_func.cc:9738
const char * func_name() const override
Definition: item_func.h:2870
Definition: item_func.h:2959
longlong val_int() override
Definition: item_func.cc:9816
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2972
const char * func_name() const override
Definition: item_func.h:2968
Item_func_internal_tablespace_initial_size(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_func.h:2961
enum Functype functype() const override
Definition: item_func.h:2965
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2892
enum Functype functype() const override
Definition: item_func.h:2885
longlong val_int() override
Definition: item_func.cc:9753
Item_func_internal_tablespace_logfile_group_number(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_func.h:2881
const char * func_name() const override
Definition: item_func.h:2888
Definition: item_func.h:2979
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2992
Item_func_internal_tablespace_maximum_size(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_func.h:2981
const char * func_name() const override
Definition: item_func.h:2988
longlong val_int() override
Definition: item_func.cc:9831
enum Functype functype() const override
Definition: item_func.h:2985
longlong val_int() override
Definition: item_func.cc:9786
enum Functype functype() const override
Definition: item_func.h:2925
Item_func_internal_tablespace_total_extents(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_func.h:2921
const char * func_name() const override
Definition: item_func.h:2928
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2932
Definition: item_func.h:3019
Item_func_internal_tablespace_version(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_func.h:3021
longlong val_int() override
Definition: item_func.cc:9864
const char * func_name() const override
Definition: item_func.h:3028
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:3032
enum Functype functype() const override
Definition: item_func.h:3025
const char * func_name() const override
Definition: item_func.h:4087
longlong val_int() override
Definition: item_func.cc:10135
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:4091
Item_func_internal_use_terminology_previous(const POS &pos)
Definition: item_func.h:4084
enum Functype functype() const override
Definition: item_func.h:4090
Definition: item_func.h:3830
longlong val_int() override
Check if user level lock is free.
Definition: item_func.cc:5723
Item_func_is_free_lock(const POS &pos, Item *a)
Definition: item_func.h:3836
const char * func_name() const override
Definition: item_func.h:3840
Item_int_func super
Definition: item_func.h:3831
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:3844
bool is_non_const_over_literals(uchar *) override
Definition: item_func.h:3850
table_map get_initial_pseudo_tables() const override
Returns the pseudo tables depended upon in order to evaluate this function expression.
Definition: item_func.h:3841
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_func.cc:5699
bool check_function_as_value_generator(uchar *checker_args) override
Check if this item is allowed for a virtual column or inside a default expression.
Definition: item_func.h:3851
String value
Definition: item_func.h:3833
Definition: item_func.h:3860
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:3874
Item_func_is_used_lock(const POS &pos, Item *a)
Definition: item_func.h:3866
bool check_function_as_value_generator(uchar *checker_args) override
Check if this item is allowed for a virtual column or inside a default expression.
Definition: item_func.h:3881
Item_int_func super
Definition: item_func.h:3861
String value
Definition: item_func.h:3863
const char * func_name() const override
Definition: item_func.h:3870
longlong val_int() override
Check if user level lock is used and return connection id of owner.
Definition: item_func.cc:5766
table_map get_initial_pseudo_tables() const override
Returns the pseudo tables depended upon in order to evaluate this function expression.
Definition: item_func.h:3871
bool is_non_const_over_literals(uchar *) override
Definition: item_func.h:3880
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_func.cc:5745
Definition: item_func.h:2650
Item_func_is_visible_dd_object(const POS &pos, Item *a, Item *b)
Definition: item_func.h:2654
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2660
Item_func_is_visible_dd_object(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_func.h:2656
const char * func_name() const override
Definition: item_func.h:2659
longlong val_int() override
Skip hidden tables, columns, indexes and index elements.
Definition: item_func.cc:9334
Item_func_is_visible_dd_object(const POS &pos, Item *a)
Definition: item_func.h:2652
Definition: item_func.h:2143
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2159
const char * func_name() const override
Definition: item_func.h:2153
Item_func_last_insert_id(const POS &pos, Item *a)
Definition: item_func.h:2149
Item_func_last_insert_id()
Definition: item_func.h:2147
table_map get_initial_pseudo_tables() const override
Returns the pseudo tables depended upon in order to evaluate this function expression.
Definition: item_func.h:2155
longlong val_int() override
Definition: item_func.cc:5798
bool check_function_as_value_generator(uchar *checker_args) override
Check if this item is allowed for a virtual column or inside a default expression.
Definition: item_func.h:2164
Item_int_func super
Definition: item_func.h:2144
Item_func_last_insert_id(const POS &pos)
Definition: item_func.h:2148
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_func.cc:5790
Definition: item_func.h:1783
Item_func_length(const POS &pos, Item *a)
Definition: item_func.h:1787
String value
Definition: item_func.h:1784
const char * func_name() const override
Definition: item_func.h:1789
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:1790
longlong val_int() override
Definition: item_func.cc:4214
Definition: item_func.h:1360
double val_real() override
Gateway to natural LOG function.
Definition: item_func.cc:2835
enum Functype functype() const override
Definition: item_func.h:1365
const char * func_name() const override
Definition: item_func.h:1364
Item_func_ln(const POS &pos, Item *a)
Definition: item_func.h:1362
Definition: item_func.h:1858
String value1
Definition: item_func.h:1859
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_func.cc:4309
longlong val_int() override
Definition: item_func.cc:4271
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.cc:4257
Item_func_locate(Item *a, Item *b)
Definition: item_func.h:1862
Item_func_locate(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_func.h:1865
const char * func_name() const override
Definition: item_func.h:1868
Item_func_locate(const POS &pos, Item *a, Item *b)
Definition: item_func.h:1863
String value2
Definition: item_func.h:1859
Definition: item_func.h:1384
double val_real() override
Definition: item_func.cc:2884
enum Functype functype() const override
Definition: item_func.h:1389
const char * func_name() const override
Definition: item_func.h:1388
Item_func_log10(const POS &pos, Item *a)
Definition: item_func.h:1386
Definition: item_func.h:1377
double val_real() override
Definition: item_func.cc:2872
const char * func_name() const override
Definition: item_func.h:1381
Item_func_log2(const POS &pos, Item *a)
Definition: item_func.h:1379
Definition: item_func.h:1368
Item_func_log(const POS &pos, Item *a)
Definition: item_func.h:1370
double val_real() override
Extended but so slower LOG function.
Definition: item_func.cc:2852
Item_func_log(const POS &pos, Item *a, Item *b)
Definition: item_func.h:1371
const char * func_name() const override
Definition: item_func.h:1373
enum Functype functype() const override
Definition: item_func.h:1374
Definition: item_func.h:3539
uint flags
Definition: item_func.h:3547
FT_INFO * ft_handler
Definition: item_func.h:3553
DTCollation cmp_collation
Definition: item_func.h:3552
void update_used_tables() override
Updates used tables, not null tables information and accumulates properties up the item tree,...
Definition: item_func.cc:7795
bool fix_index(const THD *thd)
Definition: item_func.cc:7802
Item * key_item() const override
Definition: item_func.h:3602
uint key
Definition: item_func.h:3547
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_func.cc:7934
bool check_function_as_value_generator(uchar *checker_args) override
Check if this item is allowed for a virtual column or inside a default expression.
Definition: item_func.h:3619
bool allows_search_on_non_indexed_columns(const TABLE *tr)
Check whether storage engine for given table, allows FTS Boolean search on non-indexed columns.
Definition: item_func.h:3798
void set_master(Item_func_match *item)
Set master MATCH function and adjust used_in_where_only value.
Definition: item_func.h:3696
longlong val_int() override
Definition: item_func.h:3609
Item_func_match * master
Master item means that if identical items are present in the statement, they use the same FT handler.
Definition: item_func.h:3561
Ft_hints * hints
Fulltext index hints, initialized for master MATCH function only.
Definition: item_func.h:3766
const char * func_name() const override
Definition: item_func.h:3604
bool docid_in_result()
Check whether FT result contains the document ID.
Definition: item_func.h:3666
Item * concat_ws
Definition: item_func.h:3562
bool can_skip_ranking()
Check if ranking is not needed.
Definition: item_func.h:3733
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_func.h:3591
void set_hints_op(enum ft_operation type, double value_arg)
Set comparison operation type and and value for master MATCH function.
Definition: item_func.h:3717
Table_ref * table_ref
Definition: item_func.h:3554
bool ordered_result()
Check whether FT result is ordered on rank.
Definition: item_func.h:3648
bool init_search(THD *thd)
Initialize searching within full-text index.
Definition: item_func.cc:7566
String value
Definition: item_func.h:3563
enum Functype functype() const override
Definition: item_func.h:3603
void set_hints(JOIN *join, uint ft_flag, ha_rows ft_limit, bool no_cond)
Set FT hints.
Definition: item_func.cc:7966
Item_func_match(const POS &pos, PT_item_list *a, Item *against_arg, uint b)
Constructor for Item_func_match class.
Definition: item_func.h:3574
Item * against
Definition: item_func.h:3546
float get_filtering_effect(THD *thd, table_map filter_for_table, table_map read_tables, const MY_BITMAP *fields_to_ignore, double rows_in_table) override
Calculate the filter contribution that is relevant for table 'filter_for_table' for this item.
Definition: item_func.cc:7642
bool fix_fields(THD *thd, Item **ref) override
Definition: item_func.cc:7671
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_func.cc:7538
bool used_in_where_only
true if MATCH function is used in WHERE condition only.
Definition: item_func.h:3779
String search_value
Definition: item_func.h:3564
bool is_simple_expression()
Check if this MATCH function is a simple expression in WHERE condition.
Definition: item_func.h:3757
Ft_hints * get_hints()
Returns pointer to Ft_hints object belonging to master MATCH function.
Definition: item_func.h:3706
void add_json_info(Json_object *obj) override
Add all the node-specific json fields.
Definition: item_func.cc:7947
bool score_from_index_scan
True if we are doing a full-text index scan with this MATCH function as a predicate,...
Definition: item_func.h:3551
void set_simple_expression(bool val)
Set flag that the function is a simple expression.
Definition: item_func.h:3746
double val_real() override
Definition: item_func.cc:7902
bool simple_expression
Flag is true when MATCH function is used as a simple expression in WHERE condition,...
Definition: item_func.h:3772
Item_func_match * get_master()
Returns master MATCH function.
Definition: item_func.h:3686
bool eq_specific(const Item *item) const override
Provide a more specific equality check for a function.
Definition: item_func.cc:7885
Item_real_func super
Definition: item_func.h:3540
ulonglong get_count()
Get number of matching rows from FT handler.
Definition: item_func.h:3634
Definition: item_func.h:1685
Item_func_max(const POS &pos, PT_item_list *opt_list)
Definition: item_func.h:1687
const char * func_name() const override
Definition: item_func.h:1689
enum Functype functype() const override
Definition: item_func.h:1690
Definition: item_func.h:1599
bool compare_as_dates() const
Returns true if arguments to this function should be compared as dates.
Definition: item_func.cc:3902
longlong int_op() override
Performs the operation that this functions implements when the result type is INT.
Definition: item_func.cc:4042
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.cc:3786
TYPELIB * get_typelib() const override
Get the typelib information for an item of type set or enum.
Definition: item_func.cc:3800
my_decimal * val_decimal(my_decimal *) override
Definition: item_func.cc:4106
bool date_op(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Performs the operation that this functions implements when the result type is MYSQL_TYPE_DATE or MYSQ...
Definition: item_func.cc:3999
String * str_op(String *) override
Performs the operation that this functions implements when the result type is a string type.
Definition: item_func.cc:3939
uint8 fsp_for_string
Fractional seconds precision to use when converting a time or timestamp expression into a string.
Definition: item_func.h:1655
double val_real() override
Definition: item_func.cc:4092
longlong val_int() override
Definition: item_func.cc:4099
bool resolve_type_inner(THD *thd) override
Resolve type of function after all arguments have had their data types resolved.
Definition: item_func.cc:3834
Item_func_min_max(const POS &pos, PT_item_list *opt_list, bool is_least_func)
Definition: item_func.h:1601
bool has_temporal_arg() const
Returns true if at least one of the arguments was of temporal type.
Definition: item_func.h:1636
String m_string_buf
Definition: item_func.h:1641
double real_op() override
Performs the operation that this functions implements when the result type is REAL.
Definition: item_func.cc:4023
bool cmp_datetimes(longlong *value)
Compare arguments as datetime values.
Definition: item_func.cc:3907
Item * temporal_item
Definition: item_func.h:1649
enum Item_result result_type() const override
Definition: item_func.h:1621
bool cmp_times(longlong *value)
Compare arguments as time values.
Definition: item_func.cc:3928
const bool m_is_least_func
True if LEAST function, false if GREATEST.
Definition: item_func.h:1640
enum Item_result cast_to_int_type() const override
Make CAST(LEAST_OR_GREATEST(datetime_expr, varchar_expr)) return a number in format YYMMDDhhmmss.
Definition: item_func.h:1628
bool time_op(MYSQL_TIME *ltime) override
Definition: item_func.cc:4008
my_decimal * decimal_op(my_decimal *) override
Performs the operation that this functions implements when the result type is DECIMAL.
Definition: item_func.cc:4067
enum_field_types default_data_type() const override
Get the default data (output) type for the specific item.
Definition: item_func.h:1615
void set_numeric_type() override
Definition: item_func.h:1620
Definition: item_func.h:1677
enum Functype functype() const override
Definition: item_func.h:1682
const char * func_name() const override
Definition: item_func.h:1681
Item_func_min(const POS &pos, PT_item_list *opt_list)
Definition: item_func.h:1679
Definition: item_func.h:1225
enum Functype functype() const override
Definition: item_func.h:1239
my_decimal * decimal_op(my_decimal *) override
See Item_func_plus::decimal_op for comments.
Definition: item_func.cc:2294
longlong int_op() override SUPPRESS_UBSAN
Performs the operation that this functions implements when the result type is INT.
Definition: item_func.cc:2243
bool resolve_type(THD *thd) override
The following function is here to allow the user to force subtraction of UNSIGNED BIGINT/DECIMAL to r...
Definition: item_func.cc:2225
Item_func_minus(const POS &pos, Item *a, Item *b)
Definition: item_func.h:1228
Item_func_minus(Item *a, Item *b)
Definition: item_func.h:1227
double real_op() override
Performs the operation that this functions implements when the result type is REAL.
Definition: item_func.cc:2232
const char * func_name() const override
Definition: item_func.h:1231
Definition: item_func.h:1296
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_func.h:1307
bool check_function_as_value_generator(uchar *) override
Check if this item is allowed for a virtual column or inside a default expression.
Definition: item_func.h:1308
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.cc:2718
void result_precision() override
Definition: item_func.cc:2702
Item_func_mod(const POS &pos, Item *a, Item *b)
Definition: item_func.h:1299
const char * func_name() const override
Definition: item_func.h:1304
enum Functype functype() const override
Definition: item_func.h:1309
double real_op() override
Performs the operation that this functions implements when the result type is REAL.
Definition: item_func.cc:2665
Item_func_mod(Item *a, Item *b)
Definition: item_func.h:1298
my_decimal * decimal_op(my_decimal *) override
Performs the operation that this functions implements when the result type is DECIMAL.
Definition: item_func.cc:2680
longlong int_op() override
Performs the operation that this functions implements when the result type is INT.
Definition: item_func.cc:2630
Definition: item_func.h:1242
const char * func_name() const override
Definition: item_func.h:1247
bool check_function_as_value_generator(uchar *) override
Check if this item is allowed for a virtual column or inside a default expression.
Definition: item_func.h:1253
void result_precision() override
Definition: item_func.cc:2432
double real_op() override
Performs the operation that this functions implements when the result type is REAL.
Definition: item_func.cc:2319
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_func.h:1252
my_decimal * decimal_op(my_decimal *) override
See Item_func_plus::decimal_op for comments.
Definition: item_func.cc:2417
longlong int_op() override
Performs the operation that this functions implements when the result type is INT.
Definition: item_func.cc:2331
Item_func_mul(Item *a, Item *b)
Definition: item_func.h:1244
enum Functype functype() const override
Definition: item_func.h:1254
Item_func_mul(const POS &pos, Item *a, Item *b)
Definition: item_func.h:1245
Definition: item_func.h:1312
Item_func_neg(const POS &pos, Item *a)
Definition: item_func.h:1315
const char * func_name() const override
Definition: item_func.h:1320
enum Functype functype() const override
Definition: item_func.h:1321
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.cc:2763
double real_op() override
Performs the operation that this functions implements when the result type is REAL.
Definition: item_func.cc:2725
longlong int_op() override
Performs the operation that this functions implements when the result type is INT.
Definition: item_func.cc:2731
bool check_function_as_value_generator(uchar *) override
Check if this item is allowed for a virtual column or inside a default expression.
Definition: item_func.h:1325
my_decimal * decimal_op(my_decimal *) override
Performs the operation that this functions implements when the result type is DECIMAL.
Definition: item_func.cc:2746
void fix_num_length_and_dec() override
Definition: item_func.cc:2756
Item_func_neg(Item *a)
Definition: item_func.h:1314
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_func.h:1324
Definition: item_func.h:966
Item_func_num1(Item *a, Item *b)
Definition: item_func.h:971
Item_func_num1(const POS &pos, Item *a)
Definition: item_func.h:969
void fix_num_length_and_dec() override
Definition: item_func.cc:1577
String * str_op(String *) override
Performs the operation that this functions implements when the result type is a string type.
Definition: item_func.h:977
Item_func_num1(Item *a)
Definition: item_func.h:968
void set_numeric_type() override
Set data type for a numeric function with one argument (can be also used by a numeric function with m...
Definition: item_func.cc:1549
Item_func_num1(const POS &pos, Item *a, Item *b)
Definition: item_func.h:972
bool date_op(MYSQL_TIME *, my_time_flags_t) override
Performs the operation that this functions implements when the result type is MYSQL_TYPE_DATE or MYSQ...
Definition: item_func.h:981
bool time_op(MYSQL_TIME *) override
Definition: item_func.h:985
Definition: item_func.h:873
virtual void set_numeric_type()=0
longlong val_int() override
Definition: item_func.cc:1774
virtual longlong int_op()=0
Performs the operation that this functions implements when the result type is INT.
String * val_str(String *str) override
Definition: item_func.cc:1693
Item_func_numhybrid(const POS &pos, Item *a)
Definition: item_func.h:881
Item_func_numhybrid(mem_root_deque< Item * > *list)
Definition: item_func.h:895
enum_field_types default_data_type() const override
Get the default data (output) type for the specific item.
Definition: item_func.h:905
bool resolve_type_inner(THD *thd) override
Resolve type of function after all arguments have had their data types resolved.
Definition: item_func.cc:1685
bool is_null() override
The method allows to determine nullness of a complex expression without fully evaluating it,...
Definition: item_func.h:962
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_func.cc:1857
virtual bool date_op(MYSQL_TIME *ltime, my_time_flags_t fuzzydate)=0
Performs the operation that this functions implements when the result type is MYSQL_TYPE_DATE or MYSQ...
Item_func_numhybrid(Item *a)
Definition: item_func.h:878
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.cc:1657
my_decimal * val_decimal(my_decimal *) override
Definition: item_func.cc:1815
enum Item_result result_type() const override
Definition: item_func.h:904
virtual bool time_op(MYSQL_TIME *ltime)=0
double val_real() override
Definition: item_func.cc:1735
Item_func_numhybrid(const POS &pos, PT_item_list *list)
Definition: item_func.h:899
void fix_num_length_and_dec() override
Definition: item_func.cc:875
Item_func_numhybrid(const POS &pos, Item *a, Item *b)
Definition: item_func.h:890
Item_result hybrid_type
Definition: item_func.h:875
virtual my_decimal * decimal_op(my_decimal *decimal_value)=0
Performs the operation that this functions implements when the result type is DECIMAL.
virtual double real_op()=0
Performs the operation that this functions implements when the result type is REAL.
bool get_time(MYSQL_TIME *ltime) override
Definition: item_func.cc:1874
virtual String * str_op(String *)=0
Performs the operation that this functions implements when the result type is a string type.
Item_func_numhybrid(Item *a, Item *b)
Definition: item_func.h:886
Definition: item_func.h:1923
const char * func_name() const override
Definition: item_func.h:1929
longlong val_int() override
Definition: item_func.cc:4399
String value
Definition: item_func.h:1924
Item_func_ord(const POS &pos, Item *a)
Definition: item_func.h:1927
Definition: item_func.h:1209
const char * func_name() const override
Definition: item_func.h:1215
Item_func_plus(const POS &pos, Item *a, Item *b)
Definition: item_func.h:1212
Item_func_plus(Item *a, Item *b)
Definition: item_func.h:1211
double real_op() override
Performs the operation that this functions implements when the result type is REAL.
Definition: item_func.cc:2120
longlong int_op() override SUPPRESS_UBSAN
Performs the operation that this functions implements when the result type is INT.
Definition: item_func.cc:2131
my_decimal * decimal_op(my_decimal *) override
Calculate plus of two decimals.
Definition: item_func.cc:2187
enum Functype functype() const override
Definition: item_func.h:1222
Definition: item_func.h:1400
double val_real() override
Definition: item_func.cc:2910
Item_func_pow(const POS &pos, Item *a, Item *b)
Definition: item_func.h:1402
const char * func_name() const override
Definition: item_func.h:1404
enum Functype functype() const override
Definition: item_func.h:1405
Definition: item_func.h:1592
Item_func_radians(const POS &pos, Item *a)
Definition: item_func.h:1594
const char * func_name() const override
Definition: item_func.h:1596
enum Functype functype() const override
Definition: item_func.h:1597
Definition: item_func.h:1521
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_func.cc:3657
double val_real() override
Definition: item_func.cc:3722
void seed_random(Item *val)
Definition: item_func.cc:3674
bool fix_fields(THD *thd, Item **ref) override
Definition: item_func.cc:3692
const char * func_name() const override
Definition: item_func.h:1533
bool first_eval
Definition: item_func.h:1525
Item_real_func super
Definition: item_func.h:1522
bool check_function_as_value_generator(uchar *checker_args) override
Check if this item is allowed for a virtual column or inside a default expression.
Definition: item_func.h:1549
rand_struct * m_rand
Definition: item_func.h:1524
Item_func_rand()
Definition: item_func.h:1527
Item_func_rand(const POS &pos)
Definition: item_func.h:1529
table_map get_initial_pseudo_tables() const override
This function is non-deterministic and hence depends on the 'RAND' pseudo-table.
Definition: item_func.h:1540
Item_func_rand(const POS &pos, Item *a)
Definition: item_func.h:1528
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.cc:3684
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_func.h:1545
Definition: item_func.h:2461
longlong val_int() override
Release all user level lock held by connection.
Definition: item_func.cc:5682
Item_int_func super
Definition: item_func.h:2462
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2473
table_map get_initial_pseudo_tables() const override
Returns the pseudo tables depended upon in order to evaluate this function expression.
Definition: item_func.h:2470
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_func.cc:5668
bool check_function_as_value_generator(uchar *checker_args) override
Check if this item is allowed for a virtual column or inside a default expression.
Definition: item_func.h:2478
Item_func_release_all_locks(const POS &pos)
Definition: item_func.h:2465
const char * func_name() const override
Definition: item_func.h:2469
bool is_non_const_over_literals(uchar *) override
Definition: item_func.h:2477
Definition: item_func.h:2431
Item_int_func super
Definition: item_func.h:2432
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_func.cc:5600
table_map get_initial_pseudo_tables() const override
Returns the pseudo tables depended upon in order to evaluate this function expression.
Definition: item_func.h:2442
bool check_function_as_value_generator(uchar *checker_args) override
Check if this item is allowed for a virtual column or inside a default expression.
Definition: item_func.h:2452
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2445
String value
Definition: item_func.h:2434
const char * func_name() const override
Definition: item_func.h:2441
longlong val_int() override
Release a user level lock.
Definition: item_func.cc:5624
bool is_non_const_over_literals(uchar *) override
Definition: item_func.h:2451
Item_func_release_lock(const POS &pos, Item *a)
Definition: item_func.h:2437
Definition: item_func.h:1500
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.cc:3452
my_decimal * decimal_op(my_decimal *) override
Performs the operation that this functions implements when the result type is DECIMAL.
Definition: item_func.cc:3642
bool truncate
Definition: item_func.h:1501
Item_func_round(Item *a, Item *b, bool trunc_arg)
Definition: item_func.h:1504
longlong int_op() override
Performs the operation that this functions implements when the result type is INT.
Definition: item_func.cc:3576
enum Functype functype() const override
Definition: item_func.h:1516
const char * func_name() const override
Definition: item_func.h:1509
Item_func_round(const POS &pos, Item *a, Item *b, bool trunc_arg)
Definition: item_func.h:1506
double real_op() override
Performs the operation that this functions implements when the result type is REAL.
Definition: item_func.cc:3548
Definition: item_func.h:3890
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:3900
Item_func_row_count(const POS &pos)
Definition: item_func.h:3894
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_func.cc:8111
const char * func_name() const override
Definition: item_func.h:3899
Item_int_func super
Definition: item_func.h:3891
longlong val_int() override
Definition: item_func.cc:8121
bool check_function_as_value_generator(uchar *checker_args) override
Check if this item is allowed for a virtual column or inside a default expression.
Definition: item_func.h:3904
This class is used to implement operations like SET @variable or @variable:= expression.
Definition: item_func.h:3298
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_func.cc:6026
void print_assignment(const THD *thd, String *str, enum_query_type query_type) const
Definition: item_func.cc:6552
type_conversion_status save_in_field(Field *field, bool no_conversions, bool can_use_result_field)
Definition: item_func.cc:6628
enum Item_result result_type() const override
Definition: item_func.h:3339
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.cc:6082
Item_func_set_user_var(const POS &pos, Name_string a, Item *b)
Definition: item_func.h:3315
enum Item_result cached_result_type
Definition: item_func.h:3299
enum Functype functype() const override
Definition: item_func.h:3327
Item_func_set_user_var(Name_string a, Item *b)
Definition: item_func.h:3314
type_conversion_status save_in_field_inner(Field *field, bool no_conversions) override
Helper function which does all of the work for save_in_field(Field*, bool), except some error checkin...
Definition: item_func.h:3359
void make_field(Send_field *tmp_field) override
Definition: item_func.cc:6580
String * val_str(String *str) override
Definition: item_func.cc:6537
void save_org_in_field(Field *field) override
Definition: item_func.h:3351
bool set_entry(THD *thd, bool create_if_not_exists)
Definition: item_func.cc:6040
bool fix_fields(THD *thd, Item **ref) override
Definition: item_func.cc:6068
bool null_item
Definition: item_func.h:3303
bool update()
Update user variable from value in save_result.
Definition: item_func.cc:6475
void save_item_result(Item *item)
Evaluate and store item's result.
Definition: item_func.cc:6444
bool update_hash(const void *ptr, uint length, enum Item_result type, const CHARSET_INFO *cs, Derivation dv, bool unsigned_arg)
Definition: item_func.cc:6228
longlong val_int() override
Definition: item_func.cc:6530
my_decimal * val_decimal(my_decimal *) override
Definition: item_func.cc:6544
union Item_func_set_user_var::@58 save_result
double vreal
Definition: item_func.h:3306
my_decimal decimal_buff
Definition: item_func.h:3302
bool send(Protocol *protocol, String *str_arg) override
This is only called from items that is not of type item_field.
Definition: item_func.cc:6568
my_decimal * vdec
Definition: item_func.h:3308
String value
Definition: item_func.h:3301
double val_real() override
Definition: item_func.cc:6523
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_func.cc:6561
bool check(bool use_result_field)
This functions is invoked on SET @variable or @variable:= expression.
Definition: item_func.cc:6400
const char * func_name() const override
Definition: item_func.h:3346
Name_string name
Definition: item_func.h:3312
Item_func_set_user_var(THD *thd, Item_func_set_user_var *item)
Definition: item_func.h:3318
String * vstr
Definition: item_func.h:3307
longlong vint
Definition: item_func.h:3305
Definition: item_func.h:2102
Item_func_shift_left(const POS &pos, Item *a, Item *b)
Definition: item_func.h:2104
const char * func_name() const override
Definition: item_func.h:2106
longlong int_op() override
Performs the operation on integers to produce a result of type INT_RESULT.
Definition: item_func.cc:3090
String * str_op(String *str) override
Performs the operation on binary strings to produce a result of type STRING_RESULT.
Definition: item_func.cc:3164
Definition: item_func.h:2113
String * str_op(String *str) override
Performs the operation on binary strings to produce a result of type STRING_RESULT.
Definition: item_func.cc:3168
Item_func_shift_right(const POS &pos, Item *a, Item *b)
Definition: item_func.h:2115
longlong int_op() override
Performs the operation on integers to produce a result of type INT_RESULT.
Definition: item_func.cc:3091
const char * func_name() const override
Definition: item_func.h:2117
Definition: item_func.h:2087
String * eval_str_op(String *str)
Template function that evaluates the bitwise shift operation over binary string arguments.
Definition: item_func.cc:3099
longlong eval_int_op()
Template function that evaluates the bitwise shift operation over integer arguments.
Definition: item_func.cc:3074
bool binary_result_requires_binary_second_arg() const override
Definition: item_func.h:2089
Item_func_shift(const POS &pos, Item *a, Item *b)
Definition: item_func.h:2098
Definition: item_func.h:1562
longlong val_int() override
Definition: item_func.cc:3763
Item_func_sign(const POS &pos, Item *a)
Definition: item_func.h:1564
enum Functype functype() const override
Definition: item_func.h:1566
const char * func_name() const override
Definition: item_func.h:1565
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.cc:3755
Definition: item_func.h:1441
Item_func_sin(const POS &pos, Item *a)
Definition: item_func.h:1443
double val_real() override
Definition: item_func.cc:2959
const char * func_name() const override
Definition: item_func.h:1445
enum Functype functype() const override
Definition: item_func.h:1446
Definition: item_func.h:2209
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2233
Item_func_sleep(const POS &pos, Item *a)
Definition: item_func.h:2213
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_func.cc:5927
bool check_function_as_value_generator(uchar *checker_args) override
Check if this item is allowed for a virtual column or inside a default expression.
Definition: item_func.h:2226
const char * func_name() const override
Definition: item_func.h:2216
table_map get_initial_pseudo_tables() const override
This function is non-deterministic and hence depends on the 'RAND' pseudo-table.
Definition: item_func.h:2223
Item_int_func super
Definition: item_func.h:2210
longlong val_int() override
This function is just used to create tests with time gaps.
Definition: item_func.cc:5937
Definition: item_func.h:3922
void fix_after_pullout(Query_block *parent_query_block, Query_block *removed_query_block) override
Fix after tables have been moved from one query_block level to the parent level, e....
Definition: item_func.cc:8610
void compute_cost(CostOfItem *root_cost) const override
Compute the cost of evaluating this Item.
Definition: item_func.h:3996
double val_real() override
Definition: item_func.cc:8304
bool change_context_processor(uchar *arg) override
Definition: item_func.h:3975
longlong val_int() override
Definition: item_func.cc:8298
String * val_str(String *str) override
Definition: item_func.cc:8326
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_func.cc:8168
my_decimal * val_decimal(my_decimal *dec_buf) override
Definition: item_func.cc:8320
bool m_deterministic
true when function execution is deterministic
Definition: item_func.h:3936
const char * func_name() const override
Definition: item_func.cc:8177
Field * sp_result_field
The result field of the concrete stored function.
Definition: item_func.h:3934
bool check_function_as_value_generator(uchar *checker_args) override
Check if this item is allowed for a virtual column or inside a default expression.
Definition: item_func.h:3988
bool init_result_field(THD *thd)
Initialize the result field by creating a temporary dummy table and assign it to a newly created fiel...
Definition: item_func.cc:8235
bool val_json(Json_wrapper *result) override
Get a JSON value from an Item.
Definition: item_func.cc:8341
Field * tmp_table_field(TABLE *t_arg) override
Definition: item_func.cc:8484
void update_used_tables() override
Updates used tables, not null tables information and accumulates properties up the item tree,...
Definition: item_func.cc:8603
bool get_time(MYSQL_TIME *ltime) override
Definition: item_func.cc:8315
Name_resolution_context * m_name_resolution_ctx
Holds the security definer context(if defined with SQL SECURITY DEFINER) and the error the handler.
Definition: item_func.h:3928
Item_result result_type() const override
Definition: item_func.cc:8461
Field * get_sp_result_field()
Definition: item_func.h:3987
Item_func_sp(const POS &pos, const LEX_STRING &db_name, const LEX_STRING &fn_name, bool use_explicit_name, PT_item_list *opt_list)
Definition: item_func.cc:8128
bool execute_impl(THD *thd)
Execute function and store the return value in the field.
Definition: item_func.cc:8409
bool resolve_type(THD *thd) override
Initialize local members with values from the Field interface.
Definition: item_func.cc:8284
Item_func super
Definition: item_func.h:3923
void make_field(Send_field *tmp_field) override
Definition: item_func.cc:8454
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_func.cc:8144
bool execute()
Execute function & store value in field.
Definition: item_func.cc:8366
bool sp_check_access(THD *thd)
Checks if requested access to function can be granted to user.
Definition: item_func.cc:8505
enum Functype functype() const override
Definition: item_func.h:3982
sp_name * m_name
The name of the stored function.
Definition: item_func.h:3930
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_func.cc:8310
table_map get_initial_pseudo_tables() const override
Must not be called before the procedure is resolved, i.e.
Definition: item_func.cc:8199
bool fix_fields(THD *thd, Item **ref) override
Definition: item_func.cc:8515
sp_head * m_sp
Pointer to actual function instance (null when not resolved or executing)
Definition: item_func.h:3932
Definition: item_func.h:1392
Item_func_sqrt(const POS &pos, Item *a)
Definition: item_func.h:1394
const char * func_name() const override
Definition: item_func.h:1396
double val_real() override
Definition: item_func.cc:2902
enum Functype functype() const override
Definition: item_func.h:1397
Definition: item_func.h:1449
enum Functype functype() const override
Definition: item_func.h:1454
double val_real() override
Definition: item_func.cc:2966
Item_func_tan(const POS &pos, Item *a)
Definition: item_func.h:1451
const char * func_name() const override
Definition: item_func.h:1453
Definition: item_func.h:2337
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_func.h:2346
double val_real() override
Definition: item_func.cc:5144
Item_func_udf_decimal(const POS &pos, udf_func *udf_arg, PT_item_list *opt_list)
Definition: item_func.h:2339
longlong val_int() override
Definition: item_func.cc:5136
enum Item_result result_type() const override
Definition: item_func.h:2352
bool get_time(MYSQL_TIME *ltime) override
Definition: item_func.h:2349
String * val_str(String *str) override
Definition: item_func.cc:5157
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.cc:5167
my_decimal * val_decimal(my_decimal *) override
Definition: item_func.cc:5152
Definition: item_func.h:2288
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_func.h:2304
Item_func_udf_float(const POS &pos, udf_func *udf_arg, PT_item_list *opt_list)
Definition: item_func.h:2290
my_decimal * val_decimal(my_decimal *dec_buf) override
Definition: item_func.h:2296
longlong val_int() override
Definition: item_func.h:2292
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2310
bool get_time(MYSQL_TIME *ltime) override
Definition: item_func.h:2307
double val_real() override
Definition: item_func.cc:5106
String * val_str(String *str) override
Definition: item_func.cc:5114
Definition: item_func.h:2317
bool get_time(MYSQL_TIME *ltime) override
Definition: item_func.h:2329
enum Item_result result_type() const override
Definition: item_func.h:2330
String * val_str(String *str) override
Definition: item_func.cc:5128
Item_func_udf_int(const POS &pos, udf_func *udf_arg, PT_item_list *opt_list)
Definition: item_func.h:2319
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2331
double val_real() override
Definition: item_func.h:2322
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_func.h:2326
longlong val_int() override
Definition: item_func.cc:5122
Definition: item_func.h:2356
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.cc:5175
Item_func_udf_str(const POS &pos, udf_func *udf_arg, PT_item_list *opt_list)
Definition: item_func.h:2358
String * val_str(String *) override
Definition: item_func.cc:5184
bool get_time(MYSQL_TIME *ltime) override
Definition: item_func.h:2389
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_func.h:2386
my_decimal * val_decimal(my_decimal *dec_buf) override
Definition: item_func.h:2379
enum Item_result result_type() const override
Definition: item_func.h:2392
longlong val_int() override
Definition: item_func.h:2371
double val_real() override
Definition: item_func.h:2362
Definition: item_func.h:1572
Item_func_units(const POS &pos, Item *a, double mul_arg, double add_arg)
Definition: item_func.h:1576
double add
Definition: item_func.h:1573
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.cc:3770
double val_real() override
Definition: item_func.cc:3779
double mul
Definition: item_func.h:1573
Definition: item_func.h:4025
table_map get_initial_pseudo_tables() const override
Returns the pseudo tables depended upon in order to evaluate this function expression.
Definition: item_func.h:4048
Item_int_func super
Definition: item_func.h:4026
longlong val_int() override
Definition: item_func.cc:8648
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_func.cc:8640
Item_func_uuid_short(const POS &pos)
Definition: item_func.h:4029
bool check_function_as_value_generator(uchar *checker_args) override
Check if this item is allowed for a virtual column or inside a default expression.
Definition: item_func.h:4039
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:4034
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_func.h:4038
const char * func_name() const override
Definition: item_func.h:4032
Definition: item_func.h:1883
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:1891
const char * func_name() const override
Definition: item_func.h:1888
Item_func_validate_password_strength(const POS &pos, Item *a)
Definition: item_func.h:1885
longlong val_int() override
Definition: item_func.cc:4322
Definition: item_func.h:1797
const char * func_name() const override
Definition: item_func.h:1803
String value
Definition: item_func.h:1798
Item_func_vector_dim(const POS &pos, Item *a)
Definition: item_func.h:1801
longlong val_int() override
Definition: item_func.cc:4225
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:1804
Definition: item_func.h:4053
Item_static_string_func super
Definition: item_func.h:4054
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_func.cc:8656
Item_func_version(const POS &pos)
Definition: item_func.cc:9896
Definition: item_func.h:100
bool agg_arg_charsets_for_string_result(DTCollation &c, Item **items, uint nitems, int item_sep=1)
Definition: item_func.h:581
bool param_type_is_rejected(uint start, uint end)
For arguments of this Item_func ("args" array), in range [start,end[ : sends error if they're a dynam...
Definition: item_func.cc:544
bool param_type_uses_non_param(THD *thd, enum_field_types def=MYSQL_TYPE_VARCHAR)
Definition: item_func.cc:617
Item_func(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_func.h:405
int check_decimal_overflow(int error)
Throw an error if the error code of a DECIMAL operation is E_DEC_OVERFLOW.
Definition: item_func.h:657
Item_func()
Definition: item_func.h:367
my_decimal * val_decimal(my_decimal *) override
Definition: item_func.cc:835
bool replace_equal_field_checker(uchar **arg) override
Definition: item_func.h:606
virtual bool have_rev_func() const
Definition: item_func.h:536
Item ** args
Array of pointers to arguments.
Definition: item_func.h:107
virtual enum Functype functype() const
Definition: item_func.h:366
bool check_column_in_window_functions(uchar *arg) override
Check if all the columns present in this expression are present in PARTITION clause of window functio...
Definition: item_func.cc:1025
bool check_function_as_value_generator(uchar *checker_args) override
Check if this item is allowed for a virtual column or inside a default expression.
Definition: item_func.h:815
Item_func(const POS &pos)
Definition: item_func.h:369
bool reject_vector_args()
Definition: item_func.cc:1596
void update_used_tables() override
Updates used tables, not null tables information and accumulates properties up the item tree,...
Definition: item_func.cc:734
bool check_valid_arguments_processor(uchar *) override
Definition: item_func.h:711
Item_func(Item *a, Item *b)
Definition: item_func.h:381
bool fix_func_arg(THD *, Item **arg)
Definition: item_func.cc:438
bool alloc_args(MEM_ROOT *mem_root, unsigned num_args)
Allocates space for the given number of arguments, if needed.
Definition: item_func.h:114
virtual Item * get_arg(uint i)
Get the i'th argument of the function that this object represents.
Definition: item_func.h:494
bool split_sum_func(THD *thd, Ref_item_array ref_item_array, mem_root_deque< Item * > *fields) override
See comments in Item_cmp_func::split_sum_func()
Definition: item_func.cc:723
longlong val_int_from_real()
Definition: item_func.cc:2078
void traverse_cond(Cond_traverser traverser, void *arg, traverse_order order) override
Definition: item_func.cc:642
virtual table_map get_initial_pseudo_tables() const
Returns the pseudo tables depended upon in order to evaluate this function expression.
Definition: item_func.h:524
Item * compile(Item_analyzer analyzer, uchar **arg_p, Item_transformer transformer, uchar *arg_t) override
Compile Item_func object with a processor and a transformer callback functions.
Definition: item_func.cc:700
bool is_null() override
The method allows to determine nullness of a complex expression without fully evaluating it,...
Definition: item_func.h:563
Item_func(const POS &pos, Item *a)
Definition: item_func.h:376
Item * replace_equal_field(uchar *arg) override
Definition: item_func.h:612
Functype
Definition: item_func.h:209
@ DATEADD_FUNC
Definition: item_func.h:316
@ TRIG_COND_FUNC
Definition: item_func.h:253
@ JSON_VALUE_FUNC
Definition: item_func.h:353
@ JSON_SCHEMA_VALIDATION_REPORT_FUNC
Definition: item_func.h:355
@ SP_CROSSES_FUNC
Definition: item_func.h:237
@ ROLLUP_GROUP_ITEM_FUNC
Definition: item_func.h:264
@ JSON_STORAGE_SIZE_FUNC
Definition: item_func.h:351
@ NOT_ALL_FUNC
Definition: item_func.h:250
@ LIKE_FUNC
Definition: item_func.h:220
@ FALSE_FUNC
Definition: item_func.h:333
@ SP_EXTERIORRING
Definition: item_func.h:245
@ PLUS_FUNC
Definition: item_func.h:267
@ JSON_SEARCH_FUNC
Definition: item_func.h:354
@ SIGN_FUNC
Definition: item_func.h:277
@ JSON_STORAGE_FREE_FUNC
Definition: item_func.h:352
@ NULLIF_FUNC
Definition: item_func.h:294
@ YEAR_FUNC
Definition: item_func.h:296
@ NOT_FUNC
Definition: item_func.h:249
@ MINUS_FUNC
Definition: item_func.h:268
@ HOUR_FUNC
Definition: item_func.h:307
@ TIME_TO_SEC_FUNC
Definition: item_func.h:321
@ LOG_FUNC
Definition: item_func.h:279
@ PERIODDIFF_FUNC
Definition: item_func.h:337
@ XOR_FUNC
Definition: item_func.h:226
@ COND_OR_FUNC
Definition: item_func.h:225
@ JSON_CONTAINS
Definition: item_func.h:327
@ JSON_VALID_FUNC
Definition: item_func.h:346
@ JSON_UNQUOTE_FUNC
Definition: item_func.h:329
@ GREATEST_FUNC
Definition: item_func.h:324
@ SP_EQUALS_FUNC
Definition: item_func.h:232
@ LN_FUNC
Definition: item_func.h:280
@ FROM_UNIXTIME_FUNC
Definition: item_func.h:317
@ COND_AND_FUNC
Definition: item_func.h:224
@ EQ_FUNC
Definition: item_func.h:211
@ MAKETIME_FUNC
Definition: item_func.h:299
@ FUNC_SP
Definition: item_func.h:259
@ ROUND_FUNC
Definition: item_func.h:272
@ JSON_CONTAINS_PATH_FUNC
Definition: item_func.h:350
@ NOW_FUNC
Definition: item_func.h:251
@ FROM_DAYS_FUNC
Definition: item_func.h:252
@ TRUE_FUNC
Definition: item_func.h:332
@ LEAST_FUNC
Definition: item_func.h:326
@ IN_FUNC
Definition: item_func.h:228
@ CONVERT_TZ_FUNC
Definition: item_func.h:318
@ LE_FUNC
Definition: item_func.h:215
@ COLLATE_FUNC
Definition: item_func.h:256
@ GSYSVAR_FUNC
Definition: item_func.h:262
@ MATCH_FUNC
Definition: item_func.h:219
@ MULTI_EQ_FUNC
Definition: item_func.h:229
@ FT_FUNC
Definition: item_func.h:218
@ GUSERVAR_FUNC
Definition: item_func.h:255
@ LT_FUNC
Definition: item_func.h:214
@ MOD_FUNC
Definition: item_func.h:292
@ SP_COVEREDBY_FUNC
Definition: item_func.h:240
@ NEG_FUNC
Definition: item_func.h:261
@ DD_INTERNAL_FUNC
Definition: item_func.h:266
@ ISNULL_FUNC
Definition: item_func.h:221
@ JSON_ARRAY_FUNC
Definition: item_func.h:345
@ SP_TOUCHES_FUNC
Definition: item_func.h:236
@ JSON_SCHEMA_VALID_FUNC
Definition: item_func.h:356
@ SP_DISJOINT_FUNC
Definition: item_func.h:233
@ ISNOTNULLTEST_FUNC
Definition: item_func.h:231
@ DAY_FUNC
Definition: item_func.h:302
@ LOG10_FUNC
Definition: item_func.h:281
@ UDF_FUNC
Definition: item_func.h:260
@ MAKEDATE_FUNC
Definition: item_func.h:298
@ COT_FUNC
Definition: item_func.h:285
@ ISTRUTH_FUNC
Definition: item_func.h:223
@ SEC_TO_TIME_FUNC
Definition: item_func.h:338
@ DATE_FUNC
Definition: item_func.h:306
@ TIMESTAMPDIFF_FUNC
Definition: item_func.h:322
@ SECOND_FUNC
Definition: item_func.h:309
@ EXP_FUNC
Definition: item_func.h:288
@ SP_STARTPOINT
Definition: item_func.h:243
@ JSON_DEPTH_FUNC
Definition: item_func.h:342
@ JSON_QUOTE_FUNC
Definition: item_func.h:349
@ PERIODADD_FUNC
Definition: item_func.h:336
@ SP_POINTN
Definition: item_func.h:246
@ EXTRACT_FUNC
Definition: item_func.h:257
@ MONTH_FUNC
Definition: item_func.h:300
@ TO_SECONDS_FUNC
Definition: item_func.h:305
@ ABS_FUNC
Definition: item_func.h:275
@ BETWEEN
Definition: item_func.h:227
@ IF_FUNC
Definition: item_func.h:293
@ JSON_OBJECT_FUNC
Definition: item_func.h:344
@ JSON_TYPE_FUNC
Definition: item_func.h:347
@ MICROSECOND_FUNC
Definition: item_func.h:310
@ ANY_VALUE_FUNC
Definition: item_func.h:340
@ STRCMP_FUNC
Definition: item_func.h:331
@ JSON_PRETTY_FUNC
Definition: item_func.h:348
@ QUARTER_FUNC
Definition: item_func.h:313
@ NE_FUNC
Definition: item_func.h:213
@ TIMEDIFF_FUNC
Definition: item_func.h:335
@ JSON_EXTRACT_FUNC
Definition: item_func.h:343
@ TABLE_FUNC
Definition: item_func.h:265
@ MEMBER_OF_FUNC
Definition: item_func.h:330
@ POW_FUNC
Definition: item_func.h:276
@ GE_FUNC
Definition: item_func.h:216
@ SP_GEOMETRYN
Definition: item_func.h:247
@ SYSDATE_FUNC
Definition: item_func.h:334
@ MONTHNAME_FUNC
Definition: item_func.h:301
@ TYPECAST_FUNC
Definition: item_func.h:258
@ SUSERVAR_FUNC
Definition: item_func.h:254
@ EQUAL_FUNC
Definition: item_func.h:212
@ GT_FUNC
Definition: item_func.h:217
@ RADIANS_FUNC
Definition: item_func.h:287
@ UNKNOWN_FUNC
Definition: item_func.h:210
@ SP_DISTANCE_FUNC
Definition: item_func.h:234
@ SP_WITHIN_FUNC
Definition: item_func.h:238
@ SP_INTERIORRINGN
Definition: item_func.h:248
@ SIN_FUNC
Definition: item_func.h:282
@ SP_INTERSECTS_FUNC
Definition: item_func.h:235
@ LAST_DAY_FUNC
Definition: item_func.h:319
@ WEEKDAY_FUNC
Definition: item_func.h:315
@ ADDTIME_FUNC
Definition: item_func.h:312
@ DEGREES_FUNC
Definition: item_func.h:286
@ JSON_OVERLAPS
Definition: item_func.h:328
@ DAYOFYEAR_FUNC
Definition: item_func.h:311
@ SQRT_FUNC
Definition: item_func.h:274
@ GROUPING_FUNC
Definition: item_func.h:263
@ ISNOTNULL_FUNC
Definition: item_func.h:222
@ ASIN_FUNC
Definition: item_func.h:289
@ TRUNCATE_FUNC
Definition: item_func.h:273
@ TAN_FUNC
Definition: item_func.h:283
@ GET_FORMAT_FUNC
Definition: item_func.h:339
@ ATAN_FUNC
Definition: item_func.h:290
@ JSON_LENGTH_FUNC
Definition: item_func.h:341
@ DAYNAME_FUNC
Definition: item_func.h:303
@ DATETIME_LITERAL
Definition: item_func.h:323
@ MINUTE_FUNC
Definition: item_func.h:308
@ ACOS_FUNC
Definition: item_func.h:291
@ COS_FUNC
Definition: item_func.h:284
@ INTERVAL_FUNC
Definition: item_func.h:230
@ MUL_FUNC
Definition: item_func.h:269
@ SP_COVERS_FUNC
Definition: item_func.h:241
@ CEILING_FUNC
Definition: item_func.h:271
@ TO_DAYS_FUNC
Definition: item_func.h:304
@ WEEK_FUNC
Definition: item_func.h:314
@ YEARWEEK_FUNC
Definition: item_func.h:297
@ SP_CONTAINS_FUNC
Definition: item_func.h:239
@ FLOOR_FUNC
Definition: item_func.h:278
@ CASE_FUNC
Definition: item_func.h:295
@ COALESCE_FUNC
Definition: item_func.h:325
@ SP_ENDPOINT
Definition: item_func.h:244
@ DIV_FUNC
Definition: item_func.h:270
@ SP_OVERLAPS_FUNC
Definition: item_func.h:242
@ UNIX_TIMESTAMP_FUNC
Definition: item_func.h:320
Item * m_embedded_arguments[2]
Definition: item_func.h:110
virtual uint argument_count() const
Definition: item_func.h:131
longlong check_integer_overflow(longlong value, bool val_unsigned)
Throw an error if the input BIGINT value represented by the (longlong value, bool unsigned flag) pair...
Definition: item_func.h:647
Item * replace_func_call(uchar *) override
Definition: item_func.cc:622
void print_op(const THD *thd, String *str, enum_query_type query_type) const
Definition: item_func.cc:764
virtual bool eq_specific(const Item *) const
Provide a more specific equality check for a function.
Definition: item_func.h:534
bool check_column_in_group_by(uchar *arg) override
Check if all the columns present in this expression are present in GROUP BY clause of the derived tab...
Definition: item_func.cc:1043
Item_func(const POS &pos, Item *a, Item *b, Item *c, Item *d, Item *e)
Definition: item_func.h:448
virtual enum_const_item_cache can_cache_json_arg(Item *arg)
Whether an arg of a JSON function can be cached to avoid repetitive string->JSON conversion.
Definition: item_func.h:734
Item * gc_subst_transformer(uchar *arg) override
Transformer function for GC substitution.
Definition: item_func.cc:1331
table_map used_tables_cache
Value used in calculation of result of used_tables()
Definition: item_func.h:193
bool param_type_is_default(THD *thd, uint start, uint end, enum_field_types def=MYSQL_TYPE_VARCHAR)
Definition: item_func.h:169
optimize_type
Definition: item_func.h:358
@ OPTIMIZE_NONE
Definition: item_func.h:359
@ OPTIMIZE_EQUAL
Definition: item_func.h:363
@ OPTIMIZE_NULL
Definition: item_func.h:362
@ OPTIMIZE_KEY
Definition: item_func.h:360
@ OPTIMIZE_OP
Definition: item_func.h:361
void set_used_tables(table_map map)
Definition: item_func.h:528
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_func.cc:361
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:717
virtual const char * func_name() const =0
const Item_field * contributes_to_filter(THD *thd, table_map read_tables, table_map filter_for_table, const MY_BITMAP *fields_to_ignore) const
Whether or not an item should contribute to the filtering effect (.
Definition: item_func.cc:915
bool has_timestamp_args()
Definition: item_func.h:661
bool agg_arg_charsets(DTCollation &c, Item **items, uint nitems, uint flags, int item_sep)
Definition: item_func.h:572
virtual bool is_deprecated() const
Definition: item_func.h:556
Item_func(const POS &pos, Item *a, Item *b, Item *c, Item *d, Item *e, Item *f)
Definition: item_func.h:473
enum Type type() const override
Definition: item_func.h:365
virtual Item * key_item() const
Definition: item_func.h:537
bool param_type_is_default(THD *thd, uint start, uint end, uint step, enum_field_types def)
For arguments of this Item_func ("args" array), in range [start, start+step, start+2*step,...
Definition: item_func.cc:528
Item_func(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_func.h:426
virtual bool may_have_named_parameters() const
Named parameters are allowed in a parameter list.
Definition: item_func.h:812
bool is_valid_for_pushdown(uchar *arg) override
Check if all the columns present in this expression are from the derived table.
Definition: item_func.cc:1017
uint num_vector_args()
Definition: item_func.cc:1582
bool propagate_type(THD *thd, const Type_properties &type) override
Default implementation for all functions: Propagate base_item's type into all arguments.
Definition: item_func.cc:504
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_func.cc:748
bool get_arg0_date(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date)
Definition: item_func.h:557
Item_func(Item *a, Item *b, Item *c, Item *d)
Definition: item_func.h:413
bool reject_geometry_args()
Definition: item_func.cc:1608
bool fix_fields(THD *, Item **ref) override
Definition: item_func.cc:406
void fix_after_pullout(Query_block *parent_query_block, Query_block *removed_query_block) override
Fix after tables have been moved from one query_block level to the parent level, e....
Definition: item_func.cc:460
bool set_arguments(mem_root_deque< Item * > *list, bool context_free)
Copy arguments from list to args array.
Definition: item_func.cc:329
virtual bool allow_replacement(Item_field *const original, Item *const subst)
Check whether a function allows replacement of a field with another item: In particular,...
Definition: item_func.h:630
Item_func(const POS &pos, Item *a, Item *b)
Definition: item_func.h:388
virtual optimize_type select_optimize(const THD *)
Definition: item_func.h:535
bool has_date_args()
Definition: item_func.h:671
virtual const Item * get_arg(uint i) const
Get the i'th argument of the function that this object represents.
Definition: item_func.h:497
uint arg_count
How many arguments in 'args'.
Definition: item_func.h:130
Item_func(Item *a, Item *b, Item *c, Item *d, Item *e)
Definition: item_func.h:434
Item ** arguments() const
Definition: item_func.h:132
Field * tmp_table_field(TABLE *t_arg) override
Definition: item_func.cc:793
bool is_null_on_null() const
Definition: item_func.h:198
bool has_time_args()
Definition: item_func.h:682
bool eq(const Item *item) const override
Compare this item with another item for equality.
Definition: item_func.cc:777
bool is_non_const_over_literals(uchar *) override
Definition: item_func.h:813
bool agg_arg_charsets_for_comparison(DTCollation &c, Item **items, uint nitems, int item_sep=1)
Definition: item_func.h:591
virtual void fix_num_length_and_dec()
Definition: item_func.cc:861
Item * get_tmp_table_item(THD *thd) override
If an Item is materialized in a temporary table, a different Item may have to be used in the part of ...
Definition: item_func.cc:893
void signal_invalid_argument_for_log()
Definition: item_func.cc:885
bool has_datetime_args()
Definition: item_func.h:693
void signal_divide_by_null()
Definition: item_func.cc:877
double check_float_overflow(double value)
Throw an error if the input double number is not finite, i.e.
Definition: item_func.h:639
bool get_arg0_time(MYSQL_TIME *ltime)
Definition: item_func.h:560
Item_func(Item *a)
Definition: item_func.h:372
Item_func(mem_root_deque< Item * > *list)
Definition: item_func.h:484
table_map not_null_tables() const override
Return table map of tables that can't be NULL tables (tables that are used in a context where if they...
Definition: item_func.h:526
table_map not_null_tables_cache
Value used in calculation of result of not_null_tables()
Definition: item_func.h:195
virtual Item * set_arg(THD *, uint, Item *)
Definition: item_func.h:498
bool null_on_null
Affects how to determine that NULL argument implies a NULL function return.
Definition: item_func.h:186
void print_args(const THD *thd, String *str, uint from, enum_query_type query_type) const
Definition: item_func.cc:756
Item_func(Item *a, Item *b, Item *c, Item *d, Item *e, Item *f)
Definition: item_func.h:457
table_map used_tables() const override
Definition: item_func.h:525
virtual bool contains_only_equi_join_condition() const
Whether this Item is an equi-join condition.
Definition: item_func.h:744
bool walk(Item_processor processor, enum_walk walk, uchar *arg) override
Traverses a tree of Items in prefix and/or postfix order.
Definition: item_func.cc:631
Item * transform(Item_transformer transformer, uchar *arg) override
Transform an Item_func object with a transformer callback function.
Definition: item_func.cc:675
virtual bool resolve_type_inner(THD *)
Resolve type of function after all arguments have had their data types resolved.
Definition: item_func.h:514
Item_func(Item *a, Item *b, Item *c)
Definition: item_func.h:394
uint allowed_arg_cols
Definition: item_func.h:191
Definition: item_func.h:1020
String * val_str(String *str) override
Definition: item_func.cc:1471
Item_int_func(const POS &pos, Item *a)
Definition: item_func.h:1028
Item_int_func(Item *a, Item *b, Item *c)
Definition: item_func.h:1039
Item_int_func(const POS &pos)
Definition: item_func.h:1023
Item_int_func(Item *a, Item *b)
Definition: item_func.h:1032
Item_int_func(const POS &pos, PT_item_list *opt_list)
Definition: item_func.h:1058
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_func.h:1068
double val_real() override
Definition: item_func.cc:1465
Item_int_func(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_func.h:1042
Item_int_func()
Definition: item_func.h:1022
Item_int_func(const POS &pos, Item *a, Item *b)
Definition: item_func.h:1035
Item_int_func(Item *a)
Definition: item_func.h:1027
Item_int_func(mem_root_deque< Item * > *list)
Definition: item_func.h:1055
Item_int_func(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_func.h:1050
enum Item_result result_type() const override
Definition: item_func.h:1072
Item_int_func(Item *a, Item *b, Item *c, Item *d)
Definition: item_func.h:1047
Item_int_func(THD *thd, Item_int_func *item)
Definition: item_func.h:1063
bool get_time(MYSQL_TIME *ltime) override
Definition: item_func.h:1071
Definition: item_func.h:2524
Item_master_pos_wait(const POS &pos, Item *a, Item *b)
Definition: item_func.h:2526
Item_master_pos_wait(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_func.h:2528
Item_master_pos_wait(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_func.h:2530
longlong val_int() override
Wait until we are at or past the given position in the master binlog on the slave.
Definition: item_func.cc:5263
void copy(const char *str_arg, size_t length_arg, const CHARSET_INFO *cs_arg, bool is_autogenerated_arg)
Copy name together with autogenerated flag.
Definition: item.cc:1456
Definition: item_func.h:992
String * str_op(String *) override
Performs the operation that this functions implements when the result type is a string type.
Definition: item_func.h:1006
Item_num_op(const POS &pos, Item *a, Item *b)
Definition: item_func.h:995
virtual void result_precision()=0
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_func.h:1000
bool date_op(MYSQL_TIME *, my_time_flags_t) override
Performs the operation that this functions implements when the result type is MYSQL_TYPE_DATE or MYSQ...
Definition: item_func.h:1010
Item_num_op(Item *a, Item *b)
Definition: item_func.h:994
void set_numeric_type() override
Check arguments to determine the data type for a numeric function of two arguments.
Definition: item_func.cc:1508
bool time_op(MYSQL_TIME *) override
Definition: item_func.h:1014
Definition: item_func.h:832
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_func.h:864
longlong val_int() override
Definition: item_func.h:860
my_decimal * val_decimal(my_decimal *decimal_value) override
Definition: item_func.cc:853
bool get_time(MYSQL_TIME *ltime) override
Definition: item_func.h:867
Item_real_func(Item *a, Item *b)
Definition: item_func.h:844
String * val_str(String *str) override
Definition: item_func.cc:844
Item_real_func(mem_root_deque< Item * > *list)
Definition: item_func.h:850
Item_real_func(const POS &pos)
Definition: item_func.h:835
Item_real_func(const POS &pos, Item *a)
Definition: item_func.h:840
enum Item_result result_type() const override
Definition: item_func.h:870
Item_real_func()
Definition: item_func.h:834
Item_real_func(const POS &pos, PT_item_list *list)
Definition: item_func.h:854
Item_real_func(Item *a)
Definition: item_func.h:839
Item_real_func(const POS &pos, Item *a, Item *b)
Definition: item_func.h:846
Item with result field.
Definition: item.h:5829
int raise_decimal_overflow()
Definition: item.h:5888
longlong raise_integer_overflow()
Definition: item.h:5883
longlong llrint_with_overflow_check(double realval)
Definition: item.h:5868
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item.cc:10763
double raise_float_overflow()
Definition: item.h:5878
A wrapper Item that normally returns its parameter, but becomes NULL when processing rows for rollup.
Definition: item_func.h:1718
const char * func_name() const override
Definition: item_func.h:1738
bool rollup_null() const
Definition: item_func.h:1763
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_func.cc:4188
table_map used_tables() const override
Definition: item_func.h:1739
TYPELIB * get_typelib() const override
Get the typelib information for an item of type set or enum.
Definition: item_func.cc:4210
String * val_str(String *str) override
Definition: item_func.cc:4155
bool val_json(Json_wrapper *result) override
Get a JSON value from an Item.
Definition: item_func.cc:4177
const int m_min_rollup_level
Definition: item_func.h:1779
bool eq_specific(const Item *item) const override
Provide a more specific equality check for a function.
Definition: item_func.cc:4205
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:1753
my_decimal * val_decimal(my_decimal *dec) override
Definition: item_func.cc:4166
Item_result result_type() const override
Definition: item_func.h:1752
Item_rollup_group_item(int min_rollup_level, Item *inner_item)
Definition: item_func.h:1720
void set_current_rollup_level(int level)
Definition: item_func.h:1773
int min_rollup_level() const
Definition: item_func.h:1776
int m_current_rollup_level
Definition: item_func.h:1780
longlong val_int() override
Definition: item_func.cc:4144
Item * inner_item()
Definition: item_func.h:1761
const Item * inner_item() const
Definition: item_func.h:1762
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_func.cc:4114
bool get_time(MYSQL_TIME *ltime) override
Definition: item_func.cc:4124
enum Functype functype() const override
Definition: item_func.h:1766
void update_used_tables() override
Updates used tables, not null tables information and accumulates properties up the item tree,...
Definition: item_func.h:1748
double val_real() override
Definition: item_func.cc:4133
Definition: item_func.h:2489
const char * func_name() const override
Definition: item_func.h:2503
bool check_function_as_value_generator(uchar *checker_args) override
Check if this item is allowed for a virtual column or inside a default expression.
Definition: item_func.h:2515
Item_source_pos_wait(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_func.h:2498
Item_source_pos_wait(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_func.h:2496
table_map get_initial_pseudo_tables() const override
Returns the pseudo tables depended upon in order to evaluate this function expression.
Definition: item_func.h:2504
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2507
longlong val_int() override
Wait until we are at or past the given position in the master binlog on the slave.
Definition: item_func.cc:5205
String value
Definition: item_func.h:2491
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_func.cc:5192
Item_int_func super
Definition: item_func.h:2490
Item_source_pos_wait(const POS &pos, Item *a, Item *b)
Definition: item_func.h:2494
Definition: item.h:5661
Utility mixin class to be able to walk() only parts of item trees.
Definition: item.h:738
Definition: item_func.h:1130
Item_typecast_decimal(const POS &pos, Item *a, int len, int dec)
Definition: item_func.h:1135
longlong val_int() override
Definition: item_func.cc:2001
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_func.cc:2039
const char * func_name() const override
Definition: item_func.h:1156
enum Item_result result_type() const override
Definition: item_func.h:1149
void add_json_info(Json_object *obj) override
Add all the node-specific json fields.
Definition: item_func.cc:2053
String * val_str(String *str) override
Definition: item_func.cc:1986
my_decimal * val_decimal(my_decimal *) override
Definition: item_func.cc:2009
bool get_time(MYSQL_TIME *ltime) override
Definition: item_func.h:1145
double val_real() override
Definition: item_func.cc:1993
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_func.h:1142
enum Functype functype() const override
Definition: item_func.h:1157
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:1150
Class used to implement CAST to floating-point data types.
Definition: item_func.h:1165
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_func.cc:2112
void add_json_info(Json_object *obj) override
Add all the node-specific json fields.
Definition: item_func.h:1167
enum Item_result result_type() const override
Definition: item_func.h:1187
Item_typecast_real(const POS &pos, Item *a, bool as_double)
Definition: item_func.h:1173
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:1188
Item_typecast_real(Item *a)
Definition: item_func.h:1180
String * val_str(String *str) override
Definition: item_func.cc:2060
double val_real() override
Definition: item_func.cc:2064
longlong val_int() override
Definition: item_func.h:1183
const char * func_name() const override
Definition: item_func.h:1192
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_func.cc:2095
bool get_time(MYSQL_TIME *ltime) override
Definition: item_func.cc:2100
enum Functype functype() const override
Definition: item_func.h:1193
my_decimal * val_decimal(my_decimal *decimal_value) override
Definition: item_func.cc:2104
Definition: item_func.h:1104
const char * func_name() const override
Definition: item_func.h:1109
Item_typecast_signed(const POS &pos, Item *a)
Definition: item_func.h:1106
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_func.cc:1891
longlong val_int() override
Definition: item_func.cc:1922
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.cc:1898
enum Functype functype() const override
Definition: item_func.h:1114
Definition: item_func.h:1117
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_func.cc:1950
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.cc:1957
Item_typecast_unsigned(const POS &pos, Item *a)
Definition: item_func.h:1119
longlong val_int() override
Definition: item_func.cc:1963
const char * func_name() const override
Definition: item_func.h:1122
enum Functype functype() const override
Definition: item_func.h:1127
Definition: item_func.h:2240
Item_func super
Definition: item_func.h:2241
Item_udf_func(const POS &pos, udf_func *udf_arg, PT_item_list *opt_list)
Definition: item_func.h:2247
const char * func_name() const override
Definition: item_func.h:2254
bool may_have_named_parameters() const override
Named parameters are allowed in a parameter list.
Definition: item_func.h:2278
bool check_function_as_value_generator(uchar *checker_args) override
Check if this item is allowed for a virtual column or inside a default expression.
Definition: item_func.h:2265
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_func.cc:5077
bool fix_fields(THD *thd, Item **ref) override
Definition: item_func.cc:4607
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_func.cc:5071
table_map get_initial_pseudo_tables() const override
Returns the pseudo tables depended upon in order to evaluate this function expression.
Definition: item_func.h:2256
~Item_udf_func() override=default
Item_result result_type() const override
Definition: item_func.h:2261
udf_handler udf
Definition: item_func.h:2244
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_func.cc:5062
enum Functype functype() const override
Definition: item_func.h:2255
void compute_cost(CostOfItem *root_cost) const override
Compute the cost of evaluating this Item.
Definition: item_func.h:2273
bool m_non_deterministic
This member is set during resolving and is used by update_used_tables() and fix_after_pullout() to pr...
Definition: item_func.h:2285
Definition: item_func.h:3417
bool get_date(MYSQL_TIME *, my_time_flags_t) override
Definition: item_func.h:3432
double val_real() override
Definition: item_func.cc:7122
void set_value(const char *str, size_t length, const CHARSET_INFO *cs)
Definition: item_func.cc:7114
longlong val_int() override
Definition: item_func.cc:7127
bool fix_fields(THD *thd, Item **ref) override
Definition: item_func.cc:7083
String * val_str(String *str) override
Definition: item_func.cc:7132
Name_string name
Definition: item_func.h:3418
Item_user_var_as_out_param(const POS &pos, Name_string a)
Definition: item_func.h:3422
enum Type type() const override
Definition: item_func.h:3427
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_func.cc:7142
bool get_time(MYSQL_TIME *) override
Definition: item_func.h:3436
void set_null_value(const CHARSET_INFO *cs)
Definition: item_func.cc:7108
my_decimal * val_decimal(my_decimal *decimal_buffer) override
Definition: item_func.cc:7137
user_var_entry * entry
Definition: item_func.h:3419
Common class for: Item_func_get_system_var Item_func_get_user_var Item_func_set_user_var.
Definition: item_func.h:3065
Item_var_func(const POS &pos, Item *a)
Definition: item_func.h:3073
bool get_time(MYSQL_TIME *ltime) override
Definition: item_func.h:3078
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_func.h:3075
Item_var_func()
Definition: item_func.h:3067
bool check_function_as_value_generator(uchar *checker_args) override
Check if this item is allowed for a virtual column or inside a default expression.
Definition: item_func.h:3081
Item_var_func(THD *thd, Item_var_func *item)
Definition: item_func.h:3070
Item_var_func(Item *a)
Definition: item_func.h:3072
Item_var_func(const POS &pos)
Definition: item_func.h:3068
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:930
virtual double val_real()=0
String str_value
str_values's main purpose is to cache the value in save_in_field
Definition: item.h:3576
void set_nullable(bool nullable)
Definition: item.h:3687
DTCollation collation
Character set and collation properties assigned for this Item.
Definition: item.h:3583
bool get_time_from_decimal(MYSQL_TIME *ltime)
Convert val_decimal() to time in MYSQL_TIME.
Definition: item.cc:1667
bool is_nullable() const
Definition: item.h:3686
bool get_time_from_string(MYSQL_TIME *ltime)
Convert val_str() to time in MYSQL_TIME.
Definition: item.cc:1648
virtual bool propagate_type(THD *thd, const Type_properties &type)
Propagate data type specifications into parameters and user variables.
Definition: item.h:1314
virtual bool get_time(MYSQL_TIME *ltime)=0
void set_data_type_float()
Set the data type of the Item to be single precision floating point.
Definition: item.h:1587
static Item_result type_to_result(enum_field_types type)
Definition: item.h:1042
virtual table_map used_tables() const
Definition: item.h:2364
bool get_time_from_real(MYSQL_TIME *ltime)
Convert val_real() to time in MYSQL_TIME.
Definition: item.cc:1658
bool get_date_from_decimal(MYSQL_TIME *ltime, my_time_flags_t flags)
Convert val_decimal() to date in MYSQL_TIME.
Definition: item.cc:1580
void add_accum_properties(const Item *item)
Add more accumulated properties to an Item.
Definition: item.h:3435
void set_data_type_double()
Set the data type of the Item to be double precision floating point.
Definition: item.h:1579
enum_field_types data_type() const
Retrieve the derived data type of the Item.
Definition: item.h:1481
Item_name_string item_name
Name from query.
Definition: item.h:3584
bool fixed
True if item has been resolved.
Definition: item.h:3675
enum_const_item_cache
How to cache constant JSON data.
Definition: item.h:998
@ CACHE_NONE
Don't cache.
Definition: item.h:1000
virtual Item_result result_type() const
Definition: item.h:1451
bool null_value
True if item is null.
Definition: item.h:3712
Type
Definition: item.h:965
@ FIELD_ITEM
A reference to a field (column) in a table.
Definition: item.h:967
@ FUNC_ITEM
A function call reference.
Definition: item.h:968
@ STRING_ITEM
A string literal value.
Definition: item.h:971
bool get_time_from_non_temporal(MYSQL_TIME *ltime)
Convert a non-temporal type to time.
Definition: item.cc:1723
uint8 m_accum_properties
Definition: item.h:3753
void set_accum_properties(const Item *item)
Set accumulated properties for an Item.
Definition: item.h:3430
my_decimal * val_decimal_from_real(my_decimal *decimal_value)
Definition: item.cc:354
void set_group_by_modifier()
Set the property: this item (tree) contains a reference to a GROUP BY modifier (such as ROLLUP)
Definition: item.h:3481
bool unsigned_flag
Definition: item.h:3713
virtual bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate)=0
virtual bool is_null()
The method allows to determine nullness of a complex expression without fully evaluating it,...
Definition: item.h:2542
bool const_for_execution() const
Returns true if item is constant during one query execution.
Definition: item.h:2437
bool get_date_from_string(MYSQL_TIME *ltime, my_time_flags_t flags)
Convert val_str() to date in MYSQL_TIME.
Definition: item.cc:1561
traverse_order
Definition: item.h:995
bool get_date_from_non_temporal(MYSQL_TIME *ltime, my_time_flags_t fuzzydate)
Convert a non-temporal type to date.
Definition: item.cc:1629
virtual String * val_str(String *str)=0
bool hidden
If the item is in a SELECT list (Query_block::fields) and hidden is true, the item wasn't actually in...
Definition: item.h:3723
bool get_date_from_int(MYSQL_TIME *ltime, my_time_flags_t flags)
Convert val_int() to date in MYSQL_TIME.
Definition: item.cc:1589
void set_data_type_from_item(const Item *item)
Set data type properties of the item from the properties of another item.
Definition: item.h:1799
uint32 max_length
Maximum length of result of evaluating this item, in number of bytes.
Definition: item.h:3601
bool get_date_from_real(MYSQL_TIME *ltime, my_time_flags_t flags)
Convert val_real() to date in MYSQL_TIME.
Definition: item.cc:1571
void set_data_type_longlong()
Set the data type of the Item to be longlong.
Definition: item.h:1555
bool update_null_value()
Make sure the null_value member has a correct value.
Definition: item.cc:7526
void set_data_type_decimal(uint8 precision, uint8 scale)
Set the data type of the Item to be decimal.
Definition: item.h:1569
bool get_time_from_int(MYSQL_TIME *ltime)
Convert val_int() to time in MYSQL_TIME.
Definition: item.cc:1676
Definition: sql_optimizer.h:133
Represents a JSON container value of type "object" (ECMA), type J_OBJECT here.
Definition: json_dom.h:367
bool add_alias(std::string_view key, Json_dom *value)
Insert the value into the object.
Definition: json_dom.h:409
Abstraction for accessing JSON values irrespective of whether they are (started out as) binary JSON v...
Definition: json_dom.h:1150
Definition: sql_list.h:494
Storage for name strings.
Definition: item.h:298
A visitor that calls the specified function on every non-aggregated full-text search function (Item_f...
Definition: item_func.h:3820
std::function< bool(Item_func_match *)> m_func
Definition: item_func.h:3827
bool operator()(Item *item)
Definition: item_func.cc:8000
NonAggregatedFullTextSearchVisitor(std::function< bool(Item_func_match *)> func)
Definition: item_func.cc:7996
Wrapper class for an Item list head, used to allocate Item lists in the parser in a context-independe...
Definition: parse_tree_helpers.h:105
void error(Context *pc, const POS &pos) const
syntax_error() function replacement for deferred reporting of syntax errors
Definition: parse_tree_node_base.h:344
Definition: protocol.h:33
This class represents a query block, aka a query specification, which is a query consisting of a SELE...
Definition: sql_lex.h:1159
Definition: field.h:4712
Definition: item.h:664
A wrapper class for null-terminated constant strings.
Definition: sql_string.h:74
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:167
const CHARSET_INFO * charset() const
Definition: sql_string.h:240
const char * ptr() const
Definition: sql_string.h:249
size_t length() const
Definition: sql_string.h:241
Wrapper interface for all kinds of system variables.
Definition: set_var.h:580
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
Definition: table.h:2900
TABLE * table
Definition: table.h:3677
Type properties, used to collect type information for later assignment to an Item object.
Definition: item.h:627
Table_flags ha_table_flags() const
The cached_table_flags is set at ha_open and ha_external_lock.
Definition: handler.h:4930
A (partial) implementation of std::deque allocating its blocks on a MEM_ROOT.
Definition: mem_root_deque.h:111
my_decimal class limits 'decimal_t' type to what we need in MySQL.
Definition: my_decimal.h:96
sp_head represents one instance of a stored program.
Definition: sp_head.h:383
Definition: sp_head.h:123
Definition: sp_rcontext.h:77
A class representing one system variable - that is something that can be accessed as @global....
Definition: set_var.h:107
Definition: sql_udf.h:83
Item_result result_type() const
Definition: sql_udf.h:119
const char * name() const
Definition: sql_udf.h:118
Definition: item_func.h:3095
char * internal_buffer_ptr()
Position inside a user_var_entry where small values are stored: double values, longlong values and st...
Definition: item_func.h:3112
static const size_t extra_size
Definition: item_func.h:3184
Simple_cstring entry_name
Definition: item_func.h:3209
Item_result m_type
Value type.
Definition: item_func.h:3187
size_t m_length
Value length.
Definition: item_func.h:3186
longlong val_int(bool *null_value) const
Get the value of a variable as an integer.
Definition: item_func.cc:6288
bool unsigned_flag
Definition: item_func.h:3211
THD * m_owner
Definition: item_func.h:3188
size_t length() const
Definition: item_func.h:3283
query_id_t used_query_id() const
Definition: item_func.h:3253
THD * owner_session() const
Definition: item_func.h:3207
static user_var_entry * create(THD *thd, const Name_string &name, const CHARSET_INFO *cs)
Allocates and initializes a user variable instance.
Definition: item_func.cc:6131
void set_value(char *value, size_t length)
Definition: item_func.h:3100
String * val_str(bool *null_value, String *str, uint decimals) const
Get the value of a variable as a string.
Definition: item_func.cc:6327
user_var_entry()=default
const char * ptr() const
Definition: item_func.h:3282
void free_value()
Free the external value buffer, if it's allocated.
Definition: item_func.h:3140
bool store(const void *from, size_t length, Item_result type)
Store a value of the given type into a user_var_entry instance.
Definition: item_func.cc:6178
void init(THD *thd, const Simple_cstring &name, const CHARSET_INFO *cs)
Initialize all members.
Definition: item_func.cc:6166
Item_result type() const
The data type of this variable.
Definition: item_func.h:3285
void destroy()
Free all memory used by a user_var_entry instance previously created by create().
Definition: item_func.h:3272
bool alloced()
Check if m_ptr points to an external buffer previously allocated by realloc().
Definition: item_func.h:3135
void lock()
Definition: item_func.cc:6218
void unlock()
Definition: item_func.cc:6223
void set_null_value(Item_result type)
Set value to NULL.
Definition: item_func.h:3245
void copy_name(const Simple_cstring &name)
Copy the array of characters from the given name into the internal name buffer and initialize entry_n...
Definition: item_func.h:3148
DTCollation collation
Definition: item_func.h:3210
void set_type(Item_result type)
Set type of to the given value.
Definition: item_func.h:3236
char * m_ptr
Value.
Definition: item_func.h:3185
query_id_t m_used_query_id
Set to the id of the most recent query that has used the variable.
Definition: item_func.h:3202
void assert_locked() const
Assert the user variable is locked.
Definition: item_func.cc:6203
void reset_value()
Definition: item_func.h:3096
char * name_ptr()
Position inside a user_var_entry where a null-terminates array of characters representing the variabl...
Definition: item_func.h:3120
double val_real(bool *null_value) const
Get the value of a variable as a double.
Definition: item_func.cc:6259
my_decimal * val_decimal(bool *null_value, my_decimal *result) const
Get the value of a variable as a decimal.
Definition: item_func.cc:6359
bool mem_realloc(size_t length)
Initialize m_ptr to the internal buffer (if the value is small enough), or allocate a separate buffer...
Definition: item_func.cc:6148
void set_used_query_id(query_id_t query_id)
Definition: item_func.h:3252
static MEM_ROOT mem_root
Definition: client_plugin.cc:114
#define E_DEC_FATAL_ERROR
Definition: decimal.h:155
#define E_DEC_OVERFLOW
Definition: decimal.h:150
enum_query_type
Query type constants (usable as bitmap flags).
Definition: enum_query_type.h:31
This file contains the field type.
enum_field_types
Column types for MySQL Note: Keep include/mysql/components/services/bits/stored_program_bits....
Definition: field_types.h:55
@ MYSQL_TYPE_VARCHAR
Definition: field_types.h:71
@ MYSQL_TYPE_LONGLONG
Definition: field_types.h:64
@ MYSQL_TYPE_TIME
Definition: field_types.h:67
@ MYSQL_TYPE_VECTOR
Definition: field_types.h:77
@ MYSQL_TYPE_INVALID
Definition: field_types.h:78
@ MYSQL_TYPE_NEWDECIMAL
Definition: field_types.h:81
@ MYSQL_TYPE_DOUBLE
Definition: field_types.h:61
@ MYSQL_TYPE_DATE
Definition: field_types.h:66
@ MYSQL_TYPE_TIMESTAMP
Definition: field_types.h:63
@ MYSQL_TYPE_DATETIME
Definition: field_types.h:68
static const std::string dec("DECRYPTION")
Some definitions for full-text indices.
ft_operation
Operation types, used in FT_HINTS.
Definition: ft_global.h:99
@ FT_OP_NO
Operation undefined, use of hints is impossible.
Definition: ft_global.h:101
#define FTS_DOCID_IN_RESULT
Definition: ft_global.h:66
#define FT_SORTED
Definition: ft_global.h:108
#define FTS_ORDERED_RESULT
Definition: ft_global.h:65
#define FT_BOOL
Definition: ft_global.h:107
cache_type
Definition: my_sys.h:283
void my_error(int nr, myf MyFlags,...)
Fill in and print a previously registered error message.
Definition: my_error.cc:216
static int flags[50]
Definition: hp_test1.cc:40
static void start(mysql_harness::PluginFuncEnv *env)
Definition: http_auth_backend_plugin.cc:180
bool agg_item_charsets(DTCollation &coll, const char *fname, Item **args, uint nargs, uint flags, int item_sep)
Definition: item.cc:2793
bool agg_item_charsets_for_string_result(DTCollation &c, const char *name, Item **items, uint nitems, int item_sep=1)
Definition: item.h:4095
bool(Item::* Item_analyzer)(uchar **argp)
Definition: item.h:712
void(* Cond_traverser)(const Item *item, void *arg)
Definition: item.h:722
Item *(Item::* Item_transformer)(uchar *arg)
Type for transformers used by Item::transform and Item::compile.
Definition: item.h:721
bool agg_item_charsets_for_comparison(DTCollation &c, const char *name, Item **items, uint nitems, int item_sep=1)
Definition: item.h:4102
bool check_reserved_words(const char *name)
Definition: item_func.cc:166
void report_conversion_error(const CHARSET_INFO *to_cs, const char *from, size_t from_length, const CHARSET_INFO *from_cs)
Definition: item_func.cc:174
Item_field * get_gc_for_expr(const Item *func, Field *fld, Item_result type, Field **found=nullptr)
Return new Item_field if given expression matches GC.
Definition: item_func.cc:1073
bool is_function_of_type(const Item *item, Item_func::Functype type)
Checks if "item" is a function of the specified type.
Definition: item_func.cc:1047
bool simplify_string_args(THD *thd, const DTCollation &c, Item **items, uint nitems)
Simplify the string arguments to a function, if possible.
Definition: item_func.cc:198
void unsupported_json_comparison(size_t arg_count, Item **args, const char *msg)
Go through the arguments of a function and check if any of them are JSON.
Definition: item_func.cc:1644
bool eval_const_cond(THD *thd, Item *cond, bool *value)
Evaluate a constant condition, represented by an Item tree.
Definition: item_func.cc:315
enum_field_types agg_field_type(Item **items, uint nitems)
Aggregates field types from the array of items.
Definition: item_cmpfunc.cc:182
void item_func_sleep_free()
Definition: item_func.cc:5920
void mysql_ull_set_explicit_lock_duration(THD *thd)
Set explicit duration for metadata locks corresponding to user level locks to protect them from being...
Definition: item_func.cc:5388
double my_double_round(double value, longlong dec, bool dec_unsigned, bool truncate)
Definition: item_func.cc:3523
String * eval_string_arg_noinline(const CHARSET_INFO *to_cs, Item *arg, String *buffer)
Evaluate an argument string and return it in the desired character set.
Definition: item_func.cc:265
String * eval_string_arg(const CHARSET_INFO *to_cs, Item *arg, String *buffer)
Definition: item_func.h:93
void item_func_sleep_init()
Definition: item_func.cc:5910
void mysql_ull_cleanup(THD *thd)
Release all user level locks for this THD.
Definition: item_func.cc:5370
void retrieve_tablespace_statistics(THD *thd, Item **args, bool *null_value)
Retrieve tablespace statistics from SE.
Definition: item_func.cc:9705
bool volatile mqh_used
Definition: mysqld.cc:1311
Item * get_system_variable(Parse_context *pc, enum_var_type scope, const LEX_CSTRING &prefix, const LEX_CSTRING &suffix, bool unsafe_for_replication)
Create new Item_func_get_system_var object.
Definition: item_func.cc:8067
bool contains_function_of_type(Item *item, Item_func::Functype type)
Checks if "item" contains a function of the specified type.
Definition: item_func.cc:1052
void uuid_short_init()
Definition: item_func.cc:8635
A better implementation of the UNIX ctype(3) library.
MYSQL_STRINGS_EXPORT CHARSET_INFO my_charset_bin
Definition: ctype-bin.cc:500
int64_t my_strntoll(const CHARSET_INFO *cs, const char *str, size_t length, int base, const char **end, int *err)
Definition: m_ctype.h:747
double my_strntod(const CHARSET_INFO *cs, const char *str, size_t length, const char **end, int *err)
Definition: m_ctype.h:759
bool my_charset_same(const CHARSET_INFO *cs1, const CHARSET_INFO *cs2)
Definition: m_ctype.h:514
This file follows Google coding style, except for the name MEM_ROOT (which is kept for historical rea...
This file includes constants used by all storage engines.
my_off_t ha_rows
Definition: my_base.h:1141
Header for compiler-dependent features.
#define SUPPRESS_UBSAN
Definition: my_compiler.h:120
#define DBUG_TRACE
Definition: my_dbug.h:146
int str2my_decimal(uint mask, const char *from, size_t length, const CHARSET_INFO *charset, my_decimal *decimal_value)
Definition: my_decimal.cc:258
It is interface module to fixed precision decimals library.
int double2my_decimal(uint mask, double val, my_decimal *d)
Definition: my_decimal.h:322
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:56
uint8_t uint8
Definition: my_inttypes.h:63
unsigned char uchar
Definition: my_inttypes.h:52
long long int longlong
Definition: my_inttypes.h:55
#define MYF(v)
Definition: my_inttypes.h:97
void my_free(void *ptr)
Frees the memory pointed by the ptr.
Definition: my_memory.cc:81
Some macros for dealing with pointer arithmetic, e.g., aligning of buffers to a given size.
#define ALIGN_SIZE(A)
Definition: my_pointer_arithmetic.h:36
uint64_t table_map
Definition: my_table_map.h:30
Interface for low level time utilities.
unsigned int my_time_flags_t
Flags to str_to_datetime and number_to_datetime.
Definition: my_time.h:94
#define MAX_BIGINT_WIDTH
Max width for a LONGLONG.
Definition: mysql_com.h:902
Time declarations shared between the server and client API: you should not add anything to this heade...
thread_local MEM_ROOT ** THR_MALLOC
Definition: mysqld.cc:1569
static bool replace
Definition: mysqlimport.cc:70
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1105
Definition: commit_order_queue.h:34
PT & ref(PT *tp)
Definition: tablespace_impl.cc:359
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:76
std::string join(const detail::range auto &rng, std::string_view delim)
join elements of a range into a string separated by a delimiter.
Definition: string.h:74
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:418
Cursor end()
A past-the-end Cursor.
Definition: rules_table_service.cc:192
const char * db_name
Definition: rules_table_service.cc:55
std::map< Key, Value, Compare, ut::allocator< std::pair< const Key, Value > > > map
Specialization of map which uses ut_allocator.
Definition: ut0new.h:2894
std::list< T, ut::allocator< T > > list
Specialization of list which uses ut_allocator.
Definition: ut0new.h:2880
required string type
Definition: replication_group_member_actions.proto:34
"public" interface to sys_var - server configuration variables.
enum_var_type
Definition: set_var.h:92
type_conversion_status
Status when storing a value in a field or converting from one datatype to another.
Definition: field.h:204
@ VGS_CHECK_CONSTRAINT
Definition: field.h:478
@ VGS_GENERATED_COLUMN
Definition: field.h:476
Derivation
For use.
Definition: field.h:181
#define HA_CAN_FULLTEXT_EXT
Definition: handler.h:424
File containing constants that can be used throughout the server.
constexpr const table_map RAND_TABLE_BIT
Definition: sql_const.h:113
enum_walk
Enumeration for {Item,Query_block[_UNIT],Table_function}walk.
Definition: sql_const.h:289
bool(Item::*)(unsigned char *) Item_processor
Processor type for {Item,Query_block[_UNIT],Table_function}walk.
Definition: sql_const.h:307
constexpr const table_map INNER_TABLE_BIT
Definition: sql_const.h:111
Our own string classes, used pervasively throughout the executor.
case opt name
Definition: sslopt-case.h:29
Definition: m_ctype.h:421
Struct used to pass around arguments to/from check_function_as_value_generator.
Definition: item.h:488
int err_code
the error code found during check(if any)
Definition: item.h:495
const char * banned_function_name
the name of the function which is not allowed
Definition: item.h:502
Value_generator_source source
Definition: item.h:500
Definition: ft_global.h:77
Definition: ft_global.h:72
struct _ft_vft * please
Definition: ft_global.h:73
Definition: item.h:3065
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:83
T * ArrayAlloc(size_t num, Args... args)
Allocate 'num' objects of type T, and initialize them to a default value that is created by passing t...
Definition: my_alloc.h:180
Definition: mysql_lex_string.h:40
Definition: mysql_lex_string.h:35
Definition: mysql_time.h:82
Definition: my_bitmap.h:43
Bison "location" class.
Definition: parse_location.h:43
Instances of Name_resolution_context store the information necessary for name resolution of Items and...
Definition: item.h:415
Environment data for the contextualization phase.
Definition: parse_tree_node_base.h:420
Definition: table.h:1421
handler * file
Definition: table.h:1423
Definition: typelib.h:35
Definition: completion_hash.h:35
void(* close_search)(FT_INFO *)
Definition: ft_global.h:51
Definition: mysql_com.h:1109
Definition: result.h:30
Definition: sql_udf.h:44
Item_result
Type of the user defined function return slot and arguments.
Definition: udf_registration_types.h:39
@ STRING_RESULT
not valid for UDFs
Definition: udf_registration_types.h:41
@ DECIMAL_RESULT
not valid for UDFs
Definition: udf_registration_types.h:45
@ REAL_RESULT
char *
Definition: udf_registration_types.h:42
@ INT_RESULT
double
Definition: udf_registration_types.h:43
#define array_elements(A)
Definition: validate_password_imp.cc:50