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