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