MySQL 9.3.0
Source Code Documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
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, 2025, 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 {
358 };
365 };
366 enum Type type() const override { return FUNC_ITEM; }
367 virtual enum Functype functype() const { return UNKNOWN_FUNC; }
369
370 explicit Item_func(const POS &pos)
372
374 args[0] = a;
376 }
377 Item_func(const POS &pos, Item *a)
379 args[0] = a;
380 }
381
383 args[0] = a;
384 args[1] = b;
388 }
389 Item_func(const POS &pos, Item *a, Item *b)
391 args[0] = a;
392 args[1] = b;
393 }
394
395 Item_func(Item *a, Item *b, Item *c) {
396 if (alloc_args(*THR_MALLOC, 3)) return;
397 args[0] = a;
398 args[1] = b;
399 args[2] = c;
404 }
405
406 Item_func(const POS &pos, Item *a, Item *b, Item *c)
407 : Item_result_field(pos) {
408 if (alloc_args(*THR_MALLOC, 3)) return;
409 args[0] = a;
410 args[1] = b;
411 args[2] = c;
412 }
413
414 Item_func(Item *a, Item *b, Item *c, Item *d) {
415 if (alloc_args(*THR_MALLOC, 4)) return;
416 args[0] = a;
417 args[1] = b;
418 args[2] = c;
419 args[3] = d;
425 }
426
427 Item_func(const POS &pos, Item *a, Item *b, Item *c, Item *d)
428 : Item_result_field(pos) {
429 if (alloc_args(*THR_MALLOC, 4)) return;
430 args[0] = a;
431 args[1] = b;
432 args[2] = c;
433 args[3] = d;
434 }
435 Item_func(Item *a, Item *b, Item *c, Item *d, Item *e) {
436 if (alloc_args(*THR_MALLOC, 5)) return;
437 args[0] = a;
438 args[1] = b;
439 args[2] = c;
440 args[3] = d;
441 args[4] = e;
448 }
449 Item_func(const POS &pos, Item *a, Item *b, Item *c, Item *d, Item *e)
450 : Item_result_field(pos) {
451 if (alloc_args(*THR_MALLOC, 5)) return;
452 args[0] = a;
453 args[1] = b;
454 args[2] = c;
455 args[3] = d;
456 args[4] = e;
457 }
458 Item_func(Item *a, Item *b, Item *c, Item *d, Item *e, Item *f) {
459 if (alloc_args(*THR_MALLOC, 6)) return;
460 args[0] = a;
461 args[1] = b;
462 args[2] = c;
463 args[3] = d;
464 args[4] = e;
465 args[5] = f;
473 }
474 Item_func(const POS &pos, Item *a, Item *b, Item *c, Item *d, Item *e,
475 Item *f)
476 : Item_result_field(pos) {
477 if (alloc_args(*THR_MALLOC, 6)) return;
478 args[0] = a;
479 args[1] = b;
480 args[2] = c;
481 args[3] = d;
482 args[4] = e;
483 args[5] = f;
484 }
486 set_arguments(list, false);
487 }
488
489 Item_func(const POS &pos, PT_item_list *opt_list);
490
491 // Constructor used for Item_cond_and/or (see Item comment)
492 Item_func(THD *thd, const Item_func *item);
493
494 /// Get the i'th argument of the function that this object represents.
495 virtual Item *get_arg(uint i) { return args[i]; }
496
497 /// Get the i'th argument of the function that this object represents.
498 virtual const Item *get_arg(uint i) const { return args[i]; }
499 virtual Item *set_arg(THD *, uint, Item *) {
500 assert(0);
501 return nullptr;
502 }
503
504 bool do_itemize(Parse_context *pc, Item **res) override;
505
506 bool fix_fields(THD *, Item **ref) override;
507 bool fix_func_arg(THD *, Item **arg);
508 void fix_after_pullout(Query_block *parent_query_block,
509 Query_block *removed_query_block) override;
510 /**
511 Resolve type of function after all arguments have had their data types
512 resolved. Called from resolve_type() when no dynamic parameters
513 are used and from propagate_type() otherwise.
514 */
515 virtual bool resolve_type_inner(THD *) {
516 assert(false);
517 return false;
518 }
519 bool propagate_type(THD *thd, const Type_properties &type) override;
520 /**
521 Returns the pseudo tables depended upon in order to evaluate this
522 function expression. The default implementation returns the empty
523 set.
524 */
525 virtual table_map get_initial_pseudo_tables() const { return 0; }
526 table_map used_tables() const override { return used_tables_cache; }
528 void update_used_tables() override;
530 bool eq(const Item *item) const override;
531 /**
532 Provide a more specific equality check for a function.
533 Combine with Item::eq() to implement a complete equality check.
534 */
535 virtual bool eq_specific(const Item *) const { return true; }
536 virtual optimize_type select_optimize(const THD *) { return OPTIMIZE_NONE; }
537 virtual bool have_rev_func() const { return false; }
538 virtual Item *key_item() const { return args[0]; }
539 /**
540 Copy arguments from list to args array
541
542 @param list function argument list
543 @param context_free true: for use in context-independent
544 constructors (Item_func(POS,...)) i.e. for use
545 in the parser
546 @return true on OOM, false otherwise
547 */
548 bool set_arguments(mem_root_deque<Item *> *list, bool context_free);
549 bool split_sum_func(THD *thd, Ref_item_array ref_item_array,
550 mem_root_deque<Item *> *fields) override;
551 void print(const THD *thd, String *str,
552 enum_query_type query_type) const override;
553 void print_op(const THD *thd, String *str, enum_query_type query_type) const;
554 void print_args(const THD *thd, String *str, uint from,
555 enum_query_type query_type) const;
556 virtual void fix_num_length_and_dec();
557 virtual bool is_deprecated() const { return false; }
558 bool get_arg0_date(MYSQL_TIME *ltime, my_time_flags_t fuzzy_date) {
559 return (null_value = args[0]->get_date(ltime, fuzzy_date));
560 }
561 inline bool get_arg0_time(MYSQL_TIME *ltime) {
562 return (null_value = args[0]->get_time(ltime));
563 }
564 bool is_null() override { return update_null_value() || null_value; }
567 friend class udf_handler;
568 Field *tmp_table_field(TABLE *t_arg) override;
569 Item *get_tmp_table_item(THD *thd) override;
570
571 my_decimal *val_decimal(my_decimal *) override;
572
573 bool agg_arg_charsets(DTCollation &c, Item **items, uint nitems, uint flags,
574 int item_sep) {
575 return agg_item_charsets(c, func_name(), items, nitems, flags, item_sep);
576 }
577 /*
578 Aggregate arguments for string result, e.g: CONCAT(a,b)
579 - convert to @@character_set_connection if all arguments are numbers
580 - allow DERIVATION_NONE
581 */
583 uint nitems, int item_sep = 1) {
584 return agg_item_charsets_for_string_result(c, func_name(), items, nitems,
585 item_sep);
586 }
587 /*
588 Aggregate arguments for comparison, e.g: a=b, a LIKE b, a RLIKE b
589 - don't convert to @@character_set_connection if all arguments are numbers
590 - don't allow DERIVATION_NONE
591 */
593 uint nitems, int item_sep = 1) {
594 return agg_item_charsets_for_comparison(c, func_name(), items, nitems,
595 item_sep);
596 }
597
598 Item *replace_func_call(uchar *) override;
599
600 bool walk(Item_processor processor, enum_walk walk, uchar *arg) override;
601 Item *transform(Item_transformer transformer, uchar *arg) override;
602 Item *compile(Item_analyzer analyzer, uchar **arg_p,
603 Item_transformer transformer, uchar *arg_t) override;
604 void traverse_cond(Cond_traverser traverser, void *arg,
605 traverse_order order) override;
606
607 bool replace_equal_field_checker(uchar **arg) override {
608 Replace_equal *replace = pointer_cast<Replace_equal *>(*arg);
609 replace->stack.push_front(this);
610 return true;
611 }
612
614 pointer_cast<Replace_equal *>(arg)->stack.pop();
615 return this;
616 }
617
618 /**
619 Check whether a function allows replacement of a field with another item:
620 In particular, a replacement that changes the metadata of some Item
621 from non-nullable to nullable is not allowed.
622 Notice that e.g. changing the nullability of an operand of a comparison
623 operator in a WHERE clause that ignores UNKNOWN values is allowed,
624 according to this criterion.
625
626 @param original the field that could be replaced
627 @param subst the item that could be the replacement
628
629 @returns true if replacement is allowed, false otherwise
630 */
631 virtual bool allow_replacement(Item_field *const original,
632 Item *const subst) {
633 return original->is_nullable() || !subst->is_nullable();
634 }
635
636 /**
637 Throw an error if the input double number is not finite, i.e. is either
638 +/-INF or NAN.
639 */
640 inline double check_float_overflow(double value) {
641 return std::isfinite(value) ? value : raise_float_overflow();
642 }
643 /**
644 Throw an error if the input BIGINT value represented by the
645 (longlong value, bool unsigned flag) pair cannot be returned by the
646 function, i.e. is not compatible with this Item's unsigned_flag.
647 */
648 inline longlong check_integer_overflow(longlong value, bool val_unsigned) {
649 if ((unsigned_flag && !val_unsigned && value < 0) ||
650 (!unsigned_flag && val_unsigned &&
651 (ulonglong)value > (ulonglong)LLONG_MAX))
652 return raise_integer_overflow();
653 return value;
654 }
655 /**
656 Throw an error if the error code of a DECIMAL operation is E_DEC_OVERFLOW.
657 */
660 }
661
663 assert(fixed);
664 for (uint i = 0; i < arg_count; i++) {
665 if (args[i]->type() == Item::FIELD_ITEM &&
667 return true;
668 }
669 return false;
670 }
671
673 assert(fixed);
674 for (uint i = 0; i < arg_count; i++) {
675 if (args[i]->type() == Item::FIELD_ITEM &&
676 (args[i]->data_type() == MYSQL_TYPE_DATE ||
678 return true;
679 }
680 return false;
681 }
682
684 assert(fixed);
685 for (uint i = 0; i < arg_count; i++) {
686 if (args[i]->type() == Item::FIELD_ITEM &&
687 (args[i]->data_type() == MYSQL_TYPE_TIME ||
689 return true;
690 }
691 return false;
692 }
693
695 assert(fixed);
696 for (uint i = 0; i < arg_count; i++) {
697 if (args[i]->type() == Item::FIELD_ITEM &&
699 return true;
700 }
701 return false;
702 }
703
704 /*
705 We assume the result of any function that has a TIMESTAMP argument to be
706 timezone-dependent, since a TIMESTAMP value in both numeric and string
707 contexts is interpreted according to the current timezone.
708 The only exception is UNIX_TIMESTAMP() which returns the internal
709 representation of a TIMESTAMP argument verbatim, and thus does not depend on
710 the timezone.
711 */
713 return has_timestamp_args();
714 }
715
716 Item *gc_subst_transformer(uchar *arg) override;
717
718 bool resolve_type(THD *thd) override {
719 // By default, pick PS-param's type from other arguments, or VARCHAR
720 return param_type_uses_non_param(thd);
721 }
722
723 /**
724 Whether an arg of a JSON function can be cached to avoid repetitive
725 string->JSON conversion. This function returns true only for those args,
726 which are the source of JSON data. JSON path args are cached independently
727 and for them this function returns false. Same as for all other type of
728 args.
729
730 @param arg the arg to cache
731
732 @retval true arg can be cached
733 @retval false otherwise
734 */
735 virtual enum_const_item_cache can_cache_json_arg(Item *arg [[maybe_unused]]) {
736 return CACHE_NONE;
737 }
738
739 /// Whether this Item is an equi-join condition. If this Item is a compound
740 /// item (i.e. multiple condition AND'ed together), it will only return true
741 /// if the Item contains only equi-join conditions AND'ed together. This is
742 /// used to determine whether the condition can be used as a join condition
743 /// for hash join (join conditions in hash join must be equi-join conditions),
744 /// or if it should be placed as a filter after the join.
745 virtual bool contains_only_equi_join_condition() const { return false; }
746
747 protected:
748 /**
749 Whether or not an item should contribute to the filtering effect
750 (@see get_filtering_effect()). First it verifies that table
751 requirements are satisfied as follows:
752
753 1) The item must refer to a field in 'filter_for_table' in some
754 way. This reference may be indirect through any number of
755 intermediate items. For example, this item may be an
756 Item_cond_and which refers to an Item_func_eq which refers to
757 the field.
758 2) The item must not refer to other tables than those already
759 read and the table in 'filter_for_table'
760
761 Then it contines to other properties as follows:
762
763 Item_funcs represent "<operand1> OP <operand2> [OP ...]". If the
764 Item_func is to contribute to the filtering effect, then
765
766 1) one of the operands must be a field from 'filter_for_table' that is not
767 in 'fields_to_ignore', and
768 2) depending on the Item_func type filtering effect is calculated
769 for, one or all [1] of the other operand(s) must be an available
770 value, i.e.:
771 - a constant, or
772 - a constant subquery, or
773 - a field value read from a table in 'read_tables', or
774 - a second field in 'filter_for_table', or
775 - a function that only refers to constants or tables in
776 'read_tables', or
777 - special case: an implicit value like NULL in the case of
778 "field IS NULL". Such Item_funcs have arg_count==1.
779
780 [1] "At least one" for multiple equality (X = Y = Z = ...), "all"
781 for the rest (e.g. BETWEEN)
782
783 @param thd The current thread.
784 @param read_tables Tables earlier in the join sequence.
785 Predicates for table 'filter_for_table' that
786 rely on values from these tables can be part of
787 the filter effect.
788 @param filter_for_table The table we are calculating filter effect for
789 @param fields_to_ignore Columns that should be ignored.
790
791
792 @return Item_field that participates in the predicate if none of the
793 requirements are broken, NULL otherwise
794
795 @note: This function only applies to items doing comparison, i.e.
796 boolean predicates. Unfortunately, some of those items do not
797 inherit from Item_bool_func so the member function has to be
798 placed in Item_func.
799 */
801 THD *thd, table_map read_tables, table_map filter_for_table,
802 const MY_BITMAP *fields_to_ignore) const;
803 /**
804 Named parameters are allowed in a parameter list
805
806 The syntax to name parameters in a function call is as follow:
807 <code>foo(expr AS named, expr named, expr AS "named", expr "named")</code>
808 where "AS" is optional.
809 Only UDF function support that syntax.
810
811 @return true if the function item can have named parameters
812 */
813 virtual bool may_have_named_parameters() const { return false; }
814 bool is_non_const_over_literals(uchar *) override { return false; }
815
816 bool check_function_as_value_generator(uchar *checker_args) override {
817 if (is_deprecated()) {
819 pointer_cast<Check_function_as_value_generator_parameters *>(
820 checker_args);
821 func_arg->banned_function_name = func_name();
822 return true;
823 }
824 return false;
825 }
826 bool is_valid_for_pushdown(uchar *arg) override;
827 bool check_column_in_window_functions(uchar *arg) override;
828 bool check_column_in_group_by(uchar *arg) override;
829
831};
832
833class Item_real_func : public Item_func {
834 public:
836 explicit Item_real_func(const POS &pos) : Item_func(pos) {
838 }
839
841 Item_real_func(const POS &pos, Item *a) : Item_func(pos, a) {
843 }
844
846
847 Item_real_func(const POS &pos, Item *a, Item *b) : Item_func(pos, a, b) {
849 }
850
853 }
854
857 }
858
859 String *val_str(String *str) override;
860 my_decimal *val_decimal(my_decimal *decimal_value) override;
861 longlong val_int() override {
862 assert(fixed);
864 }
865 bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override {
866 return get_date_from_real(ltime, fuzzydate);
867 }
868 bool get_time(MYSQL_TIME *ltime) override {
869 return get_time_from_real(ltime);
870 }
871 enum Item_result result_type() const override { return REAL_RESULT; }
872};
873
875 protected:
877
878 public:
881 }
883 : Item_func(pos, a), hybrid_type(REAL_RESULT) {
885 }
886
890 }
891 Item_func_numhybrid(const POS &pos, Item *a, Item *b)
892 : Item_func(pos, a, b), hybrid_type(REAL_RESULT) {
894 }
895
899 }
903 }
904
905 enum Item_result result_type() const override { return hybrid_type; }
907 return MYSQL_TYPE_DOUBLE;
908 }
909 bool resolve_type(THD *thd) override;
910 bool resolve_type_inner(THD *thd) override;
911 void fix_num_length_and_dec() override;
912 virtual void set_numeric_type() = 0; // To be called from resolve_type()
913
914 double val_real() override;
915 longlong val_int() override;
916 my_decimal *val_decimal(my_decimal *) override;
917 String *val_str(String *str) override;
918 bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override;
919 bool get_time(MYSQL_TIME *ltime) override;
920 /**
921 @brief Performs the operation that this functions implements when the
922 result type is INT.
923
924 @return The result of the operation.
925 */
926 virtual longlong int_op() = 0;
927
928 /**
929 @brief Performs the operation that this functions implements when the
930 result type is REAL.
931
932 @return The result of the operation.
933 */
934 virtual double real_op() = 0;
935
936 /**
937 @brief Performs the operation that this functions implements when the
938 result type is DECIMAL.
939
940 @param decimal_value A pointer where the DECIMAL value will be allocated.
941 @return
942 - 0 If the result is NULL
943 - The same pointer it was given, with the area initialized to the
944 result of the operation.
945 */
946 virtual my_decimal *decimal_op(my_decimal *decimal_value) = 0;
947
948 /**
949 @brief Performs the operation that this functions implements when the
950 result type is a string type.
951
952 @return The result of the operation.
953 */
954 virtual String *str_op(String *) = 0;
955 /**
956 @brief Performs the operation that this functions implements when the
957 result type is MYSQL_TYPE_DATE or MYSQL_TYPE_DATETIME.
958
959 @return The result of the operation.
960 */
961 virtual bool date_op(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) = 0;
962 virtual bool time_op(MYSQL_TIME *ltime) = 0;
963 bool is_null() override { return update_null_value() || null_value; }
964};
965
966/* function where type of result detected by first argument */
968 public:
970 Item_func_num1(const POS &pos, Item *a) : Item_func_numhybrid(pos, a) {}
971
973 Item_func_num1(const POS &pos, Item *a, Item *b)
974 : Item_func_numhybrid(pos, a, b) {}
975
976 void fix_num_length_and_dec() override;
977 void set_numeric_type() override;
978 String *str_op(String *) override {
979 assert(0);
980 return nullptr;
981 }
983 assert(0);
984 return false;
985 }
986 bool time_op(MYSQL_TIME *) override {
987 assert(0);
988 return false;
989 }
990};
991
992/* Base class for operations like '+', '-', '*' */
994 public:
996 Item_num_op(const POS &pos, Item *a, Item *b)
997 : Item_func_numhybrid(pos, a, b) {}
998
999 virtual void result_precision() = 0;
1000
1001 void print(const THD *thd, String *str,
1002 enum_query_type query_type) const override {
1003 print_op(thd, str, query_type);
1004 }
1005
1006 void set_numeric_type() override;
1007 String *str_op(String *) override {
1008 assert(0);
1009 return nullptr;
1010 }
1012 assert(0);
1013 return false;
1014 }
1015 bool time_op(MYSQL_TIME *) override {
1016 assert(0);
1017 return false;
1018 }
1019};
1020
1021class Item_int_func : public Item_func {
1022 public:
1024 explicit Item_int_func(const POS &pos) : Item_func(pos) {
1026 }
1027
1029 Item_int_func(const POS &pos, Item *a) : Item_func(pos, a) {
1031 }
1032
1035 }
1036 Item_int_func(const POS &pos, Item *a, Item *b) : Item_func(pos, a, b) {
1038 }
1039
1040 Item_int_func(Item *a, Item *b, Item *c) : Item_func(a, b, c) {
1042 }
1043 Item_int_func(const POS &pos, Item *a, Item *b, Item *c)
1044 : Item_func(pos, a, b, c) {
1046 }
1047
1048 Item_int_func(Item *a, Item *b, Item *c, Item *d) : Item_func(a, b, c, d) {
1050 }
1051 Item_int_func(const POS &pos, Item *a, Item *b, Item *c, Item *d)
1052 : Item_func(pos, a, b, c, d) {
1054 }
1055
1058 }
1059 Item_int_func(const POS &pos, PT_item_list *opt_list)
1060 : Item_func(pos, opt_list) {
1062 }
1063
1064 Item_int_func(THD *thd, Item_int_func *item) : Item_func(thd, item) {
1066 }
1067 double val_real() override;
1068 String *val_str(String *str) override;
1069 bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override {
1070 return get_date_from_int(ltime, fuzzydate);
1071 }
1072 bool get_time(MYSQL_TIME *ltime) override { return get_time_from_int(ltime); }
1073 enum Item_result result_type() const override { return INT_RESULT; }
1074 /*
1075 Concerning PS-param types,
1076 resolve_type(THD *) is not overridden here, as experience shows that for
1077 most child classes of this class, VARCHAR is the best default
1078 */
1079};
1080
1083
1084 public:
1086
1088 return INNER_TABLE_BIT;
1089 }
1090 bool do_itemize(Parse_context *pc, Item **res) override;
1091 const char *func_name() const override { return "connection_id"; }
1092 bool resolve_type(THD *thd) override;
1093 bool fix_fields(THD *thd, Item **ref) override;
1094 longlong val_int() override;
1095 bool check_function_as_value_generator(uchar *checker_args) override {
1097 pointer_cast<Check_function_as_value_generator_parameters *>(
1098 checker_args);
1099 func_arg->banned_function_name = func_name();
1100 return ((func_arg->source == VGS_GENERATED_COLUMN) ||
1101 (func_arg->source == VGS_CHECK_CONSTRAINT));
1102 }
1103};
1104
1106 public:
1107 Item_typecast_signed(const POS &pos, Item *a) : Item_int_func(pos, a) {
1108 unsigned_flag = false;
1109 }
1110 const char *func_name() const override { return "cast_as_signed"; }
1111 longlong val_int() override;
1112 bool resolve_type(THD *thd) override;
1113 void print(const THD *thd, String *str,
1114 enum_query_type query_type) const override;
1115 enum Functype functype() const override { return TYPECAST_FUNC; }
1116};
1117
1119 public:
1120 Item_typecast_unsigned(const POS &pos, Item *a) : Item_int_func(pos, a) {
1121 unsigned_flag = true;
1122 }
1123 const char *func_name() const override { return "cast_as_unsigned"; }
1124 longlong val_int() override;
1125 bool resolve_type(THD *thd) override;
1126 void print(const THD *thd, String *str,
1127 enum_query_type query_type) const override;
1128 enum Functype functype() const override { return TYPECAST_FUNC; }
1129};
1130
1131class Item_typecast_decimal final : public Item_func {
1132 protected:
1133 void add_json_info(Json_object *obj) override;
1134
1135 public:
1136 Item_typecast_decimal(const POS &pos, Item *a, int len, int dec)
1137 : Item_func(pos, a) {
1139 }
1140 String *val_str(String *str) override;
1141 double val_real() override;
1142 longlong val_int() override;
1143 bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override {
1144 return get_date_from_decimal(ltime, fuzzydate);
1145 }
1146 bool get_time(MYSQL_TIME *ltime) override {
1147 return get_time_from_decimal(ltime);
1148 }
1149 my_decimal *val_decimal(my_decimal *) override;
1150 enum Item_result result_type() const override { return DECIMAL_RESULT; }
1151 bool resolve_type(THD *thd) override {
1152 if (reject_vector_args()) return true;
1153 if (args[0]->propagate_type(thd, MYSQL_TYPE_NEWDECIMAL, false, true))
1154 return true;
1155 return false;
1156 }
1157 const char *func_name() const override { return "cast_as_decimal"; }
1158 enum Functype functype() const override { return TYPECAST_FUNC; }
1159 void print(const THD *thd, String *str,
1160 enum_query_type query_type) const override;
1161};
1162
1163/**
1164 Class used to implement CAST to floating-point data types.
1165*/
1166class Item_typecast_real final : public Item_func {
1167 protected:
1168 void add_json_info(Json_object *obj) override {
1169 obj->add_alias("is_double", create_dom_ptr<Json_boolean>(
1171 }
1172
1173 public:
1174 Item_typecast_real(const POS &pos, Item *a, bool as_double)
1175 : Item_func(pos, a) {
1176 if (as_double)
1178 else
1180 }
1182 String *val_str(String *str) override;
1183 double val_real() override;
1184 longlong val_int() override { return val_int_from_real(); }
1185 bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override;
1186 bool get_time(MYSQL_TIME *ltime) override;
1187 my_decimal *val_decimal(my_decimal *decimal_value) override;
1188 enum Item_result result_type() const override { return REAL_RESULT; }
1189 bool resolve_type(THD *thd) override {
1190 if (reject_vector_args()) return true;
1191 return args[0]->propagate_type(thd, MYSQL_TYPE_DOUBLE, false, true);
1192 }
1193 const char *func_name() const override { return "cast_as_real"; }
1194 enum Functype functype() const override { return TYPECAST_FUNC; }
1195 void print(const THD *thd, String *str,
1196 enum_query_type query_type) const override;
1197};
1198
1200 public:
1203 : Item_num_op(pos, a, b) {}
1204
1205 void result_precision() override;
1206 bool check_partition_func_processor(uchar *) override { return false; }
1207 bool check_function_as_value_generator(uchar *) override { return false; }
1208};
1209
1211 public:
1213 Item_func_plus(const POS &pos, Item *a, Item *b)
1214 : Item_func_additive_op(pos, a, b) {}
1215
1216 const char *func_name() const override { return "+"; }
1217
1218 // SUPPRESS_UBSAN: signed integer overflow
1219 longlong int_op() override SUPPRESS_UBSAN;
1220
1221 double real_op() override;
1222 my_decimal *decimal_op(my_decimal *) override;
1223 enum Functype functype() const override { return PLUS_FUNC; }
1224};
1225
1227 public:
1229 Item_func_minus(const POS &pos, Item *a, Item *b)
1230 : Item_func_additive_op(pos, a, b) {}
1231
1232 const char *func_name() const override { return "-"; }
1233
1234 // SUPPRESS_UBSAN: signed integer overflow
1235 longlong int_op() override SUPPRESS_UBSAN;
1236
1237 double real_op() override;
1238 my_decimal *decimal_op(my_decimal *) override;
1239 bool resolve_type(THD *thd) override;
1240 enum Functype functype() const override { return MINUS_FUNC; }
1241};
1242
1243class Item_func_mul final : public Item_num_op {
1244 public:
1246 Item_func_mul(const POS &pos, Item *a, Item *b) : Item_num_op(pos, a, b) {}
1247
1248 const char *func_name() const override { return "*"; }
1249 longlong int_op() override;
1250 double real_op() override;
1251 my_decimal *decimal_op(my_decimal *) override;
1252 void result_precision() override;
1253 bool check_partition_func_processor(uchar *) override { return false; }
1254 bool check_function_as_value_generator(uchar *) override { return false; }
1255 enum Functype functype() const override { return MUL_FUNC; }
1256};
1257
1259 public:
1260 Item_func_div_base(const POS &pos, Item *a, Item *b)
1261 : Item_num_op(pos, a, b) {}
1263 longlong int_op() override;
1264 double real_op() override;
1265 my_decimal *decimal_op(my_decimal *) override;
1266 enum Functype functype() const override { return DIV_FUNC; }
1267
1268 protected:
1270};
1271
1272class Item_func_div final : public Item_func_div_base {
1273 public:
1274 Item_func_div(const POS &pos, Item *a, Item *b)
1275 : Item_func_div_base(pos, a, b) {}
1276 const char *func_name() const override { return "/"; }
1277 bool resolve_type(THD *thd) override;
1278 void result_precision() override;
1279};
1280
1282 public:
1284 Item_func_div_int(const POS &pos, Item *a, Item *b)
1285 : Item_func_div_base(pos, a, b) {}
1286 const char *func_name() const override { return "DIV"; }
1288 return MYSQL_TYPE_LONGLONG;
1289 }
1290 bool resolve_type(THD *thd) override;
1291 void result_precision() override;
1292 void set_numeric_type() override;
1293 bool check_partition_func_processor(uchar *) override { return false; }
1294 bool check_function_as_value_generator(uchar *) override { return false; }
1295};
1296
1297class Item_func_mod final : public Item_num_op {
1298 public:
1300 Item_func_mod(const POS &pos, Item *a, Item *b) : Item_num_op(pos, a, b) {}
1301
1302 longlong int_op() override;
1303 double real_op() override;
1304 my_decimal *decimal_op(my_decimal *) override;
1305 const char *func_name() const override { return "%"; }
1306 void result_precision() override;
1307 bool resolve_type(THD *thd) override;
1308 bool check_partition_func_processor(uchar *) override { return false; }
1309 bool check_function_as_value_generator(uchar *) override { return false; }
1310 enum Functype functype() const override { return MOD_FUNC; }
1311};
1312
1313class Item_func_neg final : public Item_func_num1 {
1314 public:
1316 Item_func_neg(const POS &pos, Item *a) : Item_func_num1(pos, a) {}
1317
1318 double real_op() override;
1319 longlong int_op() override;
1320 my_decimal *decimal_op(my_decimal *) override;
1321 const char *func_name() const override { return "-"; }
1322 enum Functype functype() const override { return NEG_FUNC; }
1323 bool resolve_type(THD *thd) override;
1324 void fix_num_length_and_dec() override;
1325 bool check_partition_func_processor(uchar *) override { return false; }
1326 bool check_function_as_value_generator(uchar *) override { return false; }
1327};
1328
1329class Item_func_abs final : public Item_func_num1 {
1330 public:
1331 Item_func_abs(const POS &pos, Item *a) : Item_func_num1(pos, a) {}
1332 double real_op() override;
1333 longlong int_op() override;
1334 my_decimal *decimal_op(my_decimal *) override;
1335 const char *func_name() const override { return "abs"; }
1336 bool resolve_type(THD *) override;
1337 bool check_partition_func_processor(uchar *) override { return false; }
1338 bool check_function_as_value_generator(uchar *) override { return false; }
1339 enum Functype functype() const override { return ABS_FUNC; }
1340};
1341
1342// A class to handle logarithmic and trigonometric functions
1343
1345 public:
1347 Item_dec_func(const POS &pos, Item *a) : Item_real_func(pos, a) {}
1348
1349 Item_dec_func(const POS &pos, Item *a, Item *b) : Item_real_func(pos, a, b) {}
1350 bool resolve_type(THD *thd) override;
1351};
1352
1353class Item_func_exp final : public Item_dec_func {
1354 public:
1355 Item_func_exp(const POS &pos, Item *a) : Item_dec_func(pos, a) {}
1356 double val_real() override;
1357 const char *func_name() const override { return "exp"; }
1358 enum Functype functype() const override { return EXP_FUNC; }
1359};
1360
1361class Item_func_ln final : public Item_dec_func {
1362 public:
1363 Item_func_ln(const POS &pos, Item *a) : Item_dec_func(pos, a) {}
1364 double val_real() override;
1365 const char *func_name() const override { return "ln"; }
1366 enum Functype functype() const override { return LN_FUNC; }
1367};
1368
1369class Item_func_log final : public Item_dec_func {
1370 public:
1371 Item_func_log(const POS &pos, Item *a) : Item_dec_func(pos, a) {}
1372 Item_func_log(const POS &pos, Item *a, Item *b) : Item_dec_func(pos, a, b) {}
1373 double val_real() override;
1374 const char *func_name() const override { return "log"; }
1375 enum Functype functype() const override { return LOG_FUNC; }
1376};
1377
1378class Item_func_log2 final : public Item_dec_func {
1379 public:
1380 Item_func_log2(const POS &pos, Item *a) : Item_dec_func(pos, a) {}
1381 double val_real() override;
1382 const char *func_name() const override { return "log2"; }
1383};
1384
1385class Item_func_log10 final : public Item_dec_func {
1386 public:
1387 Item_func_log10(const POS &pos, Item *a) : Item_dec_func(pos, a) {}
1388 double val_real() override;
1389 const char *func_name() const override { return "log10"; }
1390 enum Functype functype() const override { return LOG10_FUNC; }
1391};
1392
1393class Item_func_sqrt final : public Item_dec_func {
1394 public:
1395 Item_func_sqrt(const POS &pos, Item *a) : Item_dec_func(pos, a) {}
1396 double val_real() override;
1397 const char *func_name() const override { return "sqrt"; }
1398 enum Functype functype() const override { return SQRT_FUNC; }
1399};
1400
1401class Item_func_pow final : public Item_dec_func {
1402 public:
1403 Item_func_pow(const POS &pos, Item *a, Item *b) : Item_dec_func(pos, a, b) {}
1404 double val_real() override;
1405 const char *func_name() const override { return "pow"; }
1406 enum Functype functype() const override { return POW_FUNC; }
1407};
1408
1409class Item_func_acos final : public Item_dec_func {
1410 public:
1411 Item_func_acos(const POS &pos, Item *a) : Item_dec_func(pos, a) {}
1412 double val_real() override;
1413 const char *func_name() const override { return "acos"; }
1414 enum Functype functype() const override { return ACOS_FUNC; }
1415};
1416
1417class Item_func_asin final : public Item_dec_func {
1418 public:
1419 Item_func_asin(const POS &pos, Item *a) : Item_dec_func(pos, a) {}
1420 double val_real() override;
1421 const char *func_name() const override { return "asin"; }
1422 enum Functype functype() const override { return ASIN_FUNC; }
1423};
1424
1425class Item_func_atan final : public Item_dec_func {
1426 public:
1427 Item_func_atan(const POS &pos, Item *a) : Item_dec_func(pos, a) {}
1428 Item_func_atan(const POS &pos, Item *a, Item *b) : Item_dec_func(pos, a, b) {}
1429 double val_real() override;
1430 const char *func_name() const override { return "atan"; }
1431 enum Functype functype() const override { return ATAN_FUNC; }
1432};
1433
1434class Item_func_cos final : public Item_dec_func {
1435 public:
1436 Item_func_cos(const POS &pos, Item *a) : Item_dec_func(pos, a) {}
1437 double val_real() override;
1438 const char *func_name() const override { return "cos"; }
1439 enum Functype functype() const override { return COS_FUNC; }
1440};
1441
1442class Item_func_sin final : public Item_dec_func {
1443 public:
1444 Item_func_sin(const POS &pos, Item *a) : Item_dec_func(pos, a) {}
1445 double val_real() override;
1446 const char *func_name() const override { return "sin"; }
1447 enum Functype functype() const override { return SIN_FUNC; }
1448};
1449
1450class Item_func_tan final : public Item_dec_func {
1451 public:
1452 Item_func_tan(const POS &pos, Item *a) : Item_dec_func(pos, a) {}
1453 double val_real() override;
1454 const char *func_name() const override { return "tan"; }
1455 enum Functype functype() const override { return TAN_FUNC; }
1456};
1457
1458class Item_func_cot final : public Item_dec_func {
1459 public:
1460 Item_func_cot(const POS &pos, Item *a) : Item_dec_func(pos, a) {}
1461 double val_real() override;
1462 const char *func_name() const override { return "cot"; }
1463 enum Functype functype() const override { return COT_FUNC; }
1464};
1465
1467 public:
1469 Item_func_int_val(const POS &pos, Item *a) : Item_func_num1(pos, a) {}
1470 bool resolve_type_inner(THD *thd) override;
1471};
1472
1474 public:
1476 Item_func_ceiling(const POS &pos, Item *a) : Item_func_int_val(pos, a) {}
1477 const char *func_name() const override { return "ceiling"; }
1478 longlong int_op() override;
1479 double real_op() override;
1480 my_decimal *decimal_op(my_decimal *) override;
1481 bool check_partition_func_processor(uchar *) override { return false; }
1482 bool check_function_as_value_generator(uchar *) override { return false; }
1483 enum Functype functype() const override { return CEILING_FUNC; }
1484};
1485
1487 public:
1489 Item_func_floor(const POS &pos, Item *a) : Item_func_int_val(pos, a) {}
1490 const char *func_name() const override { return "floor"; }
1491 longlong int_op() override;
1492 double real_op() override;
1493 my_decimal *decimal_op(my_decimal *) override;
1494 bool check_partition_func_processor(uchar *) override { return false; }
1495 bool check_function_as_value_generator(uchar *) override { return false; }
1496 enum Functype functype() const override { return FLOOR_FUNC; }
1497};
1498
1499/* This handles round and truncate */
1500
1501class Item_func_round final : public Item_func_num1 {
1503
1504 public:
1505 Item_func_round(Item *a, Item *b, bool trunc_arg)
1506 : Item_func_num1(a, b), truncate(trunc_arg) {}
1507 Item_func_round(const POS &pos, Item *a, Item *b, bool trunc_arg)
1508 : Item_func_num1(pos, a, b), truncate(trunc_arg) {}
1509
1510 const char *func_name() const override {
1511 return truncate ? "truncate" : "round";
1512 }
1513 double real_op() override;
1514 longlong int_op() override;
1515 my_decimal *decimal_op(my_decimal *) override;
1516 bool resolve_type(THD *) override;
1517 enum Functype functype() const override {
1519 }
1520};
1521
1522class Item_func_rand final : public Item_real_func {
1524
1526 bool first_eval{true}; // true if val_real() is called 1st time
1527 public:
1529 Item_func_rand(const POS &pos, Item *a) : Item_real_func(pos, a) {}
1530 explicit Item_func_rand(const POS &pos) : Item_real_func(pos) {}
1531
1532 bool do_itemize(Parse_context *pc, Item **res) override;
1533 double val_real() override;
1534 const char *func_name() const override { return "rand"; }
1535 /**
1536 This function is non-deterministic and hence depends on the
1537 'RAND' pseudo-table.
1538
1539 @returns RAND_TABLE_BIT
1540 */
1542 return RAND_TABLE_BIT;
1543 }
1544 bool fix_fields(THD *thd, Item **ref) override;
1545 bool resolve_type(THD *thd) override;
1546 void cleanup() override {
1547 first_eval = true;
1549 }
1550 bool check_function_as_value_generator(uchar *checker_args) override {
1552 pointer_cast<Check_function_as_value_generator_parameters *>(
1553 checker_args);
1554 func_arg->banned_function_name = func_name();
1555 return ((func_arg->source == VGS_GENERATED_COLUMN) ||
1556 (func_arg->source == VGS_CHECK_CONSTRAINT));
1557 }
1558
1559 private:
1560 void seed_random(Item *val);
1561};
1562
1563class Item_func_sign final : public Item_int_func {
1564 public:
1565 Item_func_sign(const POS &pos, Item *a) : Item_int_func(pos, a) {}
1566 const char *func_name() const override { return "sign"; }
1567 enum Functype functype() const override { return SIGN_FUNC; }
1568 longlong val_int() override;
1569 bool resolve_type(THD *thd) override;
1570};
1571
1572// Common base class for the DEGREES and RADIANS functions.
1574 double mul, add;
1575
1576 protected:
1577 Item_func_units(const POS &pos, Item *a, double mul_arg, double add_arg)
1578 : Item_real_func(pos, a), mul(mul_arg), add(add_arg) {}
1579
1580 public:
1581 double val_real() override;
1582 bool resolve_type(THD *thd) override;
1583};
1584
1586 public:
1588 : Item_func_units(pos, a, 180.0 / M_PI, 0.0) {}
1589 const char *func_name() const override { return "degrees"; }
1590 enum Functype functype() const override { return DEGREES_FUNC; }
1591};
1592
1594 public:
1596 : Item_func_units(pos, a, M_PI / 180.0, 0.0) {}
1597 const char *func_name() const override { return "radians"; }
1598 enum Functype functype() const override { return RADIANS_FUNC; }
1599};
1601 public:
1602 Item_func_min_max(const POS &pos, PT_item_list *opt_list, bool is_least_func)
1603 : Item_func_numhybrid(pos, opt_list),
1604 m_is_least_func(is_least_func),
1606
1607 longlong val_int() override;
1608 double val_real() override;
1609 my_decimal *val_decimal(my_decimal *) override;
1610 longlong int_op() override;
1611 double real_op() override;
1612 my_decimal *decimal_op(my_decimal *) override;
1613 String *str_op(String *) override;
1614 bool date_op(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override;
1615 bool time_op(MYSQL_TIME *ltime) override;
1617 return MYSQL_TYPE_VARCHAR;
1618 }
1619 bool resolve_type(THD *thd) override;
1620 bool resolve_type_inner(THD *thd) override;
1621 void set_numeric_type() override {}
1622 enum Item_result result_type() const override { return hybrid_type; }
1623 TYPELIB *get_typelib() const override;
1624
1625 /**
1626 Make CAST(LEAST_OR_GREATEST(datetime_expr, varchar_expr))
1627 return a number in format YYMMDDhhmmss.
1628 */
1629 enum Item_result cast_to_int_type() const override {
1631 }
1632
1633 /// Returns true if arguments to this function should be compared as dates.
1634 bool compare_as_dates() const;
1635
1636 /// Returns true if at least one of the arguments was of temporal type.
1637 bool has_temporal_arg() const { return temporal_item; }
1638
1639 private:
1640 /// True if LEAST function, false if GREATEST.
1643 /*
1644 Used for determining whether one of the arguments is of temporal type and
1645 for converting arguments to a common output format if arguments are
1646 compared as dates and result type is character string. For example,
1647 LEAST('95-05-05', date '10-10-10') should return '1995-05-05', not
1648 '95-05-05'.
1649 */
1651
1652 /**
1653 Fractional seconds precision to use when converting a time or timestamp
1654 expression into a string.
1655 */
1657 /**
1658 Compare arguments as datetime values.
1659
1660 @param value Pointer to which the datetime value of the winning argument
1661 is written.
1662
1663 @return true if error, false otherwise.
1664 */
1666
1667 /**
1668 Compare arguments as time values.
1669
1670 @param value Pointer to which the time value of the winning argument is
1671 written.
1672
1673 @return true if error, false otherwise.
1674 */
1675 bool cmp_times(longlong *value);
1676};
1677
1678class Item_func_min final : public Item_func_min_max {
1679 public:
1680 Item_func_min(const POS &pos, PT_item_list *opt_list)
1681 : Item_func_min_max(pos, opt_list, true) {}
1682 const char *func_name() const override { return "least"; }
1683 enum Functype functype() const override { return LEAST_FUNC; }
1684};
1685
1686class Item_func_max final : public Item_func_min_max {
1687 public:
1688 Item_func_max(const POS &pos, PT_item_list *opt_list)
1689 : Item_func_min_max(pos, opt_list, false) {}
1690 const char *func_name() const override { return "greatest"; }
1691 enum Functype functype() const override { return GREATEST_FUNC; }
1692};
1693
1694/**
1695 A wrapper Item that normally returns its parameter, but becomes NULL when
1696 processing rows for rollup. Rollup is implemented by AggregateIterator, and
1697 works by means of hierarchical levels -- 0 is the “grand totals” phase, 1 is
1698 where only one group level is active, and so on. E.g., for a query with GROUP
1699 BY a,b, the rows will look like this:
1700
1701 a b rollup level
1702 1 1 2
1703 1 2 2
1704 1 NULL 1
1705 2 1 2
1706 2 NULL 1
1707 NULL NULL 0
1708
1709 Each rollup group item has a minimum level for when it becomes NULL. In the
1710 example above, a would have minimum level 0 and b would have minimum level 1.
1711 For simplicity, the JOIN carries a list of all rollup group items, and they
1712 are being given the current rollup level when it changes. A rollup level of
1713 INT_MAX essentially always disables rollup, which is useful when there are
1714 leftover group items in places that are not relevant for rollup
1715 (e.g., sometimes resolving can leave rollup wrappers in place for temporary
1716 tables that are created before grouping, which should then effectively be
1717 disabled).
1718 */
1719class Item_rollup_group_item final : public Item_func {
1720 public:
1725 // We're going to replace inner_item in the SELECT list, so copy its hidden
1726 // status. (We could have done this in the caller, but it fits naturally in
1727 // with all the other copying done here.)
1729 set_nullable(true);
1731 }
1732 double val_real() override;
1733 longlong val_int() override;
1734 String *val_str(String *str) override;
1736 bool val_json(Json_wrapper *result) override;
1737 bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override;
1738 bool get_time(MYSQL_TIME *ltime) override;
1739 const char *func_name() const override { return "rollup_group_item"; }
1740 table_map used_tables() const override {
1741 /*
1742 If underlying item is non-constant, return its used_tables value.
1743 Otherwise, ensure it is non-constant by adding RAND_TABLE_BIT.
1744 */
1745 return args[0]->const_for_execution()
1746 ? (args[0]->used_tables() | RAND_TABLE_BIT)
1747 : args[0]->used_tables();
1748 }
1749 void update_used_tables() override {
1752 }
1753 Item_result result_type() const override { return args[0]->result_type(); }
1754 bool resolve_type(THD *) override {
1755 // needn't handle dynamic parameter as its const_item() is false.
1757
1758 // The item could be a NULL constant.
1759 null_value = args[0]->is_null();
1760 return false;
1761 }
1762 Item *inner_item() { return args[0]; }
1763 const Item *inner_item() const { return args[0]; }
1764 bool rollup_null() const {
1766 }
1767 enum Functype functype() const override { return ROLLUP_GROUP_ITEM_FUNC; }
1768 void print(const THD *thd, String *str,
1769 enum_query_type query_type) const override;
1770 bool eq_specific(const Item *item) const override;
1771 TYPELIB *get_typelib() const override;
1772
1773 // Used by AggregateIterator.
1775
1776 // Used when cloning the item only.
1777 int min_rollup_level() const { return m_min_rollup_level; }
1778
1779 private:
1782};
1783
1786
1787 public:
1788 Item_func_length(const POS &pos, Item *a) : Item_int_func(pos, a) {}
1789 longlong val_int() override;
1790 const char *func_name() const override { return "length"; }
1791 bool resolve_type(THD *thd) override {
1792 if (param_type_is_default(thd, 0, 1)) return true;
1793 max_length = 10;
1794 return false;
1795 }
1796};
1797
1800
1801 public:
1802 Item_func_vector_dim(const POS &pos, Item *a) : Item_int_func(pos, a) {}
1803 longlong val_int() override;
1804 const char *func_name() const override { return "vector_dim"; }
1805 bool resolve_type(THD *thd) override {
1806 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_VECTOR)) {
1807 return true;
1808 }
1809 bool valid_type = (args[0]->data_type() == MYSQL_TYPE_VECTOR) ||
1810 (args[0]->result_type() == STRING_RESULT &&
1812 if (!valid_type) {
1813 my_error(ER_WRONG_ARGUMENTS, MYF(0), func_name());
1814 return true;
1815 }
1816 max_length = 10;
1817 return false;
1818 }
1819};
1820
1822 public:
1823 Item_func_bit_length(const POS &pos, Item *a) : Item_func_length(pos, a) {}
1824 longlong val_int() override {
1825 assert(fixed);
1826 return Item_func_length::val_int() * 8;
1827 }
1828 const char *func_name() const override { return "bit_length"; }
1829};
1830
1833
1834 public:
1836 Item_func_char_length(const POS &pos, Item *a) : Item_int_func(pos, a) {}
1837 longlong val_int() override;
1838 const char *func_name() const override { return "char_length"; }
1839 bool resolve_type(THD *thd) override {
1840 max_length = 10;
1841 return Item_int_func::resolve_type(thd);
1842 }
1843};
1844
1846 public:
1847 Item_func_coercibility(const POS &pos, Item *a) : Item_int_func(pos, a) {
1848 null_on_null = false;
1849 }
1850 longlong val_int() override;
1851 const char *func_name() const override { return "coercibility"; }
1852 bool resolve_type(THD *thd) override {
1853 max_length = 10;
1854 set_nullable(false);
1855 return Item_int_func::resolve_type(thd);
1856 }
1857};
1858
1861
1862 public:
1864 Item_func_locate(const POS &pos, Item *a, Item *b)
1865 : Item_int_func(pos, a, b) {}
1866 Item_func_locate(const POS &pos, Item *a, Item *b, Item *c)
1867 : Item_int_func(pos, a, b, c) {}
1868
1869 const char *func_name() const override { return "locate"; }
1870 longlong val_int() override;
1871 bool resolve_type(THD *thd) override;
1872 void print(const THD *thd, String *str,
1873 enum_query_type query_type) const override;
1874};
1875
1876class Item_func_instr final : public Item_func_locate {
1877 public:
1878 Item_func_instr(const POS &pos, Item *a, Item *b)
1879 : Item_func_locate(pos, a, b) {}
1880
1881 const char *func_name() const override { return "instr"; }
1882};
1883
1885 public:
1887 : Item_int_func(pos, a) {}
1888 longlong val_int() override;
1889 const char *func_name() const override {
1890 return "validate_password_strength";
1891 }
1892 bool resolve_type(THD *thd) override {
1893 max_length = 10;
1894 set_nullable(true);
1895 return Item_int_func::resolve_type(thd);
1896 }
1897};
1898
1899class Item_func_field final : public Item_int_func {
1902
1903 public:
1904 Item_func_field(const POS &pos, PT_item_list *opt_list)
1905 : Item_int_func(pos, opt_list) {}
1906 longlong val_int() override;
1907 const char *func_name() const override { return "field"; }
1908 bool resolve_type(THD *thd) override;
1909};
1910
1911class Item_func_ascii final : public Item_int_func {
1913
1914 public:
1915 Item_func_ascii(const POS &pos, Item *a) : Item_int_func(pos, a) {}
1916 longlong val_int() override;
1917 const char *func_name() const override { return "ascii"; }
1918 bool resolve_type(THD *thd) override {
1919 max_length = 3;
1920 return Item_int_func::resolve_type(thd);
1921 }
1922};
1923
1924class Item_func_ord final : public Item_int_func {
1926
1927 public:
1928 Item_func_ord(const POS &pos, Item *a) : Item_int_func(pos, a) {}
1929 longlong val_int() override;
1930 const char *func_name() const override { return "ord"; }
1931};
1932
1935 /*
1936 if m_enum_value is non-zero, it indicates the index of the value of
1937 argument 0 in the set in argument 1, given that argument 0 is
1938 a constant value and argument 1 is a field of type SET.
1939 */
1942
1943 public:
1945 : Item_int_func(pos, a, b) {}
1946 longlong val_int() override;
1947 const char *func_name() const override { return "find_in_set"; }
1948 bool resolve_type(THD *) override;
1949 const CHARSET_INFO *compare_collation() const override {
1950 return cmp_collation.collation;
1951 }
1952};
1953
1954/* Base class for all bit functions: '~', '|', '^', '&', '>>', '<<' */
1955
1956class Item_func_bit : public Item_func {
1957 protected:
1958 /// Stores the Item's result type. Can only be INT_RESULT or STRING_RESULT
1960 /// Buffer storing the determined value
1962 /**
1963 @returns true if the second argument should be of binary type for the
1964 result to be of binary type.
1965 */
1967
1968 public:
1969 Item_func_bit(const POS &pos, Item *a, Item *b) : Item_func(pos, a, b) {}
1970 Item_func_bit(const POS &pos, Item *a) : Item_func(pos, a) {}
1971
1972 bool resolve_type(THD *) override;
1973 enum Item_result result_type() const override { return hybrid_type; }
1974
1975 longlong val_int() override;
1976 String *val_str(String *str) override;
1977 double val_real() override;
1978 my_decimal *val_decimal(my_decimal *decimal_value) override;
1979
1980 void print(const THD *thd, String *str,
1981 enum_query_type query_type) const override {
1982 print_op(thd, str, query_type);
1983 }
1984 bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override {
1985 if (hybrid_type == INT_RESULT)
1986 return get_date_from_int(ltime, fuzzydate);
1987 else
1988 return get_date_from_string(ltime, fuzzydate);
1989 }
1990 bool get_time(MYSQL_TIME *ltime) override {
1991 if (hybrid_type == INT_RESULT)
1992 return get_time_from_int(ltime);
1993 else
1994 return get_time_from_string(ltime);
1995 }
1996
1997 private:
1998 /**
1999 @brief Performs the operation on integers to produce a result of type
2000 INT_RESULT.
2001 @return The result of the operation.
2002 */
2003 virtual longlong int_op() = 0;
2004
2005 /**
2006 @brief Performs the operation on binary strings to produce a result of
2007 type STRING_RESULT.
2008 @return The result of the operation.
2009 */
2010 virtual String *str_op(String *) = 0;
2011};
2012
2013/**
2014 Base class for all the bit functions that work with two binary
2015 arguments: '&', '|', '^'.
2016*/
2017
2019 protected:
2021 return true;
2022 }
2023 template <class Char_func, class Int_func>
2024 String *eval_str_op(String *, Char_func char_func, Int_func int_func);
2025 template <class Int_func>
2026 longlong eval_int_op(Int_func int_func);
2027
2028 public:
2030 : Item_func_bit(pos, a, b) {}
2031};
2032
2034 public:
2035 Item_func_bit_or(const POS &pos, Item *a, Item *b)
2036 : Item_func_bit_two_param(pos, a, b) {}
2037 const char *func_name() const override { return "|"; }
2038
2039 private:
2040 longlong int_op() override { return eval_int_op(std::bit_or<ulonglong>()); }
2041 String *str_op(String *str) override {
2042 return eval_str_op(str, std::bit_or<char>(), std::bit_or<ulonglong>());
2043 }
2044};
2045
2047 public:
2048 Item_func_bit_and(const POS &pos, Item *a, Item *b)
2049 : Item_func_bit_two_param(pos, a, b) {}
2050 const char *func_name() const override { return "&"; }
2051
2052 private:
2053 longlong int_op() override { return eval_int_op(std::bit_and<ulonglong>()); }
2054 String *str_op(String *str) override {
2055 return eval_str_op(str, std::bit_and<char>(), std::bit_and<ulonglong>());
2056 }
2057};
2058
2060 public:
2061 Item_func_bit_xor(const POS &pos, Item *a, Item *b)
2062 : Item_func_bit_two_param(pos, a, b) {}
2063 const char *func_name() const override { return "^"; }
2064
2065 private:
2066 longlong int_op() override { return eval_int_op(std::bit_xor<ulonglong>()); }
2067 String *str_op(String *str) override {
2068 return eval_str_op(str, std::bit_xor<char>(), std::bit_xor<ulonglong>());
2069 }
2070};
2071
2073 public:
2074 Item_func_bit_count(const POS &pos, Item *a) : Item_int_func(pos, a) {}
2075 longlong val_int() override;
2076 const char *func_name() const override { return "bit_count"; }
2077 bool resolve_type(THD *thd) override {
2078 // Default: binary string; reprepare if integer
2079 if (args[0]->data_type() == MYSQL_TYPE_INVALID &&
2080 args[0]->propagate_type(
2082 return true;
2084 return false;
2085 }
2086};
2087
2089 protected:
2091 return false;
2092 }
2093 template <bool to_left>
2095 template <bool to_left>
2097
2098 public:
2099 Item_func_shift(const POS &pos, Item *a, Item *b)
2100 : Item_func_bit(pos, a, b) {}
2101};
2102
2104 public:
2105 Item_func_shift_left(const POS &pos, Item *a, Item *b)
2106 : Item_func_shift(pos, a, b) {}
2107 const char *func_name() const override { return "<<"; }
2108
2109 private:
2110 longlong int_op() override;
2111 String *str_op(String *str) override;
2112};
2113
2115 public:
2117 : Item_func_shift(pos, a, b) {}
2118 const char *func_name() const override { return ">>"; }
2119
2120 private:
2121 longlong int_op() override;
2122 String *str_op(String *str) override;
2123};
2124
2125class Item_func_bit_neg final : public Item_func_bit {
2126 protected:
2128 return false;
2129 }
2130
2131 public:
2132 Item_func_bit_neg(const POS &pos, Item *a) : Item_func_bit(pos, a) {}
2133 const char *func_name() const override { return "~"; }
2134 void print(const THD *thd, String *str,
2135 enum_query_type query_type) const override {
2136 Item_func::print(thd, str, query_type);
2137 }
2138
2139 private:
2140 longlong int_op() override;
2141 String *str_op(String *str) override;
2142};
2143
2146
2147 public:
2149 explicit Item_func_last_insert_id(const POS &pos) : Item_int_func(pos) {}
2150 Item_func_last_insert_id(const POS &pos, Item *a) : Item_int_func(pos, a) {}
2151
2152 bool do_itemize(Parse_context *pc, Item **res) override;
2153 longlong val_int() override;
2154 const char *func_name() const override { return "last_insert_id"; }
2155
2157 return INNER_TABLE_BIT;
2158 }
2159
2160 bool resolve_type(THD *thd) override {
2161 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_LONGLONG)) return true;
2162 unsigned_flag = true;
2163 return false;
2164 }
2165 bool check_function_as_value_generator(uchar *checker_args) override {
2167 pointer_cast<Check_function_as_value_generator_parameters *>(
2168 checker_args);
2169 func_arg->banned_function_name = func_name();
2170 return true;
2171 }
2172};
2173
2176
2177 public:
2178 Item_func_benchmark(const POS &pos, Item *count_expr, Item *expr)
2179 : Item_int_func(pos, count_expr, expr) {}
2180
2181 /// Ensure that "benchmark()" is never optimized away
2183 return RAND_TABLE_BIT;
2184 }
2185
2186 bool do_itemize(Parse_context *pc, Item **res) override;
2187 longlong val_int() override;
2188 const char *func_name() const override { return "benchmark"; }
2189 bool resolve_type(THD *thd) override {
2190 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_LONGLONG)) return true;
2191 if (param_type_is_default(thd, 1, 2)) return true;
2192 max_length = 1;
2193 set_nullable(true);
2194 return false;
2195 }
2196 void print(const THD *thd, String *str,
2197 enum_query_type query_type) const override;
2198 bool check_function_as_value_generator(uchar *checker_args) override {
2200 pointer_cast<Check_function_as_value_generator_parameters *>(
2201 checker_args);
2202 func_arg->banned_function_name = func_name();
2203 return true;
2204 }
2205};
2206
2209
2210class Item_func_sleep final : public Item_int_func {
2212
2213 public:
2214 Item_func_sleep(const POS &pos, Item *a) : Item_int_func(pos, a) {}
2215
2216 bool do_itemize(Parse_context *pc, Item **res) override;
2217 const char *func_name() const override { return "sleep"; }
2218 /**
2219 This function is non-deterministic and hence depends on the
2220 'RAND' pseudo-table.
2221
2222 @returns RAND_TABLE_BIT
2223 */
2225 return RAND_TABLE_BIT;
2226 }
2227 bool check_function_as_value_generator(uchar *checker_args) override {
2229 pointer_cast<Check_function_as_value_generator_parameters *>(
2230 checker_args);
2231 func_arg->banned_function_name = func_name();
2232 return true;
2233 }
2234 bool resolve_type(THD *thd) override {
2235 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_DOUBLE)) return true;
2236 return Item_int_func::resolve_type(thd);
2237 }
2238 longlong val_int() override;
2239};
2240
2241class Item_udf_func : public Item_func {
2243
2244 protected:
2246
2247 public:
2248 Item_udf_func(const POS &pos, udf_func *udf_arg, PT_item_list *opt_list)
2249 : Item_func(pos, opt_list), udf(udf_arg) {
2250 null_on_null = false;
2251 }
2252 ~Item_udf_func() override = default;
2253
2254 bool do_itemize(Parse_context *pc, Item **res) override;
2255 const char *func_name() const override { return udf.name(); }
2256 enum Functype functype() const override { return UDF_FUNC; }
2259 }
2260 bool fix_fields(THD *thd, Item **ref) override;
2261 void cleanup() override;
2262 Item_result result_type() const override { return udf.result_type(); }
2263 void print(const THD *thd, String *str,
2264 enum_query_type query_type) const override;
2265
2266 bool check_function_as_value_generator(uchar *checker_args) override {
2268 pointer_cast<Check_function_as_value_generator_parameters *>(
2269 checker_args);
2270 func_arg->banned_function_name = func_name();
2271 return true;
2272 }
2273
2274 void compute_cost(CostOfItem *root_cost) const override {
2275 root_cost->MarkExpensive();
2276 }
2277
2278 protected:
2279 bool may_have_named_parameters() const override { return true; }
2280
2281 private:
2282 /**
2283 This member is set during resolving and is used by update_used_tables() and
2284 fix_after_pullout() to preserve the non-deterministic property.
2285 */
2287};
2288
2290 public:
2291 Item_func_udf_float(const POS &pos, udf_func *udf_arg, PT_item_list *opt_list)
2292 : Item_udf_func(pos, udf_arg, opt_list) {}
2293 longlong val_int() override {
2294 assert(fixed);
2296 }
2297 my_decimal *val_decimal(my_decimal *dec_buf) override {
2298 const double res = val_real();
2299 if (null_value) return nullptr;
2300 double2my_decimal(E_DEC_FATAL_ERROR, res, dec_buf);
2301 return dec_buf;
2302 }
2303 double val_real() override;
2304 String *val_str(String *str) override;
2305 bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override {
2306 return get_date_from_real(ltime, fuzzydate);
2307 }
2308 bool get_time(MYSQL_TIME *ltime) override {
2309 return get_time_from_real(ltime);
2310 }
2311 bool resolve_type(THD *) override {
2313 fix_num_length_and_dec(); // @todo - needed?
2314 return false;
2315 }
2316};
2317
2318class Item_func_udf_int final : public Item_udf_func {
2319 public:
2320 Item_func_udf_int(const POS &pos, udf_func *udf_arg, PT_item_list *opt_list)
2321 : Item_udf_func(pos, udf_arg, opt_list) {}
2322 longlong val_int() override;
2323 double val_real() override {
2324 return static_cast<double>(Item_func_udf_int::val_int());
2325 }
2326 String *val_str(String *str) override;
2327 bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override {
2328 return get_date_from_int(ltime, fuzzydate);
2329 }
2330 bool get_time(MYSQL_TIME *ltime) override { return get_time_from_int(ltime); }
2331 enum Item_result result_type() const override { return INT_RESULT; }
2332 bool resolve_type(THD *) override {
2334 return false;
2335 }
2336};
2337
2339 public:
2340 Item_func_udf_decimal(const POS &pos, udf_func *udf_arg,
2341 PT_item_list *opt_list)
2342 : Item_udf_func(pos, udf_arg, opt_list) {}
2343 longlong val_int() override;
2344 double val_real() override;
2345 my_decimal *val_decimal(my_decimal *) override;
2346 String *val_str(String *str) override;
2347 bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override {
2348 return get_date_from_decimal(ltime, fuzzydate);
2349 }
2350 bool get_time(MYSQL_TIME *ltime) override {
2351 return get_time_from_decimal(ltime);
2352 }
2353 enum Item_result result_type() const override { return DECIMAL_RESULT; }
2354 bool resolve_type(THD *thd) override;
2355};
2356
2358 public:
2359 Item_func_udf_str(const POS &pos, udf_func *udf_arg, PT_item_list *opt_list)
2360 : Item_udf_func(pos, udf_arg, opt_list) {}
2361
2362 String *val_str(String *) override;
2363 double val_real() override {
2364 int err_not_used;
2365 const char *end_not_used;
2366 String *res;
2367 res = val_str(&str_value);
2368 return res ? my_strntod(res->charset(), res->ptr(), res->length(),
2369 &end_not_used, &err_not_used)
2370 : 0.0;
2371 }
2372 longlong val_int() override {
2373 int err_not_used;
2374 String *res;
2375 res = val_str(&str_value);
2376 return res ? my_strntoll(res->charset(), res->ptr(), res->length(), 10,
2377 nullptr, &err_not_used)
2378 : (longlong)0;
2379 }
2380 my_decimal *val_decimal(my_decimal *dec_buf) override {
2381 String *res = val_str(&str_value);
2382 if (!res) return nullptr;
2383 str2my_decimal(E_DEC_FATAL_ERROR, res->ptr(), res->length(), res->charset(),
2384 dec_buf);
2385 return dec_buf;
2386 }
2387 bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override {
2388 return get_date_from_string(ltime, fuzzydate);
2389 }
2390 bool get_time(MYSQL_TIME *ltime) override {
2391 return get_time_from_string(ltime);
2392 }
2393 enum Item_result result_type() const override { return STRING_RESULT; }
2394 bool resolve_type(THD *thd) override;
2395};
2396
2397void mysql_ull_cleanup(THD *thd);
2399
2400class Item_func_get_lock final : public Item_int_func {
2402
2404
2405 public:
2406 Item_func_get_lock(const POS &pos, Item *a, Item *b)
2407 : Item_int_func(pos, a, b) {}
2408
2409 bool do_itemize(Parse_context *pc, Item **res) override;
2410 longlong val_int() override;
2411 const char *func_name() const override { return "get_lock"; }
2413 return INNER_TABLE_BIT;
2414 }
2415 bool resolve_type(THD *thd) override {
2416 if (param_type_is_default(thd, 0, 1)) return true;
2417 if (param_type_is_default(thd, 1, 2, MYSQL_TYPE_LONGLONG)) return true;
2418 max_length = 1;
2419 set_nullable(true);
2420 return false;
2421 }
2422 bool is_non_const_over_literals(uchar *) override { return true; }
2423 bool check_function_as_value_generator(uchar *checker_args) override {
2425 pointer_cast<Check_function_as_value_generator_parameters *>(
2426 checker_args);
2427 func_arg->banned_function_name = func_name();
2428 return true;
2429 }
2430};
2431
2434
2436
2437 public:
2438 Item_func_release_lock(const POS &pos, Item *a) : Item_int_func(pos, a) {}
2439 bool do_itemize(Parse_context *pc, Item **res) override;
2440
2441 longlong val_int() override;
2442 const char *func_name() const override { return "release_lock"; }
2444 return INNER_TABLE_BIT;
2445 }
2446 bool resolve_type(THD *thd) override {
2447 if (param_type_is_default(thd, 0, 1)) return true;
2448 max_length = 1;
2449 set_nullable(true);
2450 return false;
2451 }
2452 bool is_non_const_over_literals(uchar *) override { return true; }
2453 bool check_function_as_value_generator(uchar *checker_args) override {
2455 pointer_cast<Check_function_as_value_generator_parameters *>(
2456 checker_args);
2457 func_arg->banned_function_name = func_name();
2458 return true;
2459 }
2460};
2461
2464
2465 public:
2466 explicit Item_func_release_all_locks(const POS &pos) : Item_int_func(pos) {}
2467 bool do_itemize(Parse_context *pc, Item **res) override;
2468
2469 longlong val_int() override;
2470 const char *func_name() const override { return "release_all_locks"; }
2472 return INNER_TABLE_BIT;
2473 }
2474 bool resolve_type(THD *) override {
2475 unsigned_flag = true;
2476 return false;
2477 }
2478 bool is_non_const_over_literals(uchar *) override { return true; }
2479 bool check_function_as_value_generator(uchar *checker_args) override {
2481 pointer_cast<Check_function_as_value_generator_parameters *>(
2482 checker_args);
2483 func_arg->banned_function_name = func_name();
2484 return true;
2485 }
2486};
2487
2488/* replication functions */
2489
2493
2494 public:
2495 Item_source_pos_wait(const POS &pos, Item *a, Item *b)
2496 : Item_int_func(pos, a, b) {}
2497 Item_source_pos_wait(const POS &pos, Item *a, Item *b, Item *c)
2498 : Item_int_func(pos, a, b, c) {}
2499 Item_source_pos_wait(const POS &pos, Item *a, Item *b, Item *c, Item *d)
2500 : Item_int_func(pos, a, b, c, d) {}
2501
2502 bool do_itemize(Parse_context *pc, Item **res) override;
2503 longlong val_int() override;
2504 const char *func_name() const override { return "source_pos_wait"; }
2506 return INNER_TABLE_BIT;
2507 }
2508 bool resolve_type(THD *thd) override {
2509 if (param_type_is_default(thd, 0, 1)) return true;
2510 if (param_type_is_default(thd, 1, 3, MYSQL_TYPE_LONGLONG)) return true;
2511 if (param_type_is_default(thd, 3, 4)) return true;
2512 max_length = 21;
2513 set_nullable(true);
2514 return false;
2515 }
2516 bool check_function_as_value_generator(uchar *checker_args) override {
2518 pointer_cast<Check_function_as_value_generator_parameters *>(
2519 checker_args);
2520 func_arg->banned_function_name = func_name();
2521 return true;
2522 }
2523};
2524
2526 public:
2527 Item_master_pos_wait(const POS &pos, Item *a, Item *b)
2528 : Item_source_pos_wait(pos, a, b) {}
2529 Item_master_pos_wait(const POS &pos, Item *a, Item *b, Item *c)
2530 : Item_source_pos_wait(pos, a, b, c) {}
2531 Item_master_pos_wait(const POS &pos, Item *a, Item *b, Item *c, Item *d)
2532 : Item_source_pos_wait(pos, a, b, c, d) {}
2533 longlong val_int() override;
2534};
2535
2536/**
2537 Internal functions used by INFORMATION_SCHEMA implementation to check
2538 if user have access to given database/table/column.
2539*/
2540
2542 public:
2544 : Item_int_func(pos, a) {}
2545 longlong val_int() override;
2546 const char *func_name() const override { return "can_access_database"; }
2547 bool resolve_type(THD *) override {
2548 set_nullable(true);
2549 return false;
2550 }
2551};
2552
2554 public:
2556 : Item_int_func(pos, a, b) {}
2557 longlong val_int() override;
2558 const char *func_name() const override { return "can_access_table"; }
2559 bool resolve_type(THD *) override {
2560 set_nullable(true);
2561 return false;
2562 }
2563};
2564
2566 public:
2568 : Item_int_func(pos, a, b) {}
2569 longlong val_int() override;
2570 const char *func_name() const override { return "can_access_user"; }
2571 bool resolve_type(THD *) override {
2572 set_nullable(true);
2573 return false;
2574 }
2575};
2576
2578 public:
2580 : Item_int_func(pos, a, b) {}
2581 longlong val_int() override;
2582 const char *func_name() const override { return "can_access_trigger"; }
2583 bool resolve_type(THD *) override {
2584 max_length = 4;
2585 set_nullable(true);
2586 return false;
2587 }
2588};
2589
2591 public:
2593 : Item_int_func(pos, list) {}
2594 longlong val_int() override;
2595 const char *func_name() const override { return "can_access_routine"; }
2596 bool resolve_type(THD *) override {
2597 max_length = 4;
2598 set_nullable(true);
2599 return false;
2600 }
2601};
2602
2604 public:
2606 longlong val_int() override;
2607 const char *func_name() const override { return "can_access_event"; }
2608 bool resolve_type(THD *) override {
2609 set_nullable(true);
2610 return false;
2611 }
2612};
2613
2615 public:
2617 : Item_int_func(pos, a) {}
2618 longlong val_int() override;
2619 const char *func_name() const override { return "can_access_resource_group"; }
2620 bool resolve_type(THD *) override {
2621 max_length = 1; // Function can return 0 or 1.
2622 set_nullable(true);
2623 return false;
2624 }
2625};
2626
2628 public:
2629 Item_func_can_access_view(const POS &pos, Item *a, Item *b, Item *c, Item *d)
2630 : Item_int_func(pos, a, b, c, d) {}
2631 longlong val_int() override;
2632 const char *func_name() const override { return "can_access_view"; }
2633 bool resolve_type(THD *) override {
2634 set_nullable(true);
2635 return false;
2636 }
2637};
2638
2640 public:
2642 : Item_int_func(pos, a, b, c) {}
2643 longlong val_int() override;
2644 const char *func_name() const override { return "can_access_column"; }
2645 bool resolve_type(THD *) override {
2646 set_nullable(true);
2647 return false;
2648 }
2649};
2650
2652 public:
2654 : Item_int_func(pos, a) {}
2656 : Item_int_func(pos, a, b) {}
2658 : Item_int_func(pos, a, b, c) {}
2659 longlong val_int() override;
2660 const char *func_name() const override { return "is_visible_dd_object"; }
2661 bool resolve_type(THD *) override {
2662 max_length = 1;
2663 set_nullable(true);
2664 return false;
2665 }
2666};
2667
2669 public:
2671 : Item_int_func(pos, list) {}
2672 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
2673 longlong val_int() override;
2674 const char *func_name() const override { return "internal_table_rows"; }
2675 bool resolve_type(THD *) override {
2676 set_nullable(true);
2677 unsigned_flag = true;
2678 null_on_null = false;
2679 return false;
2680 }
2681};
2682
2684 public:
2686 : Item_int_func(pos, list) {}
2687 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
2688 longlong val_int() override;
2689 const char *func_name() const override { return "internal_avg_row_length"; }
2690 bool resolve_type(THD *) override {
2691 set_nullable(true);
2692 unsigned_flag = true;
2693 null_on_null = false;
2694 return false;
2695 }
2696};
2697
2699 public:
2701 : Item_int_func(pos, list) {}
2702 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
2703 longlong val_int() override;
2704 const char *func_name() const override { return "internal_data_length"; }
2705 bool resolve_type(THD *) override {
2706 set_nullable(true);
2707 unsigned_flag = true;
2708 null_on_null = false;
2709 return false;
2710 }
2711};
2712
2714 public:
2716 : Item_int_func(pos, list) {}
2717 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
2718 longlong val_int() override;
2719 const char *func_name() const override { return "internal_max_data_length"; }
2720 bool resolve_type(THD *) override {
2721 set_nullable(true);
2722 unsigned_flag = true;
2723 null_on_null = false;
2724 return false;
2725 }
2726};
2727
2729 public:
2731 : Item_int_func(pos, list) {}
2732 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
2733 longlong val_int() override;
2734 const char *func_name() const override { return "internal_index_length"; }
2735 bool resolve_type(THD *) override {
2736 set_nullable(true);
2737 unsigned_flag = true;
2738 null_on_null = false;
2739 return false;
2740 }
2741};
2742
2744 public:
2746 : Item_int_func(pos, list) {}
2747 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
2748 longlong val_int() override;
2749 const char *func_name() const override { return "internal_data_free"; }
2750 bool resolve_type(THD *) override {
2751 set_nullable(true);
2752 unsigned_flag = true;
2753 null_on_null = false;
2754 return false;
2755 }
2756};
2757
2759 public:
2761 : Item_int_func(pos, list) {}
2762 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
2763 longlong val_int() override;
2764 const char *func_name() const override { return "internal_auto_increment"; }
2765 bool resolve_type(THD *) override {
2766 set_nullable(true);
2767 unsigned_flag = true;
2768 null_on_null = false;
2769 return false;
2770 }
2771};
2772
2774 public:
2776 : Item_int_func(pos, list) {}
2777 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
2778 longlong val_int() override;
2779 const char *func_name() const override { return "internal_checksum"; }
2780 bool resolve_type(THD *) override {
2781 set_nullable(true);
2782 null_on_null = false;
2783 return false;
2784 }
2785};
2786
2788 public:
2790 : Item_int_func(pos, a) {}
2791 longlong val_int() override;
2792 const char *func_name() const override { return "internal_keys_disabled"; }
2793 bool resolve_type(THD *) override {
2794 set_nullable(false);
2795 null_on_null = false;
2796 return false;
2797 }
2798};
2799
2801 public:
2804 : Item_int_func(pos, list) {}
2805 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
2806 longlong val_int() override;
2807 const char *func_name() const override {
2808 return "internal_index_column_cardinality";
2809 }
2810 bool resolve_type(THD *) override {
2811 set_nullable(true);
2812 null_on_null = false;
2813 return false;
2814 }
2815};
2816
2818 public:
2820 Item *d)
2821 : Item_int_func(pos, a, b, c, d) {}
2822 longlong val_int() override;
2823 const char *func_name() const override { return "internal_dd_char_length"; }
2824 bool resolve_type(THD *) override {
2825 set_nullable(true);
2826 null_on_null = false;
2827 return false;
2828 }
2829};
2830
2832 : public Item_int_func {
2833 public:
2836 : Item_int_func(pos, list) {}
2837 longlong val_int() override;
2838 const char *func_name() const override {
2839 return "internal_get_view_warning_or_error";
2840 }
2841 bool resolve_type(THD *) override {
2842 max_length = 1;
2843 set_nullable(false);
2844 null_on_null = false;
2845 return false;
2846 }
2847};
2848
2850 public:
2852 : Item_int_func(pos, list) {}
2853 longlong val_int() override;
2854 bool resolve_type(THD *) override {
2855 set_nullable(true);
2856 null_on_null = false;
2857 return false;
2858 }
2859 const char *func_name() const override {
2860 return "get_dd_index_sub_part_length";
2861 }
2862};
2863
2865 public:
2867 Item *d)
2868 : Item_int_func(pos, a, b, c, d) {}
2869 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
2870 longlong val_int() override;
2871 const char *func_name() const override { return "internal_tablespace_id"; }
2872 bool resolve_type(THD *) override {
2873 set_nullable(true);
2874 null_on_null = false;
2875 return false;
2876 }
2877};
2878
2880 : public Item_int_func {
2881 public:
2883 Item *b, Item *c, Item *d)
2884 : Item_int_func(pos, a, b, c, d) {}
2885
2886 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
2887 longlong val_int() override;
2888
2889 const char *func_name() const override {
2890 return "internal_tablespace_logfile_group_number";
2891 }
2892
2893 bool resolve_type(THD *) override {
2894 set_nullable(true);
2895 null_on_null = false;
2896 return false;
2897 }
2898};
2899
2901 public:
2903 Item *c, Item *d)
2904 : Item_int_func(pos, a, b, c, d) {}
2905
2906 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
2907 longlong val_int() override;
2908
2909 const char *func_name() const override {
2910 return "internal_tablespace_free_extents";
2911 }
2912
2913 bool resolve_type(THD *) override {
2914 set_nullable(true);
2915 null_on_null = false;
2916 return false;
2917 }
2918};
2919
2921 public:
2923 Item *c, Item *d)
2924 : Item_int_func(pos, a, b, c, d) {}
2925
2926 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
2927 longlong val_int() override;
2928
2929 const char *func_name() const override {
2930 return "internal_tablespace_total_extents";
2931 }
2932
2933 bool resolve_type(THD *) override {
2934 set_nullable(true);
2935 null_on_null = false;
2936 return false;
2937 }
2938};
2939
2941 public:
2943 Item *c, Item *d)
2944 : Item_int_func(pos, a, b, c, d) {}
2945
2946 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
2947 longlong val_int() override;
2948
2949 const char *func_name() const override {
2950 return "internal_tablespace_extent_size";
2951 }
2952
2953 bool resolve_type(THD *) override {
2954 set_nullable(true);
2955 null_on_null = false;
2956 return false;
2957 }
2958};
2959
2961 public:
2963 Item *c, Item *d)
2964 : Item_int_func(pos, a, b, c, d) {}
2965
2966 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
2967 longlong val_int() override;
2968
2969 const char *func_name() const override {
2970 return "internal_tablespace_initial_size";
2971 }
2972
2973 bool resolve_type(THD *) override {
2974 set_nullable(true);
2975 null_on_null = false;
2976 return false;
2977 }
2978};
2979
2981 public:
2983 Item *c, Item *d)
2984 : Item_int_func(pos, a, b, c, d) {}
2985
2986 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
2987 longlong val_int() override;
2988
2989 const char *func_name() const override {
2990 return "internal_tablespace_maximum_size";
2991 }
2992
2993 bool resolve_type(THD *) override {
2994 set_nullable(true);
2995 null_on_null = false;
2996 return false;
2997 }
2998};
2999
3001 public:
3003 Item *b, Item *c, Item *d)
3004 : Item_int_func(pos, a, b, c, d) {}
3005
3006 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
3007 longlong val_int() override;
3008
3009 const char *func_name() const override {
3010 return "internal_tablespace_autoextend_size";
3011 }
3012
3013 bool resolve_type(THD *) override {
3014 set_nullable(true);
3015 null_on_null = false;
3016 return false;
3017 }
3018};
3019
3021 public:
3023 Item *c, Item *d)
3024 : Item_int_func(pos, a, b, c, d) {}
3025
3026 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
3027 longlong val_int() override;
3028
3029 const char *func_name() const override {
3030 return "internal_tablespace_version";
3031 }
3032
3033 bool resolve_type(THD *) override {
3034 set_nullable(true);
3035 null_on_null = false;
3036 return false;
3037 }
3038};
3039
3041 public:
3043 Item *c, Item *d)
3044 : Item_int_func(pos, a, b, c, d) {}
3045
3046 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
3047 longlong val_int() override;
3048
3049 const char *func_name() const override {
3050 return "internal_tablespace_data_free";
3051 }
3052
3053 bool resolve_type(THD *) override {
3054 set_nullable(true);
3055 null_on_null = false;
3056 return false;
3057 }
3058};
3059
3060/**
3061 Common class for:
3062 Item_func_get_system_var
3063 Item_func_get_user_var
3064 Item_func_set_user_var
3065*/
3066class Item_var_func : public Item_func {
3067 public:
3069 explicit Item_var_func(const POS &pos) : Item_func(pos) {}
3070
3071 Item_var_func(THD *thd, Item_var_func *item) : Item_func(thd, item) {}
3072
3074 Item_var_func(const POS &pos, Item *a) : Item_func(pos, a) {}
3075
3076 bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override {
3077 return get_date_from_non_temporal(ltime, fuzzydate);
3078 }
3079 bool get_time(MYSQL_TIME *ltime) override {
3080 return get_time_from_non_temporal(ltime);
3081 }
3082 bool check_function_as_value_generator(uchar *checker_args) override {
3084 pointer_cast<Check_function_as_value_generator_parameters *>(
3085 checker_args);
3086 func_arg->err_code = (func_arg->source == VGS_CHECK_CONSTRAINT)
3087 ? ER_CHECK_CONSTRAINT_VARIABLES
3088 : ER_DEFAULT_VAL_GENERATED_VARIABLES;
3089 return true;
3090 }
3091};
3092
3093/* Handling of user definable variables */
3094
3095// this is needed for user_vars hash
3098 m_ptr = nullptr;
3099 m_length = 0;
3100 }
3101 void set_value(char *value, size_t length) {
3102 m_ptr = value;
3103 m_length = length;
3104 }
3105
3106 /**
3107 Position inside a user_var_entry where small values are stored:
3108 double values, longlong values and string values with length
3109 up to extra_size (should be 8 bytes on all platforms).
3110 String values with length longer than 8 are stored in a separate
3111 memory buffer, which is allocated when needed using the method realloc().
3112 */
3114 return pointer_cast<char *>(this) + ALIGN_SIZE(sizeof(user_var_entry));
3115 }
3116
3117 /**
3118 Position inside a user_var_entry where a null-terminates array
3119 of characters representing the variable name is stored.
3120 */
3122
3123 /**
3124 Initialize m_ptr to the internal buffer (if the value is small enough),
3125 or allocate a separate buffer.
3126 @param length - length of the value to be stored.
3127 */
3128 bool mem_realloc(size_t length);
3129
3130 /**
3131 Check if m_ptr points to an external buffer previously allocated by
3132 realloc().
3133 @retval true - an external buffer is allocated.
3134 @retval false - m_ptr is null, or points to the internal buffer.
3135 */
3136 bool alloced() { return m_ptr && m_ptr != internal_buffer_ptr(); }
3137
3138 /**
3139 Free the external value buffer, if it's allocated.
3140 */
3141 void free_value() {
3142 if (alloced()) my_free(m_ptr);
3143 }
3144
3145 /**
3146 Copy the array of characters from the given name into the internal
3147 name buffer and initialize entry_name to point to it.
3148 */
3150 name.strcpy(name_ptr());
3151 entry_name = Name_string(name_ptr(), name.length());
3152 }
3153
3154 /**
3155 Initialize all members
3156
3157 @param thd Current session.
3158 @param name Name of the user_var_entry instance.
3159 @param cs charset information of the user_var_entry instance.
3160 */
3161 void init(THD *thd, const Simple_cstring &name, const CHARSET_INFO *cs);
3162
3163 /**
3164 Store a value of the given type into a user_var_entry instance.
3165 @param from Value
3166 @param length Size of the value
3167 @param type type
3168 @retval false on success
3169 @retval true on memory allocation error
3170 */
3171 bool store(const void *from, size_t length, Item_result type);
3172
3173 /**
3174 Assert the user variable is locked.
3175 This is debug code only.
3176 The thread LOCK_thd_data mutex protects:
3177 - the thd->user_vars hash itself
3178 - the values in the user variable itself.
3179 The protection is required for monitoring,
3180 as a different thread can inspect this session
3181 user variables, on a live session.
3182 */
3183 void assert_locked() const;
3184
3185 static const size_t extra_size = sizeof(double);
3186 char *m_ptr; ///< Value
3187 size_t m_length; ///< Value length
3188 Item_result m_type; ///< Value type
3190 /**
3191 Set to the id of the most recent query that has used the variable.
3192 Used in binlogging: When set, there is no need to add a reference to this
3193 variable to the binlog. Imagine it is this:
3194
3195 INSERT INTO t SELECT @a:=10, @a:=@a+1.
3196
3197 Then we have a Item_func_get_user_var (because of the `@a+1`) so we
3198 think we have to write the value of `@a` to the binlog. But before that,
3199 we have a Item_func_set_user_var to create `@a` (`@a:=10`), in this we mark
3200 the variable as "already logged" so that it won't be logged
3201 by Item_func_get_user_var (because that's not necessary).
3202 */
3204
3205 public:
3206 user_var_entry() = default; /* Remove gcc warning */
3207
3208 THD *owner_session() const { return m_owner; }
3209
3210 Simple_cstring entry_name; // Variable name
3211 DTCollation collation; // Collation with attributes
3212 bool unsigned_flag; // true if unsigned, false if signed
3213
3214 /**
3215 Set value to user variable.
3216
3217 @param ptr pointer to buffer with new value
3218 @param length length of new value
3219 @param type type of new value
3220 @param cs charset info for new value
3221 @param dv derivation for new value
3222 @param unsigned_arg indicates if a value of type INT_RESULT is unsigned
3223
3224 @note Sets error and fatal error if allocation fails.
3225
3226 @retval
3227 false success
3228 @retval
3229 true failure
3230 */
3231 bool store(const void *ptr, size_t length, Item_result type,
3232 const CHARSET_INFO *cs, Derivation dv, bool unsigned_arg);
3233 /**
3234 Set type of to the given value.
3235 @param type Data type.
3236 */
3238 assert_locked();
3239 m_type = type;
3240 }
3241 /**
3242 Set value to NULL
3243 @param type Data type.
3244 */
3245
3247 assert_locked();
3248 free_value();
3249 reset_value();
3250 m_type = type;
3251 }
3252
3253 void set_used_query_id(query_id_t query_id) { m_used_query_id = query_id; }
3255
3256 /**
3257 Allocates and initializes a user variable instance.
3258
3259 @param thd Current session.
3260 @param name Name of the variable.
3261 @param cs Charset of the variable.
3262
3263 @return Address of the allocated and initialized user_var_entry instance.
3264 @retval NULL On allocation error.
3265 */
3266 static user_var_entry *create(THD *thd, const Name_string &name,
3267 const CHARSET_INFO *cs);
3268
3269 /**
3270 Free all memory used by a user_var_entry instance
3271 previously created by create().
3272 */
3273 void destroy() {
3274 assert_locked();
3275 free_value(); // Free the external value buffer
3276 my_free(this); // Free the instance itself
3277 }
3278
3279 void lock();
3280 void unlock();
3281
3282 /* Routines to access the value and its type */
3283 const char *ptr() const { return m_ptr; }
3284 size_t length() const { return m_length; }
3285 /// The data type of this variable.
3286 Item_result type() const { return m_type; }
3287 /* Item-alike routines to access the value */
3288 double val_real(bool *null_value) const;
3289 longlong val_int(bool *null_value) const;
3290 String *val_str(bool *null_value, String *str, uint decimals) const;
3291 my_decimal *val_decimal(bool *null_value, my_decimal *result) const;
3292};
3293
3294/**
3295 This class is used to implement operations like
3296 SET \@variable or \@variable:= expression.
3297*/
3298
3305 union {
3307 double vreal;
3311
3312 public:
3313 Name_string name; // keep it public
3314
3317 : Item_var_func(pos, b), name(a) {}
3318
3320 : Item_var_func(thd, item),
3322 entry(item->entry),
3323 value(item->value),
3325 null_item(item->null_item),
3326 save_result(item->save_result),
3327 name(item->name) {}
3328 enum Functype functype() const override { return SUSERVAR_FUNC; }
3329 double val_real() override;
3330 longlong val_int() override;
3331 String *val_str(String *str) override;
3332 my_decimal *val_decimal(my_decimal *) override;
3333 bool update_hash(const void *ptr, uint length, enum Item_result type,
3334 const CHARSET_INFO *cs, Derivation dv, bool unsigned_arg);
3335 bool send(Protocol *protocol, String *str_arg) override;
3336 void make_field(Send_field *tmp_field) override;
3337 bool check(bool use_result_field);
3338 void save_item_result(Item *item);
3339 bool update();
3340 enum Item_result result_type() const override { return cached_result_type; }
3341 bool fix_fields(THD *thd, Item **ref) override;
3342 bool resolve_type(THD *) override;
3343 void print(const THD *thd, String *str,
3344 enum_query_type query_type) const override;
3345 void print_assignment(const THD *thd, String *str,
3346 enum_query_type query_type) const;
3347 const char *func_name() const override { return "set_user_var"; }
3348
3349 type_conversion_status save_in_field(Field *field, bool no_conversions,
3350 bool can_use_result_field);
3351
3352 void save_org_in_field(Field *field) override {
3353 save_in_field(field, true, false);
3354 }
3355
3356 bool set_entry(THD *thd, bool create_if_not_exists);
3357 void cleanup() override;
3358
3359 protected:
3361 bool no_conversions) override {
3362 return save_in_field(field, no_conversions, true);
3363 }
3364};
3365
3370
3371 public:
3372 Name_string name; // keep it public
3373
3378
3379 enum Functype functype() const override { return GUSERVAR_FUNC; }
3380 double val_real() override;
3381 longlong val_int() override;
3382 my_decimal *val_decimal(my_decimal *) override;
3383 String *val_str(String *str) override;
3384 const CHARSET_INFO *charset_for_protocol() override;
3385 bool resolve_type(THD *) override;
3386 bool propagate_type(THD *thd, const Type_properties &type) override;
3387 void cleanup() override;
3388 void update_used_tables() override {} // Keep existing used tables
3389 void print(const THD *thd, String *str,
3390 enum_query_type query_type) const override;
3391 enum Item_result result_type() const override;
3392 /*
3393 We must always return variables as strings to guard against selects of type
3394 select @t1:=1,@t1,@t:="hello",@t from foo where (@t1:= t2.b)
3395 */
3396 const char *func_name() const override { return "get_user_var"; }
3397 bool is_non_const_over_literals(uchar *) override { return true; }
3398 bool eq_specific(const Item *item) const override;
3399
3400 private:
3401 bool set_value(THD *thd, sp_rcontext *ctx, Item **it) override;
3402
3403 public:
3405 return this;
3406 }
3407};
3408
3409/*
3410 This item represents user variable used as out parameter (e.g in LOAD DATA),
3411 and it is supposed to be used only for this purprose. So it is simplified
3412 a lot. Actually you should never obtain its value.
3413
3414 The only two reasons for this thing being an Item is possibility to store it
3415 in const mem_root_deque<Item> and desire to place this code somewhere near
3416 other functions working with user variables.
3417*/
3421
3422 public:
3424 : Item(pos), name(a) {
3425 item_name.copy(a);
3426 }
3427 /* We should return something different from FIELD_ITEM here */
3428 enum Type type() const override { return STRING_ITEM; }
3429 double val_real() override;
3430 longlong val_int() override;
3431 String *val_str(String *str) override;
3432 my_decimal *val_decimal(my_decimal *decimal_buffer) override;
3434 assert(0);
3435 return true;
3436 }
3437 bool get_time(MYSQL_TIME *) override {
3438 assert(0);
3439 return true;
3440 }
3441
3442 /* fix_fields() binds variable name with its entry structure */
3443 bool fix_fields(THD *thd, Item **ref) override;
3444 void print(const THD *thd, String *str,
3445 enum_query_type query_type) const override;
3446 void set_null_value(const CHARSET_INFO *cs);
3447 void set_value(const char *str, size_t length, const CHARSET_INFO *cs);
3448};
3449
3450/* A system variable */
3451
3452#define GET_SYS_VAR_CACHE_LONG 1
3453#define GET_SYS_VAR_CACHE_DOUBLE 2
3454#define GET_SYS_VAR_CACHE_STRING 4
3455
3457
3458/** Class to log audit event EVENT_TRACKING_GLOBAL_VARIABLE_GET. */
3460 public:
3464
3465 private:
3466 // Thread handle.
3468
3469 // Item_func_get_system_var instance.
3471
3472 /*
3473 Value conversion type.
3474 Depending on the value conversion type GET_SYS_VAR_CACHE_* is stored in this
3475 member while creating the object. While converting value if there are any
3476 intermediate conversions in the same query then this member is used to avoid
3477 auditing more than once.
3478 */
3480
3481 /*
3482 To indicate event auditing is required or not. Event is not audited if
3483 * scope of the variable is *not* GLOBAL.
3484 * or the event is already audited for global variable for the same query.
3485 */
3487};
3488
3498
3499 template <typename T>
3501
3503
3504 public:
3506 enum_var_type scope);
3507 enum Functype functype() const override { return GSYSVAR_FUNC; }
3509 return INNER_TABLE_BIT;
3510 }
3511 bool resolve_type(THD *) override;
3512 void print(const THD *thd, String *str,
3513 enum_query_type query_type) const override;
3514 bool is_non_const_over_literals(uchar *) override { return true; }
3515 enum Item_result result_type() const override {
3516 assert(fixed);
3517 return type_to_result(data_type());
3518 }
3519 double val_real() override;
3520 longlong val_int() override;
3521 String *val_str(String *) override;
3522 my_decimal *val_decimal(my_decimal *dec_buf) override {
3523 return val_decimal_from_real(dec_buf);
3524 }
3525 /* TODO: fix to support views */
3526 const char *func_name() const override { return "get_system_var"; }
3527 bool eq_specific(const Item *item) const override;
3528 bool is_valid_for_pushdown(uchar *arg [[maybe_unused]]) override {
3529 // Expressions which have system variables cannot be pushed as of
3530 // now because Item_func_get_system_var::print does not print the
3531 // original expression which leads to an incorrect clone.
3532 return true;
3533 }
3534
3535 void cleanup() override;
3536};
3537
3538class JOIN;
3539
3540class Item_func_match final : public Item_real_func {
3542
3543 protected:
3544 void add_json_info(Json_object *obj) override;
3545
3546 public:
3548 uint key, flags;
3549 /// True if we are doing a full-text index scan with this MATCH function as a
3550 /// predicate, and the score can be retrieved with get_relevance(). If it is
3551 /// false, the score of the document must be retrieved with find_relevance().
3556 /**
3557 Master item means that if identical items are present in the
3558 statement, they use the same FT handler. FT handler is initialized
3559 only for master item and slave items just use it. FT hints initialized
3560 for master only, slave items HINTS are not accessed.
3561 */
3563 Item *concat_ws; // Item_func_concat_ws
3564 String value; // value of concat_ws
3565 String search_value; // key_item()'s value converted to cmp_collation
3566
3567 /**
3568 Constructor for Item_func_match class.
3569
3570 @param pos Position of token in the parser.
3571 @param a List of arguments.
3572 @param against_arg Expression to match against.
3573 @param b FT Flags.
3574 */
3575 Item_func_match(const POS &pos, PT_item_list *a, Item *against_arg, uint b)
3576 : Item_real_func(pos, a),
3577 against(against_arg),
3578 key(0),
3579 flags(b),
3582 master(nullptr),
3584 hints(nullptr),
3585 simple_expression(false),
3586 used_in_where_only(false) {
3587 null_on_null = false;
3588 }
3589
3590 bool do_itemize(Parse_context *pc, Item **res) override;
3591
3592 void cleanup() override {
3593 DBUG_TRACE;
3595 if (master == nullptr && ft_handler != nullptr) {
3597 }
3598 score_from_index_scan = false;
3599 ft_handler = nullptr;
3600 concat_ws = nullptr;
3601 return;
3602 }
3603 Item *key_item() const override { return against; }
3604 enum Functype functype() const override { return FT_FUNC; }
3605 const char *func_name() const override { return "match"; }
3606 bool fix_fields(THD *thd, Item **ref) override;
3607 void update_used_tables() override;
3608 bool eq_specific(const Item *item) const override;
3609 /* The following should be safe, even if we compare doubles */
3610 longlong val_int() override {
3611 assert(fixed);
3612 return val_real() != 0.0;
3613 }
3614 double val_real() override;
3615 void print(const THD *thd, String *str,
3616 enum_query_type query_type) const override;
3617
3618 bool fix_index(const THD *thd);
3619 bool init_search(THD *thd);
3620 bool check_function_as_value_generator(uchar *checker_args) override {
3622 pointer_cast<Check_function_as_value_generator_parameters *>(
3623 checker_args);
3624 func_arg->banned_function_name = func_name();
3625 return true;
3626 }
3627
3628 /**
3629 Get number of matching rows from FT handler.
3630
3631 @note Requires that FT handler supports the extended API
3632
3633 @return Number of matching rows in result
3634 */
3636 assert(ft_handler);
3638
3639 return ((FT_INFO_EXT *)ft_handler)
3640 ->could_you->count_matches((FT_INFO_EXT *)ft_handler);
3641 }
3642
3643 /**
3644 Check whether FT result is ordered on rank
3645
3646 @return true if result is ordered
3647 @return false otherwise
3648 */
3650 assert(!master);
3651 if (hints->get_flags() & FT_SORTED) return true;
3652
3654 return false;
3655
3656 assert(ft_handler);
3657 return ((FT_INFO_EXT *)ft_handler)->could_you->get_flags() &
3659 }
3660
3661 /**
3662 Check whether FT result contains the document ID
3663
3664 @return true if document ID is available
3665 @return false otherwise
3666 */
3668 assert(ft_handler);
3669
3671 return false;
3672
3673 return ((FT_INFO_EXT *)ft_handler)->could_you->get_flags() &
3675 }
3676
3677 float get_filtering_effect(THD *thd, table_map filter_for_table,
3678 table_map read_tables,
3679 const MY_BITMAP *fields_to_ignore,
3680 double rows_in_table) override;
3681
3682 /**
3683 Returns master MATCH function.
3684
3685 @return pointer to master MATCH function.
3686 */
3688 if (master) return master->get_master();
3689 return this;
3690 }
3691
3692 /**
3693 Set master MATCH function and adjust used_in_where_only value.
3694
3695 @param item item for which master should be set.
3696 */
3699 item->master = this;
3700 }
3701
3702 /**
3703 Returns pointer to Ft_hints object belonging to master MATCH function.
3704
3705 @return pointer to Ft_hints object
3706 */
3708 assert(!master);
3709 return hints;
3710 }
3711
3712 /**
3713 Set comparison operation type and and value for master MATCH function.
3714
3715 @param type comparison operation type
3716 @param value_arg comparison operation value
3717 */
3718 void set_hints_op(enum ft_operation type, double value_arg) {
3719 assert(!master);
3720 hints->set_hint_op(type, value_arg);
3721 }
3722
3723 /**
3724 Set FT hints.
3725 */
3726 void set_hints(JOIN *join, uint ft_flag, ha_rows ft_limit, bool no_cond);
3727
3728 /**
3729 Check if ranking is not needed.
3730
3731 @return true if ranking is not needed
3732 @return false otherwise
3733 */
3735 assert(!master);
3736 return (!(hints->get_flags() & FT_SORTED) && // FT_SORTED is no set
3737 used_in_where_only && // MATCH result is not used
3738 // in expression
3739 hints->get_op_type() == FT_OP_NO); // MATCH is single function
3740 }
3741
3742 /**
3743 Set flag that the function is a simple expression.
3744
3745 @param val true if the function is a simple expression, false otherwise
3746 */
3747 void set_simple_expression(bool val) {
3748 assert(!master);
3749 simple_expression = val;
3750 }
3751
3752 /**
3753 Check if this MATCH function is a simple expression in WHERE condition.
3754
3755 @return true if simple expression
3756 @return false otherwise
3757 */
3759 assert(!master);
3760 return simple_expression;
3761 }
3762
3763 private:
3764 /**
3765 Fulltext index hints, initialized for master MATCH function only.
3766 */
3768 /**
3769 Flag is true when MATCH function is used as a simple expression in
3770 WHERE condition, i.e. there is no AND/OR combinations, just simple
3771 MATCH function or [MATCH, rank] comparison operation.
3772 */
3774 /**
3775 true if MATCH function is used in WHERE condition only.
3776 Used to determine what hints can be used for FT handler.
3777 Note that only master MATCH function has valid value.
3778 it's ok since only master function is involved in the hint processing.
3779 */
3781 /**
3782 Check whether storage engine for given table,
3783 allows FTS Boolean search on non-indexed columns.
3784
3785 @todo A flag should be added to the extended fulltext API so that
3786 it may be checked whether search on non-indexed columns are
3787 supported. Currently, it is not possible to check for such a
3788 flag since @c this->ft_handler is not yet set when this function is
3789 called. The current hack is to assume that search on non-indexed
3790 columns are supported for engines that does not support the extended
3791 fulltext API (e.g., MyISAM), while it is not supported for other
3792 engines (e.g., InnoDB)
3793
3794 @param tr Table for which storage engine to check
3795
3796 @retval true if BOOLEAN search on non-indexed columns is supported
3797 @retval false otherwise
3798 */
3800 // Only Boolean search may support non_indexed columns
3801 if (!(flags & FT_BOOL)) return false;
3802
3803 assert(tr && tr->file);
3804
3805 // Assume that if extended fulltext API is not supported,
3806 // non-indexed columns are allowed. This will be true for MyISAM.
3807 if ((tr->file->ha_table_flags() & HA_CAN_FULLTEXT_EXT) == 0) return true;
3808
3809 return false;
3810 }
3811};
3812
3813/**
3814 A visitor that calls the specified function on every non-aggregated full-text
3815 search function (Item_func_match) it encounters when it is used in a
3816 PREFIX+POSTFIX walk with WalkItem(). It skips every item that is wrapped in an
3817 aggregate function, and also every item wrapped in a reference, as the items
3818 behind the reference are already handled elsewhere (in another query block or
3819 in another element of the SELECT list).
3820 */
3822 public:
3824 std::function<bool(Item_func_match *)> func);
3825 bool operator()(Item *item);
3826
3827 private:
3828 std::function<bool(Item_func_match *)> m_func;
3829};
3830
3833
3835
3836 public:
3837 Item_func_is_free_lock(const POS &pos, Item *a) : Item_int_func(pos, a) {}
3838
3839 bool do_itemize(Parse_context *pc, Item **res) override;
3840 longlong val_int() override;
3841 const char *func_name() const override { return "is_free_lock"; }
3843 return INNER_TABLE_BIT;
3844 }
3845 bool resolve_type(THD *thd) override {
3846 if (param_type_is_default(thd, 0, 1)) return true;
3847 max_length = 1;
3848 set_nullable(true);
3849 return false;
3850 }
3851 bool is_non_const_over_literals(uchar *) override { return true; }
3852 bool check_function_as_value_generator(uchar *checker_args) override {
3854 pointer_cast<Check_function_as_value_generator_parameters *>(
3855 checker_args);
3856 func_arg->banned_function_name = func_name();
3857 return true;
3858 }
3859};
3860
3863
3865
3866 public:
3867 Item_func_is_used_lock(const POS &pos, Item *a) : Item_int_func(pos, a) {}
3868
3869 bool do_itemize(Parse_context *pc, Item **res) override;
3870 longlong val_int() override;
3871 const char *func_name() const override { return "is_used_lock"; }
3873 return INNER_TABLE_BIT;
3874 }
3875 bool resolve_type(THD *thd) override {
3876 if (param_type_is_default(thd, 0, 1)) return true;
3877 unsigned_flag = true;
3878 set_nullable(true);
3879 return false;
3880 }
3881 bool is_non_const_over_literals(uchar *) override { return true; }
3882 bool check_function_as_value_generator(uchar *checker_args) override {
3884 pointer_cast<Check_function_as_value_generator_parameters *>(
3885 checker_args);
3886 func_arg->banned_function_name = func_name();
3887 return true;
3888 }
3889};
3890
3893
3894 public:
3895 explicit Item_func_row_count(const POS &pos) : Item_int_func(pos) {}
3896
3897 bool do_itemize(Parse_context *pc, Item **res) override;
3898
3899 longlong val_int() override;
3900 const char *func_name() const override { return "row_count"; }
3901 bool resolve_type(THD *) override {
3902 set_nullable(false);
3903 return false;
3904 }
3905 bool check_function_as_value_generator(uchar *checker_args) override {
3907 pointer_cast<Check_function_as_value_generator_parameters *>(
3908 checker_args);
3909 func_arg->banned_function_name = func_name();
3910 return true;
3911 }
3912};
3913
3914/*
3915 *
3916 * Stored FUNCTIONs
3917 *
3918 */
3919
3920class sp_head;
3921class sp_name;
3922
3923class Item_func_sp final : public Item_func {
3925
3926 private:
3927 /// Holds the security definer context(if defined with SQL SECURITY DEFINER)
3928 /// and the error the handler.
3930 /// The name of the stored function
3931 sp_name *m_name{nullptr};
3932 /// Pointer to actual function instance (null when not resolved or executing)
3933 sp_head *m_sp{nullptr};
3934 /// The result field of the concrete stored function.
3936 /// true when function execution is deterministic
3937 bool m_deterministic{false};
3938
3939 bool execute();
3940 bool execute_impl(THD *thd);
3941 bool init_result_field(THD *thd);
3942
3943 protected:
3944 public:
3945 Item_func_sp(const POS &pos, const LEX_STRING &db_name,
3946 const LEX_STRING &fn_name, bool use_explicit_name,
3947 PT_item_list *opt_list);
3948
3949 bool do_itemize(Parse_context *pc, Item **res) override;
3950 /**
3951 Must not be called before the procedure is resolved,
3952 i.e. @c init_result_field().
3953 */
3954 table_map get_initial_pseudo_tables() const override;
3955 void update_used_tables() override;
3956 void fix_after_pullout(Query_block *parent_query_block,
3957 Query_block *removed_query_block) override;
3958 void cleanup() override;
3959
3960 const char *func_name() const override;
3961
3962 Field *tmp_table_field(TABLE *t_arg) override;
3963
3964 void make_field(Send_field *tmp_field) override;
3965
3966 Item_result result_type() const override;
3967
3968 longlong val_int() override;
3969 double val_real() override;
3970 bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override;
3971 bool get_time(MYSQL_TIME *ltime) override;
3972 my_decimal *val_decimal(my_decimal *dec_buf) override;
3973 String *val_str(String *str) override;
3974 bool val_json(Json_wrapper *result) override;
3975
3976 bool change_context_processor(uchar *arg) override {
3978 pointer_cast<Item_ident::Change_context *>(arg)->m_context;
3979 return false;
3980 }
3981
3982 bool sp_check_access(THD *thd);
3983 enum Functype functype() const override { return FUNC_SP; }
3984
3985 bool fix_fields(THD *thd, Item **ref) override;
3986 bool resolve_type(THD *thd) override;
3987
3989 bool check_function_as_value_generator(uchar *checker_args) override {
3991 pointer_cast<Check_function_as_value_generator_parameters *>(
3992 checker_args);
3993 func_arg->banned_function_name = func_name();
3994 return true;
3995 }
3996
3997 void compute_cost(CostOfItem *root_cost) const override {
3998 root_cost->MarkExpensive();
3999 }
4000};
4001
4004
4005 public:
4006 explicit Item_func_found_rows(const POS &pos) : Item_int_func(pos) {}
4007
4008 bool do_itemize(Parse_context *pc, Item **res) override;
4009 longlong val_int() override;
4010 const char *func_name() const override { return "found_rows"; }
4011 bool resolve_type(THD *) override {
4012 set_nullable(false);
4013 return false;
4014 }
4015 bool check_function_as_value_generator(uchar *checker_args) override {
4017 pointer_cast<Check_function_as_value_generator_parameters *>(
4018 checker_args);
4019 func_arg->banned_function_name = func_name();
4020 return true;
4021 }
4022};
4023
4024void uuid_short_init();
4025
4028
4029 public:
4031
4032 bool do_itemize(Parse_context *pc, Item **res) override;
4033 const char *func_name() const override { return "uuid_short"; }
4034 longlong val_int() override;
4035 bool resolve_type(THD *) override {
4036 unsigned_flag = true;
4037 return false;
4038 }
4039 bool check_partition_func_processor(uchar *) override { return false; }
4040 bool check_function_as_value_generator(uchar *checker_args) override {
4042 pointer_cast<Check_function_as_value_generator_parameters *>(
4043 checker_args);
4044 func_arg->banned_function_name = func_name();
4045 return ((func_arg->source == VGS_GENERATED_COLUMN) ||
4046 (func_arg->source == VGS_CHECK_CONSTRAINT));
4047 }
4048 // This function is random, see uuid_short_init().
4050 return RAND_TABLE_BIT;
4051 }
4052};
4053
4056
4057 public:
4058 explicit Item_func_version(const POS &pos);
4059
4060 bool do_itemize(Parse_context *pc, Item **res) override;
4061};
4062
4063/**
4064 Internal function used by INFORMATION_SCHEMA implementation to check
4065 if a role is a mandatory role.
4066*/
4067
4069 public:
4071 : Item_int_func(pos, a, b) {}
4072 longlong val_int() override;
4073 const char *func_name() const override {
4074 return "internal_is_mandatory_role";
4075 }
4076 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
4077 bool resolve_type(THD *) override {
4078 set_nullable(true);
4079 return false;
4080 }
4081};
4082
4084 public:
4086 : Item_int_func(pos) {}
4087 longlong val_int() override;
4088 const char *func_name() const override {
4089 return "internal_use_terminology_previous";
4090 }
4091 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
4092 bool resolve_type(THD *) override {
4093 set_nullable(true);
4094 return false;
4095 }
4096};
4097
4098/**
4099 Internal function used by INFORMATION_SCHEMA implementation to check
4100 if a role is enabled.
4101*/
4102
4104 public:
4106 : Item_int_func(pos, a, b) {}
4107 longlong val_int() override;
4108 const char *func_name() const override { return "internal_is_enabled_role"; }
4109 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
4110 bool resolve_type(THD *) override {
4111 set_nullable(true);
4112 return false;
4113 }
4114};
4115
4116/**
4117 Create new Item_func_get_system_var object
4118
4119 @param pc Parse context
4120
4121 @param scope Scope of the variable (GLOBAL, SESSION, PERSISTENT ...)
4122
4123 @param prefix Empty LEX_CSTRING{} or the left hand side of the composite
4124 variable name, e.g.:
4125 * component name of the component-registered variable
4126 * name of MyISAM Multiple Key Cache.
4127
4128 @param suffix Name of the variable (if prefix is empty) or the right
4129 hand side of the composite variable name, e.g.:
4130 * name of the component-registered variable
4131 * property name of MyISAM Multiple Key Cache variable.
4132
4133 @param unsafe_for_replication force writing this system variable to binlog
4134 (if not written yet)
4135
4136 @returns new item on success, otherwise nullptr
4137*/
4139 const LEX_CSTRING &prefix, const LEX_CSTRING &suffix,
4140 bool unsafe_for_replication);
4141
4143 const LEX_CSTRING &trivial_name,
4144 bool unsafe_for_replication) {
4145 return get_system_variable(pc, scope, {}, trivial_name,
4146 unsafe_for_replication);
4147}
4148
4149extern bool check_reserved_words(const char *name);
4150extern enum_field_types agg_field_type(Item **items, uint nitems);
4151double my_double_round(double value, longlong dec, bool dec_unsigned,
4152 bool truncate);
4153bool eval_const_cond(THD *thd, Item *cond, bool *value);
4155 Field **found = nullptr);
4156
4157void retrieve_tablespace_statistics(THD *thd, Item **args, bool *null_value);
4158
4160
4161extern bool volatile mqh_used;
4162
4163/// Checks if "item" is a function of the specified type.
4165
4166/// Checks if "item" contains a function of the specified type.
4168
4169#endif /* ITEM_FUNC_INCLUDED */
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:247
int64 query_id_t
Definition: binlog.h:72
Class to log audit event EVENT_TRACKING_GLOBAL_VARIABLE_GET.
Definition: item_func.h:3459
Audit_global_variable_get_event(THD *thd, Item_func_get_system_var *item, uchar cache_type)
Definition: item_func.cc:7221
THD * m_thd
Definition: item_func.h:3467
~Audit_global_variable_get_event()
Definition: item_func.cc:7234
bool m_audit_event
Definition: item_func.h:3486
Item_func_get_system_var * m_item
Definition: item_func.h:3470
uchar m_val_type
Definition: item_func.h:3479
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:573
Wrapper for struct ft_hints.
Definition: handler.h:4172
uint get_flags() const
Get Ft_hints flags.
Definition: handler.h:4235
enum ft_operation get_op_type() const
Get Ft_hints operation type.
Definition: handler.h:4228
void set_hint_op(enum ft_operation type, double value)
Set comparison operation type and and value for master MATCH function.
Definition: handler.h:4190
Definition: item_func.h:1344
Item_dec_func(const POS &pos, Item *a)
Definition: item_func.h:1347
Item_dec_func(const POS &pos, Item *a, Item *b)
Definition: item_func.h:1349
Item_dec_func(Item *a)
Definition: item_func.h:1346
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.cc:2830
Definition: item.h:4389
Definition: item_func.h:1329
enum Functype functype() const override
Definition: item_func.h:1339
double real_op() override
Performs the operation that this functions implements when the result type is REAL.
Definition: item_func.cc:2799
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:1338
my_decimal * decimal_op(my_decimal *) override
Performs the operation that this functions implements when the result type is DECIMAL.
Definition: item_func.cc:2814
const char * func_name() const override
Definition: item_func.h:1335
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_func.h:1337
longlong int_op() override
Performs the operation that this functions implements when the result type is INT.
Definition: item_func.cc:2805
Item_func_abs(const POS &pos, Item *a)
Definition: item_func.h:1331
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.cc:2824
Definition: item_func.h:1409
const char * func_name() const override
Definition: item_func.h:1413
double val_real() override
Definition: item_func.cc:2928
enum Functype functype() const override
Definition: item_func.h:1414
Item_func_acos(const POS &pos, Item *a)
Definition: item_func.h:1411
Definition: item_func.h:1199
Item_func_additive_op(const POS &pos, Item *a, Item *b)
Definition: item_func.h:1202
Item_func_additive_op(Item *a, Item *b)
Definition: item_func.h:1201
void result_precision() override
Set precision of results for additive operations (+ and -)
Definition: item_func.cc:2211
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_func.h:1206
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:1207
Definition: item_func.h:1911
const char * func_name() const override
Definition: item_func.h:1917
longlong val_int() override
Definition: item_func.cc:4394
String value
Definition: item_func.h:1912
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:1918
Item_func_ascii(const POS &pos, Item *a)
Definition: item_func.h:1915
Definition: item_func.h:1417
double val_real() override
Definition: item_func.cc:2938
enum Functype functype() const override
Definition: item_func.h:1422
const char * func_name() const override
Definition: item_func.h:1421
Item_func_asin(const POS &pos, Item *a)
Definition: item_func.h:1419
Definition: item_func.h:1425
enum Functype functype() const override
Definition: item_func.h:1431
double val_real() override
Definition: item_func.cc:2946
Item_func_atan(const POS &pos, Item *a, Item *b)
Definition: item_func.h:1428
Item_func_atan(const POS &pos, Item *a)
Definition: item_func.h:1427
const char * func_name() const override
Definition: item_func.h:1430
Definition: item_func.h:2174
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_func.cc:5899
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2189
table_map get_initial_pseudo_tables() const override
Ensure that "benchmark()" is never optimized away.
Definition: item_func.h:2182
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_func.cc:5832
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:2198
Item_int_func super
Definition: item_func.h:2175
Item_func_benchmark(const POS &pos, Item *count_expr, Item *expr)
Definition: item_func.h:2178
longlong val_int() override
Definition: item_func.cc:5841
const char * func_name() const override
Definition: item_func.h:2188
Definition: item_func.h:2046
longlong int_op() override
Performs the operation on integers to produce a result of type INT_RESULT.
Definition: item_func.h:2053
const char * func_name() const override
Definition: item_func.h:2050
Item_func_bit_and(const POS &pos, Item *a, Item *b)
Definition: item_func.h:2048
String * str_op(String *str) override
Performs the operation on binary strings to produce a result of type STRING_RESULT.
Definition: item_func.h:2054
Definition: item_func.h:2072
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2077
longlong val_int() override
Definition: item_func.cc:4534
const char * func_name() const override
Definition: item_func.h:2076
Item_func_bit_count(const POS &pos, Item *a)
Definition: item_func.h:2074
Definition: item_func.h:1821
const char * func_name() const override
Definition: item_func.h:1828
longlong val_int() override
Definition: item_func.h:1824
Item_func_bit_length(const POS &pos, Item *a)
Definition: item_func.h:1823
Definition: item_func.h:2125
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_func.h:2134
Item_func_bit_neg(const POS &pos, Item *a)
Definition: item_func.h:2132
longlong int_op() override
Performs the operation on integers to produce a result of type INT_RESULT.
Definition: item_func.cc:3180
bool binary_result_requires_binary_second_arg() const override
Definition: item_func.h:2127
String * str_op(String *str) override
Performs the operation on binary strings to produce a result of type STRING_RESULT.
Definition: item_func.cc:3188
const char * func_name() const override
Definition: item_func.h:2133
Definition: item_func.h:2033
const char * func_name() const override
Definition: item_func.h:2037
String * str_op(String *str) override
Performs the operation on binary strings to produce a result of type STRING_RESULT.
Definition: item_func.h:2041
longlong int_op() override
Performs the operation on integers to produce a result of type INT_RESULT.
Definition: item_func.h:2040
Item_func_bit_or(const POS &pos, Item *a, Item *b)
Definition: item_func.h:2035
Base class for all the bit functions that work with two binary arguments: '&', '|',...
Definition: item_func.h:2018
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:3246
bool binary_result_requires_binary_second_arg() const override
Definition: item_func.h:2020
longlong eval_int_op(Int_func int_func)
Template function used to evaluate the bitwise operation over int arguments.
Definition: item_func.cc:3220
Item_func_bit_two_param(const POS &pos, Item *a, Item *b)
Definition: item_func.h:2029
Definition: item_func.h:2059
const char * func_name() const override
Definition: item_func.h:2063
Item_func_bit_xor(const POS &pos, Item *a, Item *b)
Definition: item_func.h:2061
longlong int_op() override
Performs the operation on integers to produce a result of type INT_RESULT.
Definition: item_func.h:2066
String * str_op(String *str) override
Performs the operation on binary strings to produce a result of type STRING_RESULT.
Definition: item_func.h:2067
Definition: item_func.h:1956
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:1980
String tmp_value
Buffer storing the determined value.
Definition: item_func.h:1961
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.cc:2992
virtual bool binary_result_requires_binary_second_arg() const =0
my_decimal * val_decimal(my_decimal *decimal_value) override
Definition: item_func.cc:3053
double val_real() override
Definition: item_func.cc:3037
String * val_str(String *str) override
Definition: item_func.cc:3061
Item_result hybrid_type
Stores the Item's result type. Can only be INT_RESULT or STRING_RESULT.
Definition: item_func.h:1959
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_func.h:1984
longlong val_int() override
Definition: item_func.cc:3021
Item_func_bit(const POS &pos, Item *a)
Definition: item_func.h:1970
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:1973
Item_func_bit(const POS &pos, Item *a, Item *b)
Definition: item_func.h:1969
bool get_time(MYSQL_TIME *ltime) override
Definition: item_func.h:1990
Definition: item_func.h:2639
const char * func_name() const override
Definition: item_func.h:2644
longlong val_int() override
INFORMATION_SCHEMA picks metadata from DD using system views.
Definition: item_func.cc:9161
Item_func_can_access_column(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_func.h:2641
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2645
Internal functions used by INFORMATION_SCHEMA implementation to check if user have access to given da...
Definition: item_func.h:2541
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2547
Item_func_can_access_database(const POS &pos, Item *a)
Definition: item_func.h:2543
longlong val_int() override
INFORMATION_SCHEMA picks metadata from DD using system views.
Definition: item_func.cc:8742
const char * func_name() const override
Definition: item_func.h:2546
Definition: item_func.h:2603
Item_func_can_access_event(const POS &pos, Item *a)
Definition: item_func.h:2605
const char * func_name() const override
Definition: item_func.h:2607
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2608
longlong val_int() override
INFORMATION_SCHEMA picks metadata from DD using system views.
Definition: item_func.cc:9046
Definition: item_func.h:2614
const char * func_name() const override
Definition: item_func.h:2619
Item_func_can_access_resource_group(const POS &pos, Item *a)
Definition: item_func.h:2616
longlong val_int() override
INFORMATION_SCHEMA picks metadata from DD using system views.
Definition: item_func.cc:9098
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2620
Definition: item_func.h:2590
Item_func_can_access_routine(const POS &pos, PT_item_list *list)
Definition: item_func.h:2592
const char * func_name() const override
Definition: item_func.h:2595
longlong val_int() override
INFORMATION_SCHEMA picks metadata from DD using system views.
Definition: item_func.cc:8952
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2596
Definition: item_func.h:2553
const char * func_name() const override
Definition: item_func.h:2558
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2559
Item_func_can_access_table(const POS &pos, Item *a, Item *b)
Definition: item_func.h:2555
longlong val_int() override
INFORMATION_SCHEMA picks metadata from new DD using system views.
Definition: item_func.cc:8866
Definition: item_func.h:2577
Item_func_can_access_trigger(const POS &pos, Item *a, Item *b)
Definition: item_func.h:2579
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2583
longlong val_int() override
INFORMATION_SCHEMA picks metadata from new DD using system views.
Definition: item_func.cc:8930
const char * func_name() const override
Definition: item_func.h:2582
Definition: item_func.h:2565
const char * func_name() const override
Definition: item_func.h:2570
Item_func_can_access_user(const POS &pos, Item *a, Item *b)
Definition: item_func.h:2567
longlong val_int() override
INFORMATION_SCHEMA picks metadata from new DD using system views.
Definition: item_func.cc:8889
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2571
Definition: item_func.h:2627
longlong val_int() override
INFORMATION_SCHEMA picks metadata from DD using system views.
Definition: item_func.cc:9236
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2633
Item_func_can_access_view(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_func.h:2629
const char * func_name() const override
Definition: item_func.h:2632
Definition: item_func.h:1473
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:1482
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_func.h:1481
const char * func_name() const override
Definition: item_func.h:1477
enum Functype functype() const override
Definition: item_func.h:1483
double real_op() override
Performs the operation that this functions implements when the result type is REAL.
Definition: item_func.cc:3407
my_decimal * decimal_op(my_decimal *) override
Performs the operation that this functions implements when the result type is DECIMAL.
Definition: item_func.cc:3413
Item_func_ceiling(const POS &pos, Item *a)
Definition: item_func.h:1476
longlong int_op() override
Performs the operation that this functions implements when the result type is INT.
Definition: item_func.cc:3386
Item_func_ceiling(Item *a)
Definition: item_func.h:1475
Definition: item_func.h:1831
Item_func_char_length(Item *a)
Definition: item_func.h:1835
Item_func_char_length(const POS &pos, Item *a)
Definition: item_func.h:1836
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:1839
longlong val_int() override
Definition: item_func.cc:4246
const char * func_name() const override
Definition: item_func.h:1838
String value
Definition: item_func.h:1832
Definition: item_func.h:1845
const char * func_name() const override
Definition: item_func.h:1851
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:1852
longlong val_int() override
Definition: item_func.cc:4257
Item_func_coercibility(const POS &pos, Item *a)
Definition: item_func.h:1847
Definition: item_func.h:1081
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:1087
Item_int_func super
Definition: item_func.h:1082
const char * func_name() const override
Definition: item_func.h:1091
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:1095
Item_func_connection_id(const POS &pos)
Definition: item_func.h:1085
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:1434
enum Functype functype() const override
Definition: item_func.h:1439
const char * func_name() const override
Definition: item_func.h:1438
double val_real() override
Definition: item_func.cc:2958
Item_func_cos(const POS &pos, Item *a)
Definition: item_func.h:1436
Definition: item_func.h:1458
const char * func_name() const override
Definition: item_func.h:1462
enum Functype functype() const override
Definition: item_func.h:1463
double val_real() override
Definition: item_func.cc:2979
Item_func_cot(const POS &pos, Item *a)
Definition: item_func.h:1460
Definition: item_func.h:1585
Item_func_degrees(const POS &pos, Item *a)
Definition: item_func.h:1587
const char * func_name() const override
Definition: item_func.h:1589
enum Functype functype() const override
Definition: item_func.h:1590
Definition: item_func.h:1258
Item_func_div_base(const POS &pos, Item *a, Item *b)
Definition: item_func.h:1260
Item_func_div_base(Item *a, Item *b)
Definition: item_func.h:1262
uint m_prec_increment
Definition: item_func.h:1269
my_decimal * decimal_op(my_decimal *) override
Performs the operation that this functions implements when the result type is DECIMAL.
Definition: item_func.cc:2467
double real_op() override
Performs the operation that this functions implements when the result type is REAL.
Definition: item_func.cc:2452
longlong int_op() override
Performs the operation that this functions implements when the result type is INT.
Definition: item_func.cc:2557
enum Functype functype() const override
Definition: item_func.h:1266
Definition: item_func.h:1281
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.cc:2619
void set_numeric_type() override
Check arguments to determine the data type for a numeric function of two arguments.
Definition: item_func.cc:2630
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_func.h:1293
Item_func_div_int(const POS &pos, Item *a, Item *b)
Definition: item_func.h:1284
enum_field_types default_data_type() const override
Get the default data (output) type for the specific item.
Definition: item_func.h:1287
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:1294
void result_precision() override
Definition: item_func.cc:2503
const char * func_name() const override
Definition: item_func.h:1286
Item_func_div_int(Item *a, Item *b)
Definition: item_func.h:1283
Definition: item_func.h:1272
void result_precision() override
Definition: item_func.cc:2486
Item_func_div(const POS &pos, Item *a, Item *b)
Definition: item_func.h:1274
const char * func_name() const override
Definition: item_func.h:1276
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.cc:2523
Definition: item_func.h:1353
double val_real() override
Definition: item_func.cc:2901
enum Functype functype() const override
Definition: item_func.h:1358
const char * func_name() const override
Definition: item_func.h:1357
Item_func_exp(const POS &pos, Item *a)
Definition: item_func.h:1355
Definition: item_func.h:1899
String value
Definition: item_func.h:1900
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.cc:4379
const char * func_name() const override
Definition: item_func.h:1907
String tmp
Definition: item_func.h:1900
Item_func_field(const POS &pos, PT_item_list *opt_list)
Definition: item_func.h:1904
longlong val_int() override
Definition: item_func.cc:4336
Item_result cmp_type
Definition: item_func.h:1901
Definition: item_func.h:1933
const CHARSET_INFO * compare_collation() const override
Definition: item_func.h:1949
const char * func_name() const override
Definition: item_func.h:1947
Item_func_find_in_set(const POS &pos, Item *a, Item *b)
Definition: item_func.h:1944
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.cc:4428
longlong val_int() override
Definition: item_func.cc:4456
String value2
Definition: item_func.h:1934
DTCollation cmp_collation
Definition: item_func.h:1941
uint m_enum_value
Definition: item_func.h:1940
String value
Definition: item_func.h:1934
Definition: item_func.h:1486
my_decimal * decimal_op(my_decimal *) override
Performs the operation that this functions implements when the result type is DECIMAL.
Definition: item_func.cc:3449
const char * func_name() const override
Definition: item_func.h:1490
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:1495
double real_op() override
Performs the operation that this functions implements when the result type is REAL.
Definition: item_func.cc:3443
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_func.h:1494
Item_func_floor(const POS &pos, Item *a)
Definition: item_func.h:1489
Item_func_floor(Item *a)
Definition: item_func.h:1488
longlong int_op() override
Performs the operation that this functions implements when the result type is INT.
Definition: item_func.cc:3422
enum Functype functype() const override
Definition: item_func.h:1496
Definition: item_func.h:4002
Item_func_found_rows(const POS &pos)
Definition: item_func.h:4006
longlong val_int() override
Definition: item_func.cc:8502
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:4015
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_func.cc:8491
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:4011
Item_int_func super
Definition: item_func.h:4003
const char * func_name() const override
Definition: item_func.h:4010
Definition: item_func.h:2849
const char * func_name() const override
Definition: item_func.h:2859
longlong val_int() override
INFORMATION_SCHEMA picks metadata from DD using system views.
Definition: item_func.cc:10079
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2854
Item_func_get_dd_index_sub_part_length(const POS &pos, PT_item_list *list)
Definition: item_func.h:2851
Definition: item_func.h:2400
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:2423
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:2412
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2415
Item_int_func super
Definition: item_func.h:2401
Item_func_get_lock(const POS &pos, Item *a, Item *b)
Definition: item_func.h:2406
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_func.cc:5508
const char * func_name() const override
Definition: item_func.h:2411
String value
Definition: item_func.h:2403
bool is_non_const_over_literals(uchar *) override
Definition: item_func.h:2422
longlong val_int() override
Get a user level lock.
Definition: item_func.cc:5533
Definition: item_func.h:3489
const enum_var_type var_scope
Definition: item_func.h:3490
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:3508
longlong get_sys_var_safe(THD *thd, sys_var *var)
Definition: item_func.cc:7269
bool eq_specific(const Item *item) const override
Provide a more specific equality check for a function.
Definition: item_func.cc:7547
longlong cached_llval
Definition: item_func.h:3491
enum Functype functype() const override
Definition: item_func.h:3507
Item_func_get_system_var(const System_variable_tracker &, enum_var_type scope)
Definition: item_func.cc:7169
double val_real() override
Definition: item_func.cc:7460
String cached_strval
Definition: item_func.h:3493
const char * func_name() const override
Definition: item_func.h:3526
longlong val_int() override
Definition: item_func.cc:7284
const System_variable_tracker var_tracker
Definition: item_func.h:3497
query_id_t used_query_id
Definition: item_func.h:3495
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:3528
bool cached_null_value
Definition: item_func.h:3494
uchar cache_present
Definition: item_func.h:3496
double cached_dval
Definition: item_func.h:3492
enum Item_result result_type() const override
Definition: item_func.h:3515
bool is_non_const_over_literals(uchar *) override
Definition: item_func.h:3514
String * val_str(String *) override
Definition: item_func.cc:7367
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.cc:7175
my_decimal * val_decimal(my_decimal *dec_buf) override
Definition: item_func.h:3522
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_func.cc:7553
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_func.cc:7216
Definition: item_func.h:3367
Name_string name
Definition: item_func.h:3372
enum Item_result result_type() const override
Definition: item_func.cc:7076
double val_real() override
Definition: item_func.cc:6726
const CHARSET_INFO * charset_for_protocol() override
Definition: item_func.cc:6760
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.cc:6924
Item_func_get_user_var(Name_string a)
Definition: item_func.h:3374
String * val_str(String *str) override
Definition: item_func.cc:6698
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:6983
enum Functype functype() const override
Definition: item_func.h:3379
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_func.cc:7080
Settable_routine_parameter * get_settable_routine_parameter() override
Definition: item_func.h:3404
user_var_entry * var_entry
Definition: item_func.h:3368
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_func.cc:7067
const char * func_name() const override
Definition: item_func.h:3396
bool set_value(THD *thd, sp_rcontext *ctx, Item **it) override
Definition: item_func.cc:7093
longlong val_int() override
Definition: item_func.cc:6746
Item_result m_cached_result_type
Definition: item_func.h:3369
my_decimal * val_decimal(my_decimal *) override
Definition: item_func.cc:6736
bool eq_specific(const Item *item) const override
Provide a more specific equality check for a function.
Definition: item_func.cc:7087
void update_used_tables() override
Updates used tables, not null tables information and accumulates properties up the item tree,...
Definition: item_func.h:3388
Item_func_get_user_var(const POS &pos, Name_string a)
Definition: item_func.h:3376
bool is_non_const_over_literals(uchar *) override
Definition: item_func.h:3397
Definition: item_func.h:1876
Item_func_instr(const POS &pos, Item *a, Item *b)
Definition: item_func.h:1878
const char * func_name() const override
Definition: item_func.h:1881
Definition: item_func.h:1466
bool resolve_type_inner(THD *thd) override
Resolve type of function after all arguments have had their data types resolved.
Definition: item_func.cc:3324
Item_func_int_val(const POS &pos, Item *a)
Definition: item_func.h:1469
Item_func_int_val(Item *a)
Definition: item_func.h:1468
Definition: item_func.h:2758
longlong val_int() override
Definition: item_func.cc:9586
Item_func_internal_auto_increment(const POS &pos, PT_item_list *list)
Definition: item_func.h:2760
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2765
const char * func_name() const override
Definition: item_func.h:2764
enum Functype functype() const override
Definition: item_func.h:2762
Definition: item_func.h:2683
const char * func_name() const override
Definition: item_func.h:2689
Item_func_internal_avg_row_length(const POS &pos, PT_item_list *list)
Definition: item_func.h:2685
longlong val_int() override
Definition: item_func.cc:9537
enum Functype functype() const override
Definition: item_func.h:2687
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2690
Definition: item_func.h:2773
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2780
const char * func_name() const override
Definition: item_func.h:2779
Item_func_internal_checksum(const POS &pos, PT_item_list *list)
Definition: item_func.h:2775
longlong val_int() override
Definition: item_func.cc:9598
enum Functype functype() const override
Definition: item_func.h:2777
Definition: item_func.h:2743
enum Functype functype() const override
Definition: item_func.h:2747
const char * func_name() const override
Definition: item_func.h:2749
Item_func_internal_data_free(const POS &pos, PT_item_list *list)
Definition: item_func.h:2745
longlong val_int() override
Definition: item_func.cc:9574
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2750
Definition: item_func.h:2698
longlong val_int() override
Definition: item_func.cc:9547
const char * func_name() const override
Definition: item_func.h:2704
Item_func_internal_data_length(const POS &pos, PT_item_list *list)
Definition: item_func.h:2700
enum Functype functype() const override
Definition: item_func.h:2702
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2705
Definition: item_func.h:2817
longlong val_int() override
Definition: item_func.cc:9940
Item_func_internal_dd_char_length(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_func.h:2819
const char * func_name() const override
Definition: item_func.h:2823
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2824
Item_func_internal_get_view_warning_or_error(const POS &pos, PT_item_list *list)
Definition: item_func.h:2834
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2841
longlong val_int() override
Definition: item_func.cc:10019
const char * func_name() const override
Definition: item_func.h:2838
longlong val_int() override
INFORMATION_SCHEMA picks metadata from DD using system views.
Definition: item_func.cc:9673
Item_func_internal_index_column_cardinality(const POS &pos, PT_item_list *list)
Definition: item_func.h:2802
enum Functype functype() const override
Definition: item_func.h:2805
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2810
const char * func_name() const override
Definition: item_func.h:2807
Definition: item_func.h:2728
Item_func_internal_index_length(const POS &pos, PT_item_list *list)
Definition: item_func.h:2730
longlong val_int() override
Definition: item_func.cc:9565
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2735
enum Functype functype() const override
Definition: item_func.h:2732
const char * func_name() const override
Definition: item_func.h:2734
Internal function used by INFORMATION_SCHEMA implementation to check if a role is enabled.
Definition: item_func.h:4103
longlong val_int() override
Internal function used by INFORMATION_SCHEMA implementation to check if a role enabled.
Definition: item_func.cc:10199
enum Functype functype() const override
Definition: item_func.h:4109
Item_func_internal_is_enabled_role(const POS &pos, Item *a, Item *b)
Definition: item_func.h:4105
const char * func_name() const override
Definition: item_func.h:4108
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:4110
Internal function used by INFORMATION_SCHEMA implementation to check if a role is a mandatory role.
Definition: item_func.h:4068
longlong val_int() override
Internal function used by INFORMATION_SCHEMA implementation to check if a role is a mandatory role.
Definition: item_func.cc:10136
Item_func_internal_is_mandatory_role(const POS &pos, Item *a, Item *b)
Definition: item_func.h:4070
const char * func_name() const override
Definition: item_func.h:4073
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:4077
enum Functype functype() const override
Definition: item_func.h:4076
Definition: item_func.h:2787
Item_func_internal_keys_disabled(const POS &pos, Item *a)
Definition: item_func.h:2789
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2793
longlong val_int() override
INFORMATION_SCHEMA picks metadata from DD using system views.
Definition: item_func.cc:9625
const char * func_name() const override
Definition: item_func.h:2792
Definition: item_func.h:2713
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2720
const char * func_name() const override
Definition: item_func.h:2719
Item_func_internal_max_data_length(const POS &pos, PT_item_list *list)
Definition: item_func.h:2715
enum Functype functype() const override
Definition: item_func.h:2717
longlong val_int() override
Definition: item_func.cc:9556
Definition: item_func.h:2668
enum Functype functype() const override
Definition: item_func.h:2672
longlong val_int() override
Definition: item_func.cc:9525
Item_func_internal_table_rows(const POS &pos, PT_item_list *list)
Definition: item_func.h:2670
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2675
const char * func_name() const override
Definition: item_func.h:2674
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:3013
Item_func_internal_tablespace_autoextend_size(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_func.h:3002
longlong val_int() override
Definition: item_func.cc:9883
enum Functype functype() const override
Definition: item_func.h:3006
const char * func_name() const override
Definition: item_func.h:3009
Definition: item_func.h:3040
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:3053
Item_func_internal_tablespace_data_free(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_func.h:3042
longlong val_int() override
Definition: item_func.cc:9916
const char * func_name() const override
Definition: item_func.h:3049
enum Functype functype() const override
Definition: item_func.h:3046
Definition: item_func.h:2940
Item_func_internal_tablespace_extent_size(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_func.h:2942
enum Functype functype() const override
Definition: item_func.h:2946
longlong val_int() override
Definition: item_func.cc:9836
const char * func_name() const override
Definition: item_func.h:2949
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2953
Definition: item_func.h:2900
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2913
enum Functype functype() const override
Definition: item_func.h:2906
const char * func_name() const override
Definition: item_func.h:2909
Item_func_internal_tablespace_free_extents(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_func.h:2902
longlong val_int() override
Definition: item_func.cc:9806
Definition: item_func.h:2864
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2872
enum Functype functype() const override
Definition: item_func.h:2869
Item_func_internal_tablespace_id(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_func.h:2866
longlong val_int() override
Definition: item_func.cc:9773
const char * func_name() const override
Definition: item_func.h:2871
Definition: item_func.h:2960
longlong val_int() override
Definition: item_func.cc:9851
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2973
const char * func_name() const override
Definition: item_func.h:2969
Item_func_internal_tablespace_initial_size(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_func.h:2962
enum Functype functype() const override
Definition: item_func.h:2966
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2893
enum Functype functype() const override
Definition: item_func.h:2886
longlong val_int() override
Definition: item_func.cc:9788
Item_func_internal_tablespace_logfile_group_number(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_func.h:2882
const char * func_name() const override
Definition: item_func.h:2889
Definition: item_func.h:2980
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2993
Item_func_internal_tablespace_maximum_size(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_func.h:2982
const char * func_name() const override
Definition: item_func.h:2989
longlong val_int() override
Definition: item_func.cc:9866
enum Functype functype() const override
Definition: item_func.h:2986
longlong val_int() override
Definition: item_func.cc:9821
enum Functype functype() const override
Definition: item_func.h:2926
Item_func_internal_tablespace_total_extents(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_func.h:2922
const char * func_name() const override
Definition: item_func.h:2929
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2933
Definition: item_func.h:3020
Item_func_internal_tablespace_version(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_func.h:3022
longlong val_int() override
Definition: item_func.cc:9899
const char * func_name() const override
Definition: item_func.h:3029
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:3033
enum Functype functype() const override
Definition: item_func.h:3026
const char * func_name() const override
Definition: item_func.h:4088
longlong val_int() override
Definition: item_func.cc:10170
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:4092
Item_func_internal_use_terminology_previous(const POS &pos)
Definition: item_func.h:4085
enum Functype functype() const override
Definition: item_func.h:4091
Definition: item_func.h:3831
longlong val_int() override
Check if user level lock is free.
Definition: item_func.cc:5736
Item_func_is_free_lock(const POS &pos, Item *a)
Definition: item_func.h:3837
const char * func_name() const override
Definition: item_func.h:3841
Item_int_func super
Definition: item_func.h:3832
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:3845
bool is_non_const_over_literals(uchar *) override
Definition: item_func.h:3851
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:3842
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_func.cc:5712
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:3852
String value
Definition: item_func.h:3834
Definition: item_func.h:3861
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:3875
Item_func_is_used_lock(const POS &pos, Item *a)
Definition: item_func.h:3867
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:3882
Item_int_func super
Definition: item_func.h:3862
String value
Definition: item_func.h:3864
const char * func_name() const override
Definition: item_func.h:3871
longlong val_int() override
Check if user level lock is used and return connection id of owner.
Definition: item_func.cc:5779
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:3872
bool is_non_const_over_literals(uchar *) override
Definition: item_func.h:3881
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_func.cc:5758
Definition: item_func.h:2651
Item_func_is_visible_dd_object(const POS &pos, Item *a, Item *b)
Definition: item_func.h:2655
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2661
Item_func_is_visible_dd_object(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_func.h:2657
const char * func_name() const override
Definition: item_func.h:2660
longlong val_int() override
Skip hidden tables, columns, indexes and index elements.
Definition: item_func.cc:9369
Item_func_is_visible_dd_object(const POS &pos, Item *a)
Definition: item_func.h:2653
Definition: item_func.h:2144
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2160
const char * func_name() const override
Definition: item_func.h:2154
Item_func_last_insert_id(const POS &pos, Item *a)
Definition: item_func.h:2150
Item_func_last_insert_id()
Definition: item_func.h:2148
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:2156
longlong val_int() override
Definition: item_func.cc:5811
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:2165
Item_int_func super
Definition: item_func.h:2145
Item_func_last_insert_id(const POS &pos)
Definition: item_func.h:2149
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_func.cc:5803
Definition: item_func.h:1784
Item_func_length(const POS &pos, Item *a)
Definition: item_func.h:1788
String value
Definition: item_func.h:1785
const char * func_name() const override
Definition: item_func.h:1790
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:1791
longlong val_int() override
Definition: item_func.cc:4220
Definition: item_func.h:1361
double val_real() override
Gateway to natural LOG function.
Definition: item_func.cc:2841
enum Functype functype() const override
Definition: item_func.h:1366
const char * func_name() const override
Definition: item_func.h:1365
Item_func_ln(const POS &pos, Item *a)
Definition: item_func.h:1363
Definition: item_func.h:1859
String value1
Definition: item_func.h:1860
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_func.cc:4315
longlong val_int() override
Definition: item_func.cc:4277
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.cc:4263
Item_func_locate(Item *a, Item *b)
Definition: item_func.h:1863
Item_func_locate(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_func.h:1866
const char * func_name() const override
Definition: item_func.h:1869
Item_func_locate(const POS &pos, Item *a, Item *b)
Definition: item_func.h:1864
String value2
Definition: item_func.h:1860
Definition: item_func.h:1385
double val_real() override
Definition: item_func.cc:2890
enum Functype functype() const override
Definition: item_func.h:1390
const char * func_name() const override
Definition: item_func.h:1389
Item_func_log10(const POS &pos, Item *a)
Definition: item_func.h:1387
Definition: item_func.h:1378
double val_real() override
Definition: item_func.cc:2878
const char * func_name() const override
Definition: item_func.h:1382
Item_func_log2(const POS &pos, Item *a)
Definition: item_func.h:1380
Definition: item_func.h:1369
Item_func_log(const POS &pos, Item *a)
Definition: item_func.h:1371
double val_real() override
Extended but so slower LOG function.
Definition: item_func.cc:2858
Item_func_log(const POS &pos, Item *a, Item *b)
Definition: item_func.h:1372
const char * func_name() const override
Definition: item_func.h:1374
enum Functype functype() const override
Definition: item_func.h:1375
Definition: item_func.h:3540
uint flags
Definition: item_func.h:3548
FT_INFO * ft_handler
Definition: item_func.h:3554
DTCollation cmp_collation
Definition: item_func.h:3553
void update_used_tables() override
Updates used tables, not null tables information and accumulates properties up the item tree,...
Definition: item_func.cc:7816
bool fix_index(const THD *thd)
Definition: item_func.cc:7823
Item * key_item() const override
Definition: item_func.h:3603
uint key
Definition: item_func.h:3548
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_func.cc:7955
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:3620
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:3799
void set_master(Item_func_match *item)
Set master MATCH function and adjust used_in_where_only value.
Definition: item_func.h:3697
longlong val_int() override
Definition: item_func.h:3610
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:3562
Ft_hints * hints
Fulltext index hints, initialized for master MATCH function only.
Definition: item_func.h:3767
const char * func_name() const override
Definition: item_func.h:3605
bool docid_in_result()
Check whether FT result contains the document ID.
Definition: item_func.h:3667
Item * concat_ws
Definition: item_func.h:3563
bool can_skip_ranking()
Check if ranking is not needed.
Definition: item_func.h:3734
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_func.h:3592
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:3718
Table_ref * table_ref
Definition: item_func.h:3555
bool ordered_result()
Check whether FT result is ordered on rank.
Definition: item_func.h:3649
bool init_search(THD *thd)
Initialize searching within full-text index.
Definition: item_func.cc:7587
String value
Definition: item_func.h:3564
enum Functype functype() const override
Definition: item_func.h:3604
void set_hints(JOIN *join, uint ft_flag, ha_rows ft_limit, bool no_cond)
Set FT hints.
Definition: item_func.cc:7987
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:3575
Item * against
Definition: item_func.h:3547
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:7663
bool fix_fields(THD *thd, Item **ref) override
Definition: item_func.cc:7692
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_func.cc:7559
bool used_in_where_only
true if MATCH function is used in WHERE condition only.
Definition: item_func.h:3780
String search_value
Definition: item_func.h:3565
bool is_simple_expression()
Check if this MATCH function is a simple expression in WHERE condition.
Definition: item_func.h:3758
Ft_hints * get_hints()
Returns pointer to Ft_hints object belonging to master MATCH function.
Definition: item_func.h:3707
void add_json_info(Json_object *obj) override
Add all the node-specific json fields.
Definition: item_func.cc:7968
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:3552
void set_simple_expression(bool val)
Set flag that the function is a simple expression.
Definition: item_func.h:3747
double val_real() override
Definition: item_func.cc:7923
bool simple_expression
Flag is true when MATCH function is used as a simple expression in WHERE condition,...
Definition: item_func.h:3773
Item_func_match * get_master()
Returns master MATCH function.
Definition: item_func.h:3687
bool eq_specific(const Item *item) const override
Provide a more specific equality check for a function.
Definition: item_func.cc:7906
Item_real_func super
Definition: item_func.h:3541
ulonglong get_count()
Get number of matching rows from FT handler.
Definition: item_func.h:3635
Definition: item_func.h:1686
Item_func_max(const POS &pos, PT_item_list *opt_list)
Definition: item_func.h:1688
const char * func_name() const override
Definition: item_func.h:1690
enum Functype functype() const override
Definition: item_func.h:1691
Definition: item_func.h:1600
bool compare_as_dates() const
Returns true if arguments to this function should be compared as dates.
Definition: item_func.cc:3908
longlong int_op() override
Performs the operation that this functions implements when the result type is INT.
Definition: item_func.cc:4048
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.cc:3792
TYPELIB * get_typelib() const override
Get the typelib information for an item of type set or enum.
Definition: item_func.cc:3806
my_decimal * val_decimal(my_decimal *) override
Definition: item_func.cc:4112
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:4005
String * str_op(String *) override
Performs the operation that this functions implements when the result type is a string type.
Definition: item_func.cc:3945
uint8 fsp_for_string
Fractional seconds precision to use when converting a time or timestamp expression into a string.
Definition: item_func.h:1656
double val_real() override
Definition: item_func.cc:4098
longlong val_int() override
Definition: item_func.cc:4105
bool resolve_type_inner(THD *thd) override
Resolve type of function after all arguments have had their data types resolved.
Definition: item_func.cc:3840
Item_func_min_max(const POS &pos, PT_item_list *opt_list, bool is_least_func)
Definition: item_func.h:1602
bool has_temporal_arg() const
Returns true if at least one of the arguments was of temporal type.
Definition: item_func.h:1637
String m_string_buf
Definition: item_func.h:1642
double real_op() override
Performs the operation that this functions implements when the result type is REAL.
Definition: item_func.cc:4029
bool cmp_datetimes(longlong *value)
Compare arguments as datetime values.
Definition: item_func.cc:3913
Item * temporal_item
Definition: item_func.h:1650
enum Item_result result_type() const override
Definition: item_func.h:1622
bool cmp_times(longlong *value)
Compare arguments as time values.
Definition: item_func.cc:3934
const bool m_is_least_func
True if LEAST function, false if GREATEST.
Definition: item_func.h:1641
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:1629
bool time_op(MYSQL_TIME *ltime) override
Definition: item_func.cc:4014
my_decimal * decimal_op(my_decimal *) override
Performs the operation that this functions implements when the result type is DECIMAL.
Definition: item_func.cc:4073
enum_field_types default_data_type() const override
Get the default data (output) type for the specific item.
Definition: item_func.h:1616
void set_numeric_type() override
Definition: item_func.h:1621
Definition: item_func.h:1678
enum Functype functype() const override
Definition: item_func.h:1683
const char * func_name() const override
Definition: item_func.h:1682
Item_func_min(const POS &pos, PT_item_list *opt_list)
Definition: item_func.h:1680
Definition: item_func.h:1226
enum Functype functype() const override
Definition: item_func.h:1240
my_decimal * decimal_op(my_decimal *) override
See Item_func_plus::decimal_op for comments.
Definition: item_func.cc:2300
longlong int_op() override SUPPRESS_UBSAN
Performs the operation that this functions implements when the result type is INT.
Definition: item_func.cc:2249
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:2231
Item_func_minus(const POS &pos, Item *a, Item *b)
Definition: item_func.h:1229
Item_func_minus(Item *a, Item *b)
Definition: item_func.h:1228
double real_op() override
Performs the operation that this functions implements when the result type is REAL.
Definition: item_func.cc:2238
const char * func_name() const override
Definition: item_func.h:1232
Definition: item_func.h:1297
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_func.h:1308
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:1309
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.cc:2724
void result_precision() override
Definition: item_func.cc:2708
Item_func_mod(const POS &pos, Item *a, Item *b)
Definition: item_func.h:1300
const char * func_name() const override
Definition: item_func.h:1305
enum Functype functype() const override
Definition: item_func.h:1310
double real_op() override
Performs the operation that this functions implements when the result type is REAL.
Definition: item_func.cc:2671
Item_func_mod(Item *a, Item *b)
Definition: item_func.h:1299
my_decimal * decimal_op(my_decimal *) override
Performs the operation that this functions implements when the result type is DECIMAL.
Definition: item_func.cc:2686
longlong int_op() override
Performs the operation that this functions implements when the result type is INT.
Definition: item_func.cc:2636
Definition: item_func.h:1243
const char * func_name() const override
Definition: item_func.h:1248
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:1254
void result_precision() override
Definition: item_func.cc:2438
double real_op() override
Performs the operation that this functions implements when the result type is REAL.
Definition: item_func.cc:2325
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_func.h:1253
my_decimal * decimal_op(my_decimal *) override
See Item_func_plus::decimal_op for comments.
Definition: item_func.cc:2423
longlong int_op() override
Performs the operation that this functions implements when the result type is INT.
Definition: item_func.cc:2337
Item_func_mul(Item *a, Item *b)
Definition: item_func.h:1245
enum Functype functype() const override
Definition: item_func.h:1255
Item_func_mul(const POS &pos, Item *a, Item *b)
Definition: item_func.h:1246
Definition: item_func.h:1313
Item_func_neg(const POS &pos, Item *a)
Definition: item_func.h:1316
const char * func_name() const override
Definition: item_func.h:1321
enum Functype functype() const override
Definition: item_func.h:1322
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.cc:2769
double real_op() override
Performs the operation that this functions implements when the result type is REAL.
Definition: item_func.cc:2731
longlong int_op() override
Performs the operation that this functions implements when the result type is INT.
Definition: item_func.cc:2737
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:1326
my_decimal * decimal_op(my_decimal *) override
Performs the operation that this functions implements when the result type is DECIMAL.
Definition: item_func.cc:2752
void fix_num_length_and_dec() override
Definition: item_func.cc:2762
Item_func_neg(Item *a)
Definition: item_func.h:1315
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_func.h:1325
Definition: item_func.h:967
Item_func_num1(Item *a, Item *b)
Definition: item_func.h:972
Item_func_num1(const POS &pos, Item *a)
Definition: item_func.h:970
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:978
Item_func_num1(Item *a)
Definition: item_func.h:969
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:973
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:982
bool time_op(MYSQL_TIME *) override
Definition: item_func.h:986
Definition: item_func.h:874
virtual void set_numeric_type()=0
longlong val_int() override
Definition: item_func.cc:1776
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:882
Item_func_numhybrid(mem_root_deque< Item * > *list)
Definition: item_func.h:896
enum_field_types default_data_type() const override
Get the default data (output) type for the specific item.
Definition: item_func.h:906
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:963
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_func.cc:1863
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:879
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:1817
enum Item_result result_type() const override
Definition: item_func.h:905
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:900
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:891
Item_result hybrid_type
Definition: item_func.h:876
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:1880
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:887
Definition: item_func.h:1924
const char * func_name() const override
Definition: item_func.h:1930
longlong val_int() override
Definition: item_func.cc:4405
String value
Definition: item_func.h:1925
Item_func_ord(const POS &pos, Item *a)
Definition: item_func.h:1928
Definition: item_func.h:1210
const char * func_name() const override
Definition: item_func.h:1216
Item_func_plus(const POS &pos, Item *a, Item *b)
Definition: item_func.h:1213
Item_func_plus(Item *a, Item *b)
Definition: item_func.h:1212
double real_op() override
Performs the operation that this functions implements when the result type is REAL.
Definition: item_func.cc:2126
longlong int_op() override SUPPRESS_UBSAN
Performs the operation that this functions implements when the result type is INT.
Definition: item_func.cc:2137
my_decimal * decimal_op(my_decimal *) override
Calculate plus of two decimals.
Definition: item_func.cc:2193
enum Functype functype() const override
Definition: item_func.h:1223
Definition: item_func.h:1401
double val_real() override
Definition: item_func.cc:2916
Item_func_pow(const POS &pos, Item *a, Item *b)
Definition: item_func.h:1403
const char * func_name() const override
Definition: item_func.h:1405
enum Functype functype() const override
Definition: item_func.h:1406
Definition: item_func.h:1593
Item_func_radians(const POS &pos, Item *a)
Definition: item_func.h:1595
const char * func_name() const override
Definition: item_func.h:1597
enum Functype functype() const override
Definition: item_func.h:1598
Definition: item_func.h:1522
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_func.cc:3663
double val_real() override
Definition: item_func.cc:3728
void seed_random(Item *val)
Definition: item_func.cc:3680
bool fix_fields(THD *thd, Item **ref) override
Definition: item_func.cc:3698
const char * func_name() const override
Definition: item_func.h:1534
bool first_eval
Definition: item_func.h:1526
Item_real_func super
Definition: item_func.h:1523
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:1550
rand_struct * m_rand
Definition: item_func.h:1525
Item_func_rand()
Definition: item_func.h:1528
Item_func_rand(const POS &pos)
Definition: item_func.h:1530
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:1541
Item_func_rand(const POS &pos, Item *a)
Definition: item_func.h:1529
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.cc:3690
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_func.h:1546
Definition: item_func.h:2462
longlong val_int() override
Release all user level lock held by connection.
Definition: item_func.cc:5695
Item_int_func super
Definition: item_func.h:2463
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2474
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:2471
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_func.cc:5681
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:2479
Item_func_release_all_locks(const POS &pos)
Definition: item_func.h:2466
const char * func_name() const override
Definition: item_func.h:2470
bool is_non_const_over_literals(uchar *) override
Definition: item_func.h:2478
Definition: item_func.h:2432
Item_int_func super
Definition: item_func.h:2433
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_func.cc:5613
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:2443
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:2453
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2446
String value
Definition: item_func.h:2435
const char * func_name() const override
Definition: item_func.h:2442
longlong val_int() override
Release a user level lock.
Definition: item_func.cc:5637
bool is_non_const_over_literals(uchar *) override
Definition: item_func.h:2452
Item_func_release_lock(const POS &pos, Item *a)
Definition: item_func.h:2438
Definition: item_func.h:1501
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.cc:3458
my_decimal * decimal_op(my_decimal *) override
Performs the operation that this functions implements when the result type is DECIMAL.
Definition: item_func.cc:3648
bool truncate
Definition: item_func.h:1502
Item_func_round(Item *a, Item *b, bool trunc_arg)
Definition: item_func.h:1505
longlong int_op() override
Performs the operation that this functions implements when the result type is INT.
Definition: item_func.cc:3582
enum Functype functype() const override
Definition: item_func.h:1517
const char * func_name() const override
Definition: item_func.h:1510
Item_func_round(const POS &pos, Item *a, Item *b, bool trunc_arg)
Definition: item_func.h:1507
double real_op() override
Performs the operation that this functions implements when the result type is REAL.
Definition: item_func.cc:3554
Definition: item_func.h:3891
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:3901
Item_func_row_count(const POS &pos)
Definition: item_func.h:3895
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_func.cc:8132
const char * func_name() const override
Definition: item_func.h:3900
Item_int_func super
Definition: item_func.h:3892
longlong val_int() override
Definition: item_func.cc:8142
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:3905
This class is used to implement operations like SET @variable or @variable:= expression.
Definition: item_func.h:3299
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_func.cc:6047
void print_assignment(const THD *thd, String *str, enum_query_type query_type) const
Definition: item_func.cc:6573
type_conversion_status save_in_field(Field *field, bool no_conversions, bool can_use_result_field)
Definition: item_func.cc:6649
enum Item_result result_type() const override
Definition: item_func.h:3340
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.cc:6103
Item_func_set_user_var(const POS &pos, Name_string a, Item *b)
Definition: item_func.h:3316
enum Item_result cached_result_type
Definition: item_func.h:3300
enum Functype functype() const override
Definition: item_func.h:3328
Item_func_set_user_var(Name_string a, Item *b)
Definition: item_func.h:3315
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:3360
void make_field(Send_field *tmp_field) override
Definition: item_func.cc:6601
String * val_str(String *str) override
Definition: item_func.cc:6558
void save_org_in_field(Field *field) override
Definition: item_func.h:3352
bool set_entry(THD *thd, bool create_if_not_exists)
Definition: item_func.cc:6061
bool fix_fields(THD *thd, Item **ref) override
Definition: item_func.cc:6089
bool null_item
Definition: item_func.h:3304
bool update()
Update user variable from value in save_result.
Definition: item_func.cc:6496
void save_item_result(Item *item)
Evaluate and store item's result.
Definition: item_func.cc:6465
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:6249
longlong val_int() override
Definition: item_func.cc:6551
my_decimal * val_decimal(my_decimal *) override
Definition: item_func.cc:6565
double vreal
Definition: item_func.h:3307
my_decimal decimal_buff
Definition: item_func.h:3303
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:6589
my_decimal * vdec
Definition: item_func.h:3309
String value
Definition: item_func.h:3302
double val_real() override
Definition: item_func.cc:6544
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_func.cc:6582
bool check(bool use_result_field)
This functions is invoked on SET @variable or @variable:= expression.
Definition: item_func.cc:6421
const char * func_name() const override
Definition: item_func.h:3347
Name_string name
Definition: item_func.h:3313
union Item_func_set_user_var::@63 save_result
Item_func_set_user_var(THD *thd, Item_func_set_user_var *item)
Definition: item_func.h:3319
String * vstr
Definition: item_func.h:3308
longlong vint
Definition: item_func.h:3306
Definition: item_func.h:2103
Item_func_shift_left(const POS &pos, Item *a, Item *b)
Definition: item_func.h:2105
const char * func_name() const override
Definition: item_func.h:2107
longlong int_op() override
Performs the operation on integers to produce a result of type INT_RESULT.
Definition: item_func.cc:3096
String * str_op(String *str) override
Performs the operation on binary strings to produce a result of type STRING_RESULT.
Definition: item_func.cc:3170
Definition: item_func.h:2114
String * str_op(String *str) override
Performs the operation on binary strings to produce a result of type STRING_RESULT.
Definition: item_func.cc:3174
Item_func_shift_right(const POS &pos, Item *a, Item *b)
Definition: item_func.h:2116
longlong int_op() override
Performs the operation on integers to produce a result of type INT_RESULT.
Definition: item_func.cc:3097
const char * func_name() const override
Definition: item_func.h:2118
Definition: item_func.h:2088
String * eval_str_op(String *str)
Template function that evaluates the bitwise shift operation over binary string arguments.
Definition: item_func.cc:3105
longlong eval_int_op()
Template function that evaluates the bitwise shift operation over integer arguments.
Definition: item_func.cc:3080
bool binary_result_requires_binary_second_arg() const override
Definition: item_func.h:2090
Item_func_shift(const POS &pos, Item *a, Item *b)
Definition: item_func.h:2099
Definition: item_func.h:1563
longlong val_int() override
Definition: item_func.cc:3769
Item_func_sign(const POS &pos, Item *a)
Definition: item_func.h:1565
enum Functype functype() const override
Definition: item_func.h:1567
const char * func_name() const override
Definition: item_func.h:1566
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.cc:3761
Definition: item_func.h:1442
Item_func_sin(const POS &pos, Item *a)
Definition: item_func.h:1444
double val_real() override
Definition: item_func.cc:2965
const char * func_name() const override
Definition: item_func.h:1446
enum Functype functype() const override
Definition: item_func.h:1447
Definition: item_func.h:2210
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2234
Item_func_sleep(const POS &pos, Item *a)
Definition: item_func.h:2214
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_func.cc:5948
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:2227
const char * func_name() const override
Definition: item_func.h:2217
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:2224
Item_int_func super
Definition: item_func.h:2211
longlong val_int() override
This function is just used to create tests with time gaps.
Definition: item_func.cc:5958
Definition: item_func.h:3923
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:8634
void compute_cost(CostOfItem *root_cost) const override
Compute the cost of evaluating this Item.
Definition: item_func.h:3997
double val_real() override
Definition: item_func.cc:8325
bool change_context_processor(uchar *arg) override
Definition: item_func.h:3976
longlong val_int() override
Definition: item_func.cc:8319
String * val_str(String *str) override
Definition: item_func.cc:8347
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_func.cc:8189
my_decimal * val_decimal(my_decimal *dec_buf) override
Definition: item_func.cc:8341
bool m_deterministic
true when function execution is deterministic
Definition: item_func.h:3937
const char * func_name() const override
Definition: item_func.cc:8198
Field * sp_result_field
The result field of the concrete stored function.
Definition: item_func.h:3935
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:3989
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:8256
bool val_json(Json_wrapper *result) override
Get a JSON value from an Item.
Definition: item_func.cc:8362
Field * tmp_table_field(TABLE *t_arg) override
Definition: item_func.cc:8507
void update_used_tables() override
Updates used tables, not null tables information and accumulates properties up the item tree,...
Definition: item_func.cc:8627
bool get_time(MYSQL_TIME *ltime) override
Definition: item_func.cc:8336
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:3929
Item_result result_type() const override
Definition: item_func.cc:8484
Field * get_sp_result_field()
Definition: item_func.h:3988
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:8149
bool execute_impl(THD *thd)
Execute function and store the return value in the field.
Definition: item_func.cc:8432
bool resolve_type(THD *thd) override
Initialize local members with values from the Field interface.
Definition: item_func.cc:8305
Item_func super
Definition: item_func.h:3924
void make_field(Send_field *tmp_field) override
Definition: item_func.cc:8477
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_func.cc:8165
bool execute()
Execute function & store value in field.
Definition: item_func.cc:8387
bool sp_check_access(THD *thd)
Checks if requested access to function can be granted to user.
Definition: item_func.cc:8528
enum Functype functype() const override
Definition: item_func.h:3983
sp_name * m_name
The name of the stored function.
Definition: item_func.h:3931
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_func.cc:8331
table_map get_initial_pseudo_tables() const override
Must not be called before the procedure is resolved, i.e.
Definition: item_func.cc:8220
bool fix_fields(THD *thd, Item **ref) override
Definition: item_func.cc:8538
sp_head * m_sp
Pointer to actual function instance (null when not resolved or executing)
Definition: item_func.h:3933
Definition: item_func.h:1393
Item_func_sqrt(const POS &pos, Item *a)
Definition: item_func.h:1395
const char * func_name() const override
Definition: item_func.h:1397
double val_real() override
Definition: item_func.cc:2908
enum Functype functype() const override
Definition: item_func.h:1398
Definition: item_func.h:1450
enum Functype functype() const override
Definition: item_func.h:1455
double val_real() override
Definition: item_func.cc:2972
Item_func_tan(const POS &pos, Item *a)
Definition: item_func.h:1452
const char * func_name() const override
Definition: item_func.h:1454
Definition: item_func.h:2338
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_func.h:2347
double val_real() override
Definition: item_func.cc:5157
Item_func_udf_decimal(const POS &pos, udf_func *udf_arg, PT_item_list *opt_list)
Definition: item_func.h:2340
longlong val_int() override
Definition: item_func.cc:5149
enum Item_result result_type() const override
Definition: item_func.h:2353
bool get_time(MYSQL_TIME *ltime) override
Definition: item_func.h:2350
String * val_str(String *str) override
Definition: item_func.cc:5170
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.cc:5180
my_decimal * val_decimal(my_decimal *) override
Definition: item_func.cc:5165
Definition: item_func.h:2289
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_func.h:2305
Item_func_udf_float(const POS &pos, udf_func *udf_arg, PT_item_list *opt_list)
Definition: item_func.h:2291
my_decimal * val_decimal(my_decimal *dec_buf) override
Definition: item_func.h:2297
longlong val_int() override
Definition: item_func.h:2293
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2311
bool get_time(MYSQL_TIME *ltime) override
Definition: item_func.h:2308
double val_real() override
Definition: item_func.cc:5119
String * val_str(String *str) override
Definition: item_func.cc:5127
Definition: item_func.h:2318
bool get_time(MYSQL_TIME *ltime) override
Definition: item_func.h:2330
enum Item_result result_type() const override
Definition: item_func.h:2331
String * val_str(String *str) override
Definition: item_func.cc:5141
Item_func_udf_int(const POS &pos, udf_func *udf_arg, PT_item_list *opt_list)
Definition: item_func.h:2320
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2332
double val_real() override
Definition: item_func.h:2323
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_func.h:2327
longlong val_int() override
Definition: item_func.cc:5135
Definition: item_func.h:2357
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.cc:5188
Item_func_udf_str(const POS &pos, udf_func *udf_arg, PT_item_list *opt_list)
Definition: item_func.h:2359
String * val_str(String *) override
Definition: item_func.cc:5197
bool get_time(MYSQL_TIME *ltime) override
Definition: item_func.h:2390
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_func.h:2387
my_decimal * val_decimal(my_decimal *dec_buf) override
Definition: item_func.h:2380
enum Item_result result_type() const override
Definition: item_func.h:2393
longlong val_int() override
Definition: item_func.h:2372
double val_real() override
Definition: item_func.h:2363
Definition: item_func.h:1573
Item_func_units(const POS &pos, Item *a, double mul_arg, double add_arg)
Definition: item_func.h:1577
double add
Definition: item_func.h:1574
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.cc:3776
double val_real() override
Definition: item_func.cc:3785
double mul
Definition: item_func.h:1574
Definition: item_func.h:4026
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:4049
Item_int_func super
Definition: item_func.h:4027
longlong val_int() override
Definition: item_func.cc:8672
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_func.cc:8664
Item_func_uuid_short(const POS &pos)
Definition: item_func.h:4030
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:4040
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:4035
bool check_partition_func_processor(uchar *) override
Check if a partition function is allowed.
Definition: item_func.h:4039
const char * func_name() const override
Definition: item_func.h:4033
Definition: item_func.h:1884
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:1892
const char * func_name() const override
Definition: item_func.h:1889
Item_func_validate_password_strength(const POS &pos, Item *a)
Definition: item_func.h:1886
longlong val_int() override
Definition: item_func.cc:4328
Definition: item_func.h:1798
const char * func_name() const override
Definition: item_func.h:1804
String value
Definition: item_func.h:1799
Item_func_vector_dim(const POS &pos, Item *a)
Definition: item_func.h:1802
longlong val_int() override
Definition: item_func.cc:4231
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:1805
Definition: item_func.h:4054
Item_static_string_func super
Definition: item_func.h:4055
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_func.cc:8680
Item_func_version(const POS &pos)
Definition: item_func.cc:9931
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:582
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:406
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:658
Item_func()
Definition: item_func.h:368
my_decimal * val_decimal(my_decimal *) override
Definition: item_func.cc:835
bool replace_equal_field_checker(uchar **arg) override
Definition: item_func.h:607
virtual bool have_rev_func() const
Definition: item_func.h:537
Item ** args
Array of pointers to arguments.
Definition: item_func.h:107
virtual enum Functype functype() const
Definition: item_func.h:367
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:816
Item_func(const POS &pos)
Definition: item_func.h:370
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:712
Item_func(Item *a, Item *b)
Definition: item_func.h:382
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:495
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:2084
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:525
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:564
Item_func(const POS &pos, Item *a)
Definition: item_func.h:377
Item * replace_equal_field(uchar *arg) override
Definition: item_func.h:613
Functype
Definition: item_func.h:209
@ DATEADD_FUNC
Definition: item_func.h:317
@ TRIG_COND_FUNC
Definition: item_func.h:253
@ JSON_VALUE_FUNC
Definition: item_func.h:354
@ JSON_SCHEMA_VALIDATION_REPORT_FUNC
Definition: item_func.h:356
@ 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:352
@ NOT_ALL_FUNC
Definition: item_func.h:250
@ LIKE_FUNC
Definition: item_func.h:220
@ FALSE_FUNC
Definition: item_func.h:334
@ SP_EXTERIORRING
Definition: item_func.h:245
@ PLUS_FUNC
Definition: item_func.h:267
@ JSON_SEARCH_FUNC
Definition: item_func.h:355
@ SIGN_FUNC
Definition: item_func.h:277
@ JSON_STORAGE_FREE_FUNC
Definition: item_func.h:353
@ NULLIF_FUNC
Definition: item_func.h:295
@ YEAR_FUNC
Definition: item_func.h:297
@ NOT_FUNC
Definition: item_func.h:249
@ MINUS_FUNC
Definition: item_func.h:268
@ HOUR_FUNC
Definition: item_func.h:308
@ TIME_TO_SEC_FUNC
Definition: item_func.h:322
@ LOG_FUNC
Definition: item_func.h:279
@ PERIODDIFF_FUNC
Definition: item_func.h:338
@ XOR_FUNC
Definition: item_func.h:226
@ COND_OR_FUNC
Definition: item_func.h:225
@ JSON_CONTAINS
Definition: item_func.h:328
@ JSON_VALID_FUNC
Definition: item_func.h:347
@ JSON_UNQUOTE_FUNC
Definition: item_func.h:330
@ GREATEST_FUNC
Definition: item_func.h:325
@ SP_EQUALS_FUNC
Definition: item_func.h:232
@ LN_FUNC
Definition: item_func.h:280
@ FROM_UNIXTIME_FUNC
Definition: item_func.h:318
@ COND_AND_FUNC
Definition: item_func.h:224
@ EQ_FUNC
Definition: item_func.h:211
@ MAKETIME_FUNC
Definition: item_func.h:300
@ FUNC_SP
Definition: item_func.h:259
@ ROUND_FUNC
Definition: item_func.h:272
@ JSON_CONTAINS_PATH_FUNC
Definition: item_func.h:351
@ NOW_FUNC
Definition: item_func.h:251
@ FROM_DAYS_FUNC
Definition: item_func.h:252
@ TRUE_FUNC
Definition: item_func.h:333
@ LEAST_FUNC
Definition: item_func.h:327
@ IN_FUNC
Definition: item_func.h:228
@ CONVERT_TZ_FUNC
Definition: item_func.h:319
@ 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:346
@ SP_TOUCHES_FUNC
Definition: item_func.h:236
@ JSON_SCHEMA_VALID_FUNC
Definition: item_func.h:357
@ SP_DISJOINT_FUNC
Definition: item_func.h:233
@ ISNOTNULLTEST_FUNC
Definition: item_func.h:231
@ DAY_FUNC
Definition: item_func.h:303
@ LOG10_FUNC
Definition: item_func.h:281
@ UDF_FUNC
Definition: item_func.h:260
@ MAKEDATE_FUNC
Definition: item_func.h:299
@ COT_FUNC
Definition: item_func.h:285
@ ISTRUTH_FUNC
Definition: item_func.h:223
@ SEC_TO_TIME_FUNC
Definition: item_func.h:339
@ DATE_FUNC
Definition: item_func.h:307
@ TIMESTAMPDIFF_FUNC
Definition: item_func.h:323
@ SECOND_FUNC
Definition: item_func.h:310
@ EXP_FUNC
Definition: item_func.h:288
@ SP_STARTPOINT
Definition: item_func.h:243
@ JSON_DEPTH_FUNC
Definition: item_func.h:343
@ JSON_QUOTE_FUNC
Definition: item_func.h:350
@ PERIODADD_FUNC
Definition: item_func.h:337
@ SP_POINTN
Definition: item_func.h:246
@ EXTRACT_FUNC
Definition: item_func.h:257
@ MONTH_FUNC
Definition: item_func.h:301
@ TO_SECONDS_FUNC
Definition: item_func.h:306
@ 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:345
@ JSON_TYPE_FUNC
Definition: item_func.h:348
@ MICROSECOND_FUNC
Definition: item_func.h:311
@ ANY_VALUE_FUNC
Definition: item_func.h:341
@ STRCMP_FUNC
Definition: item_func.h:332
@ JSON_PRETTY_FUNC
Definition: item_func.h:349
@ QUARTER_FUNC
Definition: item_func.h:314
@ NE_FUNC
Definition: item_func.h:213
@ TIMEDIFF_FUNC
Definition: item_func.h:336
@ BOOL_IF_FUNC
Definition: item_func.h:294
@ JSON_EXTRACT_FUNC
Definition: item_func.h:344
@ TABLE_FUNC
Definition: item_func.h:265
@ MEMBER_OF_FUNC
Definition: item_func.h:331
@ 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:335
@ MONTHNAME_FUNC
Definition: item_func.h:302
@ 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:320
@ WEEKDAY_FUNC
Definition: item_func.h:316
@ ADDTIME_FUNC
Definition: item_func.h:313
@ DEGREES_FUNC
Definition: item_func.h:286
@ JSON_OVERLAPS
Definition: item_func.h:329
@ DAYOFYEAR_FUNC
Definition: item_func.h:312
@ 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:340
@ ATAN_FUNC
Definition: item_func.h:290
@ JSON_LENGTH_FUNC
Definition: item_func.h:342
@ DAYNAME_FUNC
Definition: item_func.h:304
@ DATETIME_LITERAL
Definition: item_func.h:324
@ MINUTE_FUNC
Definition: item_func.h:309
@ 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:305
@ WEEK_FUNC
Definition: item_func.h:315
@ YEARWEEK_FUNC
Definition: item_func.h:298
@ SP_CONTAINS_FUNC
Definition: item_func.h:239
@ FLOOR_FUNC
Definition: item_func.h:278
@ CASE_FUNC
Definition: item_func.h:296
@ COALESCE_FUNC
Definition: item_func.h:326
@ 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:321
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:648
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:535
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:449
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:735
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:359
@ OPTIMIZE_NONE
Definition: item_func.h:360
@ OPTIMIZE_EQUAL
Definition: item_func.h:364
@ OPTIMIZE_NULL
Definition: item_func.h:363
@ OPTIMIZE_KEY
Definition: item_func.h:361
@ OPTIMIZE_OP
Definition: item_func.h:362
void set_used_tables(table_map map)
Definition: item_func.h:529
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:718
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:662
bool agg_arg_charsets(DTCollation &c, Item **items, uint nitems, uint flags, int item_sep)
Definition: item_func.h:573
virtual bool is_deprecated() const
Definition: item_func.h:557
Item_func(const POS &pos, Item *a, Item *b, Item *c, Item *d, Item *e, Item *f)
Definition: item_func.h:474
enum Type type() const override
Definition: item_func.h:366
virtual Item * key_item() const
Definition: item_func.h:538
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:427
virtual bool may_have_named_parameters() const
Named parameters are allowed in a parameter list.
Definition: item_func.h:813
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:558
Item_func(Item *a, Item *b, Item *c, Item *d)
Definition: item_func.h:414
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:631
Item_func(const POS &pos, Item *a, Item *b)
Definition: item_func.h:389
virtual optimize_type select_optimize(const THD *)
Definition: item_func.h:536
bool has_date_args()
Definition: item_func.h:672
virtual const Item * get_arg(uint i) const
Get the i'th argument of the function that this object represents.
Definition: item_func.h:498
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:435
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:683
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:814
bool agg_arg_charsets_for_comparison(DTCollation &c, Item **items, uint nitems, int item_sep=1)
Definition: item_func.h:592
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:694
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:640
bool get_arg0_time(MYSQL_TIME *ltime)
Definition: item_func.h:561
Item_func(Item *a)
Definition: item_func.h:373
Item_func(mem_root_deque< Item * > *list)
Definition: item_func.h:485
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:527
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:499
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:458
table_map used_tables() const override
Definition: item_func.h:526
virtual bool contains_only_equi_join_condition() const
Whether this Item is an equi-join condition.
Definition: item_func.h:745
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:515
Item_func(Item *a, Item *b, Item *c)
Definition: item_func.h:395
uint allowed_arg_cols
Definition: item_func.h:191
Definition: item_func.h:1021
String * val_str(String *str) override
Definition: item_func.cc:1471
Item_int_func(const POS &pos, Item *a)
Definition: item_func.h:1029
Item_int_func(Item *a, Item *b, Item *c)
Definition: item_func.h:1040
Item_int_func(const POS &pos)
Definition: item_func.h:1024
Item_int_func(Item *a, Item *b)
Definition: item_func.h:1033
Item_int_func(const POS &pos, PT_item_list *opt_list)
Definition: item_func.h:1059
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_func.h:1069
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:1043
Item_int_func()
Definition: item_func.h:1023
Item_int_func(const POS &pos, Item *a, Item *b)
Definition: item_func.h:1036
Item_int_func(Item *a)
Definition: item_func.h:1028
Item_int_func(mem_root_deque< Item * > *list)
Definition: item_func.h:1056
Item_int_func(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_func.h:1051
enum Item_result result_type() const override
Definition: item_func.h:1073
Item_int_func(Item *a, Item *b, Item *c, Item *d)
Definition: item_func.h:1048
Item_int_func(THD *thd, Item_int_func *item)
Definition: item_func.h:1064
bool get_time(MYSQL_TIME *ltime) override
Definition: item_func.h:1072
Definition: item_func.h:2525
Item_master_pos_wait(const POS &pos, Item *a, Item *b)
Definition: item_func.h:2527
Item_master_pos_wait(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_func.h:2529
Item_master_pos_wait(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_func.h:2531
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:5276
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:993
String * str_op(String *) override
Performs the operation that this functions implements when the result type is a string type.
Definition: item_func.h:1007
Item_num_op(const POS &pos, Item *a, Item *b)
Definition: item_func.h:996
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:1001
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:1011
Item_num_op(Item *a, Item *b)
Definition: item_func.h:995
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:1015
Definition: item_func.h:833
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_func.h:865
longlong val_int() override
Definition: item_func.h:861
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:868
Item_real_func(Item *a, Item *b)
Definition: item_func.h:845
String * val_str(String *str) override
Definition: item_func.cc:844
Item_real_func(mem_root_deque< Item * > *list)
Definition: item_func.h:851
Item_real_func(const POS &pos)
Definition: item_func.h:836
Item_real_func(const POS &pos, Item *a)
Definition: item_func.h:841
enum Item_result result_type() const override
Definition: item_func.h:871
Item_real_func()
Definition: item_func.h:835
Item_real_func(const POS &pos, PT_item_list *list)
Definition: item_func.h:855
Item_real_func(Item *a)
Definition: item_func.h:840
Item_real_func(const POS &pos, Item *a, Item *b)
Definition: item_func.h:847
Item with result field.
Definition: item.h:5833
int raise_decimal_overflow()
Definition: item.h:5892
longlong raise_integer_overflow()
Definition: item.h:5887
longlong llrint_with_overflow_check(double realval)
Definition: item.h:5872
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item.cc:10776
double raise_float_overflow()
Definition: item.h:5882
A wrapper Item that normally returns its parameter, but becomes NULL when processing rows for rollup.
Definition: item_func.h:1719
const char * func_name() const override
Definition: item_func.h:1739
bool rollup_null() const
Definition: item_func.h:1764
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_func.cc:4194
table_map used_tables() const override
Definition: item_func.h:1740
TYPELIB * get_typelib() const override
Get the typelib information for an item of type set or enum.
Definition: item_func.cc:4216
String * val_str(String *str) override
Definition: item_func.cc:4161
bool val_json(Json_wrapper *result) override
Get a JSON value from an Item.
Definition: item_func.cc:4183
const int m_min_rollup_level
Definition: item_func.h:1780
bool eq_specific(const Item *item) const override
Provide a more specific equality check for a function.
Definition: item_func.cc:4211
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:1754
my_decimal * val_decimal(my_decimal *dec) override
Definition: item_func.cc:4172
Item_result result_type() const override
Definition: item_func.h:1753
Item_rollup_group_item(int min_rollup_level, Item *inner_item)
Definition: item_func.h:1721
void set_current_rollup_level(int level)
Definition: item_func.h:1774
int min_rollup_level() const
Definition: item_func.h:1777
int m_current_rollup_level
Definition: item_func.h:1781
longlong val_int() override
Definition: item_func.cc:4150
Item * inner_item()
Definition: item_func.h:1762
const Item * inner_item() const
Definition: item_func.h:1763
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_func.cc:4120
bool get_time(MYSQL_TIME *ltime) override
Definition: item_func.cc:4130
enum Functype functype() const override
Definition: item_func.h:1767
void update_used_tables() override
Updates used tables, not null tables information and accumulates properties up the item tree,...
Definition: item_func.h:1749
double val_real() override
Definition: item_func.cc:4139
Definition: item_func.h:2490
const char * func_name() const override
Definition: item_func.h:2504
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:2516
Item_source_pos_wait(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_func.h:2499
Item_source_pos_wait(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_func.h:2497
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:2505
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:2508
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:5218
String value
Definition: item_func.h:2492
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_func.cc:5205
Item_int_func super
Definition: item_func.h:2491
Item_source_pos_wait(const POS &pos, Item *a, Item *b)
Definition: item_func.h:2495
Definition: item.h:5665
Utility mixin class to be able to walk() only parts of item trees.
Definition: item.h:738
Definition: item_func.h:1131
Item_typecast_decimal(const POS &pos, Item *a, int len, int dec)
Definition: item_func.h:1136
longlong val_int() override
Definition: item_func.cc:2007
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_func.cc:2045
const char * func_name() const override
Definition: item_func.h:1157
enum Item_result result_type() const override
Definition: item_func.h:1150
void add_json_info(Json_object *obj) override
Add all the node-specific json fields.
Definition: item_func.cc:2059
String * val_str(String *str) override
Definition: item_func.cc:1992
my_decimal * val_decimal(my_decimal *) override
Definition: item_func.cc:2015
bool get_time(MYSQL_TIME *ltime) override
Definition: item_func.h:1146
double val_real() override
Definition: item_func.cc:1999
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_func.h:1143
enum Functype functype() const override
Definition: item_func.h:1158
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:1151
Class used to implement CAST to floating-point data types.
Definition: item_func.h:1166
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_func.cc:2118
void add_json_info(Json_object *obj) override
Add all the node-specific json fields.
Definition: item_func.h:1168
enum Item_result result_type() const override
Definition: item_func.h:1188
Item_typecast_real(const POS &pos, Item *a, bool as_double)
Definition: item_func.h:1174
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:1189
Item_typecast_real(Item *a)
Definition: item_func.h:1181
String * val_str(String *str) override
Definition: item_func.cc:2066
double val_real() override
Definition: item_func.cc:2070
longlong val_int() override
Definition: item_func.h:1184
const char * func_name() const override
Definition: item_func.h:1193
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_func.cc:2101
bool get_time(MYSQL_TIME *ltime) override
Definition: item_func.cc:2106
enum Functype functype() const override
Definition: item_func.h:1194
my_decimal * val_decimal(my_decimal *decimal_value) override
Definition: item_func.cc:2110
Definition: item_func.h:1105
const char * func_name() const override
Definition: item_func.h:1110
Item_typecast_signed(const POS &pos, Item *a)
Definition: item_func.h:1107
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_func.cc:1897
longlong val_int() override
Definition: item_func.cc:1928
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.cc:1904
enum Functype functype() const override
Definition: item_func.h:1115
Definition: item_func.h:1118
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_func.cc:1956
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.cc:1963
Item_typecast_unsigned(const POS &pos, Item *a)
Definition: item_func.h:1120
longlong val_int() override
Definition: item_func.cc:1969
const char * func_name() const override
Definition: item_func.h:1123
enum Functype functype() const override
Definition: item_func.h:1128
Definition: item_func.h:2241
Item_func super
Definition: item_func.h:2242
Item_udf_func(const POS &pos, udf_func *udf_arg, PT_item_list *opt_list)
Definition: item_func.h:2248
const char * func_name() const override
Definition: item_func.h:2255
bool may_have_named_parameters() const override
Named parameters are allowed in a parameter list.
Definition: item_func.h:2279
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:2266
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_func.cc:5090
bool fix_fields(THD *thd, Item **ref) override
Definition: item_func.cc:4613
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_func.cc:5084
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:2257
~Item_udf_func() override=default
Item_result result_type() const override
Definition: item_func.h:2262
udf_handler udf
Definition: item_func.h:2245
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_func.cc:5075
enum Functype functype() const override
Definition: item_func.h:2256
void compute_cost(CostOfItem *root_cost) const override
Compute the cost of evaluating this Item.
Definition: item_func.h:2274
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:2286
Definition: item_func.h:3418
bool get_date(MYSQL_TIME *, my_time_flags_t) override
Definition: item_func.h:3433
double val_real() override
Definition: item_func.cc:7143
void set_value(const char *str, size_t length, const CHARSET_INFO *cs)
Definition: item_func.cc:7135
longlong val_int() override
Definition: item_func.cc:7148
bool fix_fields(THD *thd, Item **ref) override
Definition: item_func.cc:7104
String * val_str(String *str) override
Definition: item_func.cc:7153
Name_string name
Definition: item_func.h:3419
Item_user_var_as_out_param(const POS &pos, Name_string a)
Definition: item_func.h:3423
enum Type type() const override
Definition: item_func.h:3428
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_func.cc:7163
bool get_time(MYSQL_TIME *) override
Definition: item_func.h:3437
void set_null_value(const CHARSET_INFO *cs)
Definition: item_func.cc:7129
my_decimal * val_decimal(my_decimal *decimal_buffer) override
Definition: item_func.cc:7158
user_var_entry * entry
Definition: item_func.h:3420
Common class for: Item_func_get_system_var Item_func_get_user_var Item_func_set_user_var.
Definition: item_func.h:3066
Item_var_func(const POS &pos, Item *a)
Definition: item_func.h:3074
bool get_time(MYSQL_TIME *ltime) override
Definition: item_func.h:3079
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_func.h:3076
Item_var_func()
Definition: item_func.h:3068
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:3082
Item_var_func(THD *thd, Item_var_func *item)
Definition: item_func.h:3071
Item_var_func(Item *a)
Definition: item_func.h:3073
Item_var_func(const POS &pos)
Definition: item_func.h:3069
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:3579
void set_nullable(bool nullable)
Definition: item.h:3691
DTCollation collation
Character set and collation properties assigned for this Item.
Definition: item.h:3586
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:3690
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:3438
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:3587
bool fixed
True if item has been resolved.
Definition: item.h:3679
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:3716
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:3757
void set_accum_properties(const Item *item)
Set accumulated properties for an Item.
Definition: item.h:3433
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:3484
bool unsigned_flag
Definition: item.h:3717
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:3727
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:3604
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:7539
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:3821
std::function< bool(Item_func_match *)> m_func
Definition: item_func.h:3828
bool operator()(Item *item)
Definition: item_func.cc:8021
NonAggregatedFullTextSearchVisitor(std::function< bool(Item_func_match *)> func)
Definition: item_func.cc:8017
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:345
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:1174
Definition: field.h:4644
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:2904
TABLE * table
Definition: table.h:3684
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:4965
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:389
Definition: sp_head.h:124
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:3096
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:3113
static const size_t extra_size
Definition: item_func.h:3185
Simple_cstring entry_name
Definition: item_func.h:3210
Item_result m_type
Value type.
Definition: item_func.h:3188
size_t m_length
Value length.
Definition: item_func.h:3187
longlong val_int(bool *null_value) const
Get the value of a variable as an integer.
Definition: item_func.cc:6309
bool unsigned_flag
Definition: item_func.h:3212
THD * m_owner
Definition: item_func.h:3189
size_t length() const
Definition: item_func.h:3284
query_id_t used_query_id() const
Definition: item_func.h:3254
THD * owner_session() const
Definition: item_func.h:3208
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:6152
void set_value(char *value, size_t length)
Definition: item_func.h:3101
String * val_str(bool *null_value, String *str, uint decimals) const
Get the value of a variable as a string.
Definition: item_func.cc:6348
user_var_entry()=default
const char * ptr() const
Definition: item_func.h:3283
void free_value()
Free the external value buffer, if it's allocated.
Definition: item_func.h:3141
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:6199
void init(THD *thd, const Simple_cstring &name, const CHARSET_INFO *cs)
Initialize all members.
Definition: item_func.cc:6187
Item_result type() const
The data type of this variable.
Definition: item_func.h:3286
void destroy()
Free all memory used by a user_var_entry instance previously created by create().
Definition: item_func.h:3273
bool alloced()
Check if m_ptr points to an external buffer previously allocated by realloc().
Definition: item_func.h:3136
void lock()
Definition: item_func.cc:6239
void unlock()
Definition: item_func.cc:6244
void set_null_value(Item_result type)
Set value to NULL.
Definition: item_func.h:3246
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:3149
DTCollation collation
Definition: item_func.h:3211
void set_type(Item_result type)
Set type of to the given value.
Definition: item_func.h:3237
char * m_ptr
Value.
Definition: item_func.h:3186
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:3203
void assert_locked() const
Assert the user variable is locked.
Definition: item_func.cc:6224
void reset_value()
Definition: item_func.h:3097
char * name_ptr()
Position inside a user_var_entry where a null-terminates array of characters representing the variabl...
Definition: item_func.h:3121
double val_real(bool *null_value) const
Get the value of a variable as a double.
Definition: item_func.cc:6280
my_decimal * val_decimal(bool *null_value, my_decimal *result) const
Get the value of a variable as a decimal.
Definition: item_func.cc:6380
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:6169
void set_used_query_id(query_id_t query_id)
Definition: item_func.h:3253
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:285
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:2797
bool agg_item_charsets_for_string_result(DTCollation &c, const char *name, Item **items, uint nitems, int item_sep=1)
Definition: item.h:4099
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:4106
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:183
void item_func_sleep_free()
Definition: item_func.cc:5941
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:5401
double my_double_round(double value, longlong dec, bool dec_unsigned, bool truncate)
Definition: item_func.cc:3529
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:5931
void mysql_ull_cleanup(THD *thd)
Release all user level locks for this THD.
Definition: item_func.cc:5383
void retrieve_tablespace_statistics(THD *thd, Item **args, bool *null_value)
Retrieve tablespace statistics from SE.
Definition: item_func.cc:9740
bool volatile mqh_used
Definition: mysqld.cc:1318
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:8088
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:8659
A better implementation of the UNIX ctype(3) library.
MYSQL_STRINGS_EXPORT CHARSET_INFO my_charset_bin
Definition: ctype-bin.cc:499
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:257
It is interface module to fixed precision decimals library.
int double2my_decimal(uint mask, double val, my_decimal *d)
Definition: my_decimal.h:325
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:903
thread_local MEM_ROOT ** THR_MALLOC
Definition: mysqld.cc:1579
static bool replace
Definition: mysqlimport.cc:70
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1084
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
ValueType value(const std::optional< ValueType > &v)
Definition: gtid.h:83
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::string truncate(const std::string &str, const size_t max_length)
Truncates the given string to max_length code points.
Definition: utils_string.cc:418
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:200
@ VGS_CHECK_CONSTRAINT
Definition: field.h:474
@ VGS_GENERATED_COLUMN
Definition: field.h:472
Derivation
For use.
Definition: field.h:177
#define HA_CAN_FULLTEXT_EXT
Definition: handler.h:426
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:3068
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:421
Definition: table.h:1425
handler * file
Definition: table.h:1427
Definition: typelib.h:35
Definition: completion_hash.h:35
void(* close_search)(FT_INFO *)
Definition: ft_global.h:51
Definition: mysql_com.h:1110
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