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