MySQL 26.10.0
Source Code Documentation
item_strfunc.h
Go to the documentation of this file.
1/* Copyright (c) 2000, 2026, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is designed to work with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24/* This file defines all string functions */
25#ifndef ITEM_STRFUNC_INCLUDED
26#define ITEM_STRFUNC_INCLUDED
27
28#include <assert.h>
29#include <sys/types.h>
30
31#include <cstdint> // uint32_t
32
33#include "lex_string.h"
34#include "mysql/gtid/uuid.h" // Uuid
35
36#include "my_hostname.h" // HOSTNAME_LENGTH
37#include "my_inttypes.h"
38#include "my_table_map.h"
39#include "my_time.h"
42#include "mysql_com.h"
43#include "mysql_time.h"
45#include "sql/enum_query_type.h"
46#include "sql/field.h"
47#include "sql/item.h"
48#include "sql/item_cmpfunc.h" // Item_bool_func
49#include "sql/item_func.h" // Item_func
50#include "sql/parse_location.h" // POS
51#include "sql/sql_const.h"
52#include "sql_string.h"
53#include "template_utils.h" // pointer_cast
54
55#include <openssl/evp.h>
56
57class MY_LOCALE;
58class PT_item_list;
59class THD;
60class my_decimal;
61struct Parse_context;
62
63template <class T>
64class List;
65
67 const char *name, CHARSET_INFO *name_cs = system_charset_info);
68
69/**
70 Generate Universal Unique Identifier (UUID).
71
72 @param str Pointer to string which will hold the UUID.
73
74 @return str Pointer to string which contains the UUID.
75*/
76
78
79class Item_str_func : public Item_func {
81
82 public:
84
85 explicit Item_str_func(const POS &pos) : super(pos) {}
86
88
89 Item_str_func(const POS &pos, Item *a) : Item_func(pos, a) {}
90
91 Item_str_func(Item *a, Item *b) : Item_func(a, b) {}
92
93 Item_str_func(const POS &pos, Item *a, Item *b) : Item_func(pos, a, b) {}
94
95 Item_str_func(Item *a, Item *b, Item *c) : Item_func(a, b, c) {}
96
97 Item_str_func(const POS &pos, Item *a, Item *b, Item *c)
98 : Item_func(pos, a, b, c) {}
99
100 Item_str_func(Item *a, Item *b, Item *c, Item *d) : Item_func(a, b, c, d) {}
101
102 Item_str_func(const POS &pos, Item *a, Item *b, Item *c, Item *d)
103 : Item_func(pos, a, b, c, d) {}
104
105 Item_str_func(Item *a, Item *b, Item *c, Item *d, Item *e)
106 : Item_func(a, b, c, d, e) {}
107
108 Item_str_func(const POS &pos, Item *a, Item *b, Item *c, Item *d, Item *e)
109 : Item_func(pos, a, b, c, d, e) {}
110 Item_str_func(const POS &pos, Item *a, Item *b, Item *c, Item *d, Item *e,
111 Item *f)
112 : Item_func(pos, a, b, c, d, e, f) {}
114
115 Item_str_func(const POS &pos, PT_item_list *opt_list)
116 : Item_func(pos, opt_list) {}
117
118 longlong val_int() override { return val_int_from_string(); }
119 double val_real() override { return val_real_from_string(); }
120 my_decimal *val_decimal(my_decimal *) override;
121 bool val_date(Date_val *date, my_time_flags_t flags) override {
122 return get_date_from_string(date, flags);
123 }
124 bool val_time(Time_val *time) override { return get_time_from_string(time); }
127 }
128 enum Item_result result_type() const override { return STRING_RESULT; }
129 void left_right_max_length(THD *thd);
130 bool fix_fields(THD *thd, Item **ref) override;
131 bool resolve_type(THD *thd) override {
132 if (param_type_is_default(thd, 0, -1)) return true;
133 return false;
134 }
136
137 protected:
138 /**
139 Calls push_warning_printf for packet overflow.
140 @return error_str().
141 */
142 String *push_packet_overflow_warning(THD *thd, const char *func);
143
144 void add_json_info(Json_object *obj) override {
145 obj->add_alias("func_name", create_dom_ptr<Json_string>(func_name()));
146 }
147};
148
149/*
150 Functions that return values with ASCII repertoire
151*/
154
155 public:
158 }
159
162 }
163 Item_str_ascii_func(const POS &pos, Item *a) : Item_str_func(pos, a) {
165 }
166
169 }
170 Item_str_ascii_func(const POS &pos, Item *a, Item *b)
171 : Item_str_func(pos, a, b) {
173 }
174
177 }
178 Item_str_ascii_func(const POS &pos, Item *a, Item *b, Item *c)
179 : Item_str_func(pos, a, b, c) {
181 }
182
183 String *val_str(String *str) override {
185 }
186 String *val_str_ascii(String *) override = 0;
187};
188
190 public:
191 Item_func_sha2(const POS &pos, Item *a, Item *b)
192 : Item_str_ascii_func(pos, a, b) {}
193 String *val_str_ascii(String *) override;
194 bool resolve_type(THD *thd) override;
195 const char *func_name() const override { return "sha2"; }
196};
197
200
201 public:
202 Item_func_to_base64(const POS &pos, Item *a) : Item_str_ascii_func(pos, a) {}
204 String *val_str_ascii(String *) override;
205 bool resolve_type(THD *) override;
206 const char *func_name() const override { return "to_base64"; }
207};
208
210 public:
211 Item_func_statement_digest(const POS &pos, Item *query_string)
212 : Item_str_ascii_func(pos, query_string) {}
213
214 const char *func_name() const override { return "statement_digest"; }
215 bool check_function_as_value_generator(uchar *checker_args) override {
217 pointer_cast<Check_function_as_value_generator_parameters *>(
218 checker_args);
219 func_arg->banned_function_name = func_name();
220 return (func_arg->source == VGS_GENERATED_COLUMN);
221 }
222
223 bool resolve_type(THD *thd) override;
224
225 String *val_str_ascii(String *) override;
226
227 private:
229};
230
232 public:
233 Item_func_statement_digest_text(const POS &pos, Item *query_string)
234 : Item_str_func(pos, query_string) {}
235
236 const char *func_name() const override { return "statement_digest_text"; }
237
238 /**
239 The type is always LONGTEXT, just like the digest_text columns in
240 Performance Schema
241 */
242 bool resolve_type(THD *thd) override;
243
244 bool check_function_as_value_generator(uchar *checker_args) override {
246 pointer_cast<Check_function_as_value_generator_parameters *>(
247 checker_args);
248 func_arg->banned_function_name = func_name();
249 return (func_arg->source == VGS_GENERATED_COLUMN);
250 }
251 String *val_str(String *) override;
252
253 private:
255};
256
259
260 public:
261 Item_func_from_base64(const POS &pos, Item *a) : Item_str_func(pos, a) {}
262 String *val_str(String *) override;
263 bool resolve_type(THD *thd) override;
264 const char *func_name() const override { return "from_base64"; }
265};
266
270 EVP_CIPHER_CTX *ctx{nullptr};
271
272 public:
273 Item_func_aes_encrypt(const POS &pos, Item *a, Item *b)
274 : Item_str_func(pos, a, b) {
276 }
277 Item_func_aes_encrypt(const POS &pos, Item *a, Item *b, Item *c)
278 : Item_str_func(pos, a, b, c) {
280 }
281 Item_func_aes_encrypt(const POS &pos, Item *a, Item *b, Item *c, Item *d)
282 : Item_str_func(pos, a, b, c, d) {
284 }
285 Item_func_aes_encrypt(const POS &pos, Item *a, Item *b, Item *c, Item *d,
286 Item *e)
287 : Item_str_func(pos, a, b, c, d, e) {
289 }
290 Item_func_aes_encrypt(const POS &pos, Item *a, Item *b, Item *c, Item *d,
291 Item *e, Item *f)
292 : Item_str_func(pos, a, b, c, d, e, f) {
294 }
296
297 void create_op_context();
298 void destroy_op_context();
299 bool do_itemize(Parse_context *pc, Item **res) override;
300 String *val_str(String *) override;
301 bool resolve_type(THD *) override;
302 const char *func_name() const override { return "aes_encrypt"; }
303};
304
307 EVP_CIPHER_CTX *ctx{nullptr};
308
309 public:
310 Item_func_aes_decrypt(const POS &pos, Item *a, Item *b)
311 : Item_str_func(pos, a, b) {
313 }
314 Item_func_aes_decrypt(const POS &pos, Item *a, Item *b, Item *c)
315 : Item_str_func(pos, a, b, c) {
317 }
318 Item_func_aes_decrypt(const POS &pos, Item *a, Item *b, Item *c, Item *d)
319 : Item_str_func(pos, a, b, c, d) {
321 }
322 Item_func_aes_decrypt(const POS &pos, Item *a, Item *b, Item *c, Item *d,
323 Item *e)
324 : Item_str_func(pos, a, b, c, d, e) {
326 }
327 Item_func_aes_decrypt(const POS &pos, Item *a, Item *b, Item *c, Item *d,
328 Item *e, Item *f)
329 : Item_str_func(pos, a, b, c, d, e, f) {
331 }
333
334 void create_op_context();
335 void destroy_op_context();
336 bool do_itemize(Parse_context *pc, Item **res) override;
337 String *val_str(String *) override;
338 bool resolve_type(THD *thd) override;
339 const char *func_name() const override { return "aes_decrypt"; }
340};
341
344
345 /** limitation from the SSL library */
347
348 public:
349 Item_func_random_bytes(const POS &pos, Item *a) : Item_str_func(pos, a) {}
350
351 bool do_itemize(Parse_context *pc, Item **res) override;
352 bool resolve_type(THD *thd) override;
353 String *val_str(String *a) override;
354
355 const char *func_name() const override { return "random_bytes"; }
357 return RAND_TABLE_BIT;
358 }
359};
360
362 String tmp_value{"", 0, collation.collation}; // Initialize to empty
363 public:
364 Item_func_concat(const POS &pos, PT_item_list *opt_list)
365 : Item_str_func(pos, opt_list) {}
367 Item_func_concat(const POS &pos, Item *a, Item *b)
368 : Item_str_func(pos, a, b) {}
369
370 String *val_str(String *) override;
371 bool resolve_type(THD *thd) override;
372 const char *func_name() const override { return "concat"; }
373};
374
376 String tmp_value{"", 0, collation.collation}; // Initialize to empty
377 public:
380 null_on_null = false;
381 }
382 Item_func_concat_ws(const POS &pos, PT_item_list *opt_list)
383 : Item_str_func(pos, opt_list) {
384 null_on_null = false;
385 }
386 String *val_str(String *) override;
387 bool resolve_type(THD *thd) override;
388 const char *func_name() const override { return "concat_ws"; }
389};
390
391/**
392 This class represents the function ETAG which is used to traverse the input
393 arguments and compute a 128 bits hash value.
394 */
397
398 public:
399 Item_func_etag(const POS &pos, PT_item_list *opt_list)
400 : Item_str_func(pos, opt_list) {}
402
403 String *val_str(String *) override;
404 bool resolve_type(THD *thd) override;
405 const char *func_name() const override { return "etag"; }
406 bool check_function_as_value_generator(uchar *checker_args) override {
408 pointer_cast<Check_function_as_value_generator_parameters *>(
409 checker_args);
410 func_arg->banned_function_name = func_name();
411 return ((func_arg->source == VGS_GENERATED_COLUMN) ||
412 (func_arg->source == VGS_CHECK_CONSTRAINT));
413 }
414};
415
418
419 public:
421 Item_func_reverse(const POS &pos, Item *a) : Item_str_func(pos, a) {}
422
423 String *val_str(String *) override;
424 bool resolve_type(THD *thd) override;
425 const char *func_name() const override { return "reverse"; }
426};
427
430 /// Holds result in case we need to allocate our own result buffer.
432
433 public:
435 : Item_str_func(pos, org, find, replace) {}
436 String *val_str(String *) override;
437 bool resolve_type(THD *thd) override;
438 const char *func_name() const override { return "replace"; }
439};
440
443 /// Holds result in case we need to allocate our own result buffer.
445
446 public:
448 Item *new_str)
449 : Item_str_func(pos, org, start, length, new_str) {}
450 String *val_str(String *) override;
451 bool resolve_type(THD *thd) override;
452 const char *func_name() const override { return "insert"; }
453};
454
456 protected:
460
461 public:
462 Item_str_conv(const POS &pos, Item *item) : Item_str_func(pos, item) {}
463 String *val_str(String *) override;
464};
465
467 public:
468 Item_func_lower(const POS &pos, Item *item) : Item_str_conv(pos, item) {}
469 const char *func_name() const override { return "lower"; }
470 bool resolve_type(THD *) override;
471};
472
474 public:
475 Item_func_upper(const POS &pos, Item *item) : Item_str_conv(pos, item) {}
476 const char *func_name() const override { return "upper"; }
477 bool resolve_type(THD *) override;
478};
479
482
483 public:
484 Item_func_left(const POS &pos, Item *a, Item *b) : Item_str_func(pos, a, b) {}
485 String *val_str(String *) override;
486 bool resolve_type(THD *thd) override;
487 const char *func_name() const override { return "left"; }
488};
489
492
493 public:
494 Item_func_right(const POS &pos, Item *a, Item *b)
495 : Item_str_func(pos, a, b) {}
496 String *val_str(String *) override;
497 bool resolve_type(THD *thd) override;
498 const char *func_name() const override { return "right"; }
499};
500
503
505
506 public:
508 Item_func_substr(const POS &pos, Item *a, Item *b) : super(pos, a, b) {}
509
510 Item_func_substr(Item *a, Item *b, Item *c) : Item_str_func(a, b, c) {}
511 Item_func_substr(const POS &pos, Item *a, Item *b, Item *c)
512 : super(pos, a, b, c) {}
513
514 String *val_str(String *) override;
515 bool resolve_type(THD *thd) override;
516 const char *func_name() const override { return "substr"; }
517};
518
521
522 public:
523 Item_func_substr_index(const POS &pos, Item *a, Item *b, Item *c)
524 : Item_str_func(pos, a, b, c) {}
525 String *val_str(String *) override;
526 bool resolve_type(THD *) override;
527 const char *func_name() const override { return "substring_index"; }
528};
529
531 public:
532 /**
533 Why all the trim modes in this enum?
534 We need to maintain parsing information, so that our print() function
535 can reproduce correct messages and view definitions.
536 */
544 };
545
546 private:
550 const bool m_trim_leading;
551 const bool m_trim_trailing;
552
553 public:
555 : Item_str_func(a, b),
556 m_trim_mode(tm),
559
560 Item_func_trim(const POS &pos, Item *a, Item *b, TRIM_MODE tm)
561 : Item_str_func(pos, a, b),
562 m_trim_mode(tm),
565
567 : Item_str_func(a),
568 m_trim_mode(tm),
571
572 Item_func_trim(const POS &pos, Item *a, TRIM_MODE tm)
573 : Item_str_func(pos, a),
574 m_trim_mode(tm),
577
578 bool trim_leading() const {
581 }
582
583 bool trim_trailing() const {
586 }
587
588 String *val_str(String *) override;
589 bool resolve_type(THD *) override;
590 const char *func_name() const override {
591 switch (m_trim_mode) {
593 return "trim";
594 case TRIM_BOTH:
595 return "trim";
596 case TRIM_LEADING:
597 return "ltrim";
598 case TRIM_TRAILING:
599 return "rtrim";
600 case TRIM_LTRIM:
601 return "ltrim";
602 case TRIM_RTRIM:
603 return "rtrim";
604 }
605 return nullptr;
606 }
607 void print(const THD *thd, String *str,
608 enum_query_type query_type) const override;
609};
610
611class Item_func_ltrim final : public Item_func_trim {
612 public:
613 Item_func_ltrim(const POS &pos, Item *a)
614 : Item_func_trim(pos, a, TRIM_LTRIM) {}
615};
616
617class Item_func_rtrim final : public Item_func_trim {
618 public:
619 Item_func_rtrim(const POS &pos, Item *a)
620 : Item_func_trim(pos, a, TRIM_RTRIM) {}
621};
622
625
626 public:
629 }
630 explicit Item_func_sysconst(const POS &pos) : super(pos) {
632 }
633 /*
634 Used to create correct Item name in new converted item in
635 safe_charset_converter, return string representation of this function
636 call
637 */
638 virtual const Name_string fully_qualified_func_name() const = 0;
639 bool check_function_as_value_generator(uchar *checker_args) override {
641 pointer_cast<Check_function_as_value_generator_parameters *>(
642 checker_args);
643 func_arg->banned_function_name = func_name();
644 return ((func_arg->source == VGS_GENERATED_COLUMN) ||
645 (func_arg->source == VGS_CHECK_CONSTRAINT));
646 }
647};
648
651
652 public:
653 explicit Item_func_database(const POS &pos) : Item_func_sysconst(pos) {}
654
655 bool do_itemize(Parse_context *pc, Item **res) override;
656
657 String *val_str(String *) override;
658 bool resolve_type(THD *) override {
660 set_nullable(true);
661 return false;
662 }
663 const char *func_name() const override { return "database"; }
664 const Name_string fully_qualified_func_name() const override {
665 return NAME_STRING("database()");
666 }
667};
668
671
672 protected:
673 /// True when function value is evaluated, set to false after each execution
674 bool m_evaluated = false;
675
676 /// Evaluate user name, must be called once per execution
677 bool evaluate(const char *user, const char *host);
678 type_conversion_status save_in_field_inner(Field *field, bool) override;
679
680 public:
682 explicit Item_func_user(const POS &pos) : super(pos) {
684 }
685
687 return INNER_TABLE_BIT;
688 }
689
690 bool do_itemize(Parse_context *pc, Item **res) override;
691
692 bool check_function_as_value_generator(uchar *checker_args) override {
694 pointer_cast<Check_function_as_value_generator_parameters *>(
695 checker_args);
696 func_arg->banned_function_name = func_name();
697 return ((func_arg->source == VGS_GENERATED_COLUMN) ||
698 (func_arg->source == VGS_CHECK_CONSTRAINT));
699 }
700 bool resolve_type(THD *) override {
702 return false;
703 }
704 void cleanup() override {
705 m_evaluated = false;
708 }
709 const char *func_name() const override { return "user"; }
710 const Name_string fully_qualified_func_name() const override {
711 return NAME_STRING("user()");
712 }
713
714 String *val_str(String *) override;
715};
716
719 /**
720 Used to pass a security context to the resolver functions.
721 Only used for definer views. In all other contexts, the security context
722 passed here is nullptr and is instead looked up dynamically at run time
723 from the current THD.
724 */
726
727 /// Copied from m_name_resolution_ctx in fix_fields if the definer
728 /// Security_context is set in Name_resolution_context
731
732 protected:
733 type_conversion_status save_in_field_inner(Field *field, bool) override;
734
735 /// Overridden to copy definer priv_user and priv_host
736 bool resolve_type(THD *) override;
737
738 public:
739 explicit Item_func_current_user(const POS &pos) : super(pos) {}
740
741 bool do_itemize(Parse_context *pc, Item **res) override;
742 const char *func_name() const override { return "current_user"; }
743 const Name_string fully_qualified_func_name() const override {
744 return NAME_STRING("current_user()");
745 }
746
747 String *val_str(String *) override;
748};
749
752
753 public:
755 Item_func_soundex(const POS &pos, Item *a) : Item_str_func(pos, a) {}
756 String *val_str(String *) override;
757 bool resolve_type(THD *thd) override;
758 const char *func_name() const override { return "soundex"; }
759};
760
761class Item_func_elt final : public Item_str_func {
762 public:
763 Item_func_elt(const POS &pos, PT_item_list *opt_list)
764 : Item_str_func(pos, opt_list) {}
765 double val_real() override;
766 longlong val_int() override;
767 String *val_str(String *str) override;
768 bool resolve_type(THD *thd) override;
769 const char *func_name() const override { return "elt"; }
770};
771
772class Item_func_make_set final : public Item_str_func {
774
776
777 public:
778 Item_func_make_set(const POS &pos, PT_item_list *opt_list)
779 : Item_str_func(pos, opt_list) {}
780
781 String *val_str(String *str) override;
782 bool fix_fields(THD *thd, Item **ref) override;
783 bool resolve_type(THD *) override;
784 const char *func_name() const override { return "make_set"; }
785
786 void print(const THD *thd, String *str,
787 enum_query_type query_type) const override;
788};
789
793
794 public:
795 Item_func_format(const POS &pos, Item *org, Item *dec)
796 : Item_str_ascii_func(pos, org, dec) {}
797 Item_func_format(const POS &pos, Item *org, Item *dec, Item *lang)
798 : Item_str_ascii_func(pos, org, dec, lang) {}
799
800 MY_LOCALE *get_locale(Item *item);
801 String *val_str_ascii(String *) override;
802 bool resolve_type(THD *thd) override;
803 const char *func_name() const override { return "format"; }
804 void print(const THD *thd, String *str,
805 enum_query_type query_type) const override;
806};
807
808class Item_func_char final : public Item_str_func {
809 public:
811 : Item_str_func(pos, list) {
813 null_on_null = false;
814 }
816 : Item_str_func(pos, list) {
818 null_on_null = false;
819 }
820 String *val_str(String *) override;
821 bool resolve_type(THD *thd) override {
822 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_LONGLONG)) return true;
823 if (reject_vector_args()) return true;
825 return false;
826 }
827 const char *func_name() const override { return "char"; }
828 void add_json_info(Json_object *obj) override {
830 obj->add_alias("charset",
831 create_dom_ptr<Json_string>(collation.collation->csname));
832 }
833};
834
835class Item_func_repeat final : public Item_str_func {
837
838 public:
839 Item_func_repeat(const POS &pos, Item *arg1, Item *arg2)
840 : Item_str_func(pos, arg1, arg2) {}
841 String *val_str(String *) override;
842 bool resolve_type(THD *thd) override;
843 const char *func_name() const override { return "repeat"; }
844};
845
846class Item_func_space final : public Item_str_func {
847 public:
848 Item_func_space(const POS &pos, Item *arg1) : Item_str_func(pos, arg1) {}
849 String *val_str(String *) override;
850 bool resolve_type(THD *) override;
851 const char *func_name() const override { return "space"; }
852};
853
854class Item_func_rpad final : public Item_str_func {
856
857 public:
858 Item_func_rpad(const POS &pos, Item *arg1, Item *arg2, Item *arg3)
859 : Item_str_func(pos, arg1, arg2, arg3) {}
860 String *val_str(String *) override;
861 bool resolve_type(THD *) override;
862 const char *func_name() const override { return "rpad"; }
863};
864
865class Item_func_lpad final : public Item_str_func {
867
868 public:
869 Item_func_lpad(const POS &pos, Item *arg1, Item *arg2, Item *arg3)
870 : Item_str_func(pos, arg1, arg2, arg3) {}
871 String *val_str(String *) override;
872 bool resolve_type(THD *) override;
873 const char *func_name() const override { return "lpad"; }
874};
875
877 /// Buffer to store the binary result
879
880 public:
881 Item_func_uuid_to_bin(const POS &pos, Item *arg1)
882 : Item_str_func(pos, arg1) {}
883 Item_func_uuid_to_bin(const POS &pos, Item *arg1, Item *arg2)
884 : Item_str_func(pos, arg1, arg2) {}
885 String *val_str(String *) override;
886 bool resolve_type(THD *) override;
887 const char *func_name() const override { return "uuid_to_bin"; }
888};
889
891 /// Buffer to store the text result
893
894 public:
895 Item_func_bin_to_uuid(const POS &pos, Item *arg1)
896 : Item_str_ascii_func(pos, arg1) {}
897 Item_func_bin_to_uuid(const POS &pos, Item *arg1, Item *arg2)
898 : Item_str_ascii_func(pos, arg1, arg2) {}
899 String *val_str_ascii(String *) override;
900 bool resolve_type(THD *thd) override;
901 const char *func_name() const override { return "bin_to_uuid"; }
902};
903
904class Item_func_is_uuid final : public Item_bool_func {
906
907 public:
908 Item_func_is_uuid(const POS &pos, Item *a) : Item_bool_func(pos, a) {}
909 longlong val_int() override;
910 const char *func_name() const override { return "is_uuid"; }
911 bool resolve_type(THD *thd) override {
912 if (reject_vector_args()) return true;
913 bool res = super::resolve_type(thd);
914 set_nullable(true);
915 return res;
916 }
917};
918
919class Item_func_conv final : public Item_str_func {
920 public:
921 // 64 digits plus possible '-'.
922 static constexpr uint32_t CONV_MAX_LENGTH = 64U + 1U;
923 Item_func_conv(const POS &pos, Item *a, Item *b, Item *c)
924 : Item_str_func(pos, a, b, c) {}
925 const char *func_name() const override { return "conv"; }
926 String *val_str(String *) override;
927 bool resolve_type(THD *) override;
928};
929
932
933 public:
934 Item_func_hex(const POS &pos, Item *a) : Item_str_ascii_func(pos, a) {}
935 const char *func_name() const override { return "hex"; }
936 String *val_str_ascii(String *) override;
937 bool resolve_type(THD *thd) override;
938};
939
940class Item_func_unhex final : public Item_str_func {
942
943 public:
944 Item_func_unhex(const POS &pos, Item *a) : Item_str_func(pos, a) {
945 /* there can be bad hex strings */
946 set_nullable(true);
947 }
948 const char *func_name() const override { return "unhex"; }
949 String *val_str(String *) override;
950 bool resolve_type(THD *thd) override;
951};
952
953#ifndef NDEBUG
955 protected:
958 const bool is_min;
959
960 public:
961 Item_func_like_range(const POS &pos, Item *a, Item *b, bool is_min_arg)
962 : Item_str_func(pos, a, b), is_min(is_min_arg) {
963 set_nullable(true);
964 }
965 String *val_str(String *) override;
966 bool resolve_type(THD *thd) override {
967 if (param_type_is_default(thd, 0, 1)) return true;
968 if (param_type_is_default(thd, 1, 2, MYSQL_TYPE_LONGLONG)) return true;
969 if (reject_vector_args()) return true;
971 return false;
972 }
973};
974
976 public:
978 : Item_func_like_range(pos, a, b, true) {}
979 const char *func_name() const override { return "like_range_min"; }
980};
981
983 public:
985 : Item_func_like_range(pos, a, b, false) {}
986 const char *func_name() const override { return "like_range_max"; }
987};
988#endif
989
990/**
991 The following types of conversions are considered safe:
992
993 Conversion to and from "binary".
994 Conversion to Unicode.
995 Other kind of conversions are potentially lossy.
996*/
998 protected:
999 /// If true, conversion is needed so do it, else allow string copy.
1001 /// The character set we are converting to
1003 /// The character set we are converting from
1004 const CHARSET_INFO *m_from_cs{nullptr};
1006 /// Marks whether the underlying Item is constant and may be cached.
1008 /// Length argument value, if any given.
1009 longlong m_cast_length{-1}; // a priori not used
1010 public:
1012
1013 protected:
1014 /**
1015 Helper for CAST and CONVERT type resolution: common logic to compute the
1016 maximum numbers of characters of the type of the conversion.
1017
1018 @returns the maximum numbers of characters possible after the conversion
1019 */
1021
1022 bool resolve_type(THD *thd) override;
1023
1024 void add_json_info(Json_object *obj) override {
1026 obj->add_alias("charset", create_dom_ptr<Json_string>(m_cast_cs->csname));
1027 }
1028
1029 public:
1031 bool cache_if_const)
1032 : Item_str_func(a), m_cast_cs(cs_arg) {
1033 if (cache_if_const && args[0]->may_evaluate_const(thd)) {
1034 uint errors = 0;
1035 String tmp, *str = args[0]->val_str(&tmp);
1036 if (!str || str_value.copy(str->ptr(), str->length(), str->charset(),
1037 m_cast_cs, &errors))
1038 null_value = true;
1039 m_use_cached_value = true;
1041 m_safe = (errors == 0);
1042 } else {
1043 m_use_cached_value = false;
1044 // Marks whether the conversion is safe
1046 cs_arg == &my_charset_bin || (cs_arg->state & MY_CS_UNICODE));
1047 }
1048 }
1049 Item_charset_conversion(const POS &pos, Item *a, const CHARSET_INFO *cs_arg)
1050 : Item_str_func(pos, a), m_cast_cs(cs_arg) {}
1051
1052 String *val_str(String *) override;
1053};
1054
1056 protected:
1057 void add_json_info(Json_object *obj) override;
1058
1059 public:
1060 Item_typecast_char(THD *thd, Item *a, longlong length_arg,
1061 const CHARSET_INFO *cs_arg)
1062 : Item_charset_conversion(thd, a, cs_arg, false) {
1063 m_cast_length = length_arg;
1064 }
1065 Item_typecast_char(const POS &pos, Item *a, longlong length_arg,
1066 const CHARSET_INFO *cs_arg)
1067 : Item_charset_conversion(pos, a, cs_arg) {
1068 m_cast_length = length_arg;
1069 }
1070 enum Functype functype() const override { return TYPECAST_FUNC; }
1071 bool eq_specific(const Item *item) const override;
1072 const char *func_name() const override { return "cast_as_char"; }
1073 void print(const THD *thd, String *str,
1074 enum_query_type query_type) const override;
1075};
1076
1077class Item_load_file final : public Item_str_func {
1079
1081
1082 public:
1083 Item_load_file(const POS &pos, Item *a) : Item_str_func(pos, a) {}
1084
1085 bool do_itemize(Parse_context *pc, Item **res) override;
1086 String *val_str(String *) override;
1087 const char *func_name() const override { return "load_file"; }
1089 return INNER_TABLE_BIT;
1090 }
1091 bool resolve_type(THD *thd) override {
1092 if (param_type_is_default(thd, 0, 1)) return true;
1093 if (reject_vector_args()) return true;
1096 set_nullable(true);
1097 return false;
1098 }
1099 bool check_function_as_value_generator(uchar *checker_args) override {
1101 pointer_cast<Check_function_as_value_generator_parameters *>(
1102 checker_args);
1103 func_arg->banned_function_name = func_name();
1104 return true;
1105 }
1106};
1107
1109 public:
1110 Item_func_export_set(const POS &pos, Item *a, Item *b, Item *c)
1111 : Item_str_func(pos, a, b, c) {}
1112 Item_func_export_set(const POS &pos, Item *a, Item *b, Item *c, Item *d)
1113 : Item_str_func(pos, a, b, c, d) {}
1114 Item_func_export_set(const POS &pos, Item *a, Item *b, Item *c, Item *d,
1115 Item *e)
1116 : Item_str_func(pos, a, b, c, d, e) {}
1117 String *val_str(String *str) override;
1118 bool resolve_type(THD *) override;
1119 const char *func_name() const override { return "export_set"; }
1120};
1121
1124
1125 public:
1126 Item_func_quote(const POS &pos, Item *a) : Item_str_func(pos, a) {}
1127 const char *func_name() const override { return "quote"; }
1128 String *val_str(String *) override;
1129 bool resolve_type(THD *thd) override;
1130};
1131
1133 public:
1135 : Item_charset_conversion(pos, a, cs) {
1136 m_safe = false;
1137 }
1138
1140 bool cache_if_const)
1141 : Item_charset_conversion(thd, a, cs, cache_if_const) {
1142 assert(args[0]->fixed);
1143 }
1144 const char *func_name() const override { return "convert"; }
1145 void print(const THD *thd, String *str,
1146 enum_query_type query_type) const override;
1147 bool eq_specific(const Item *item) const override;
1148};
1149
1152
1154
1155 public:
1157 const LEX_CSTRING &collation_string_arg)
1158 : super(pos, a, nullptr), collation_string(collation_string_arg) {}
1159
1160 bool do_itemize(Parse_context *pc, Item **res) override;
1161 String *val_str(String *) override;
1162 bool resolve_type(THD *) override;
1163 bool eq(const Item *item) const override;
1164 const char *func_name() const override { return "collate"; }
1165 enum Functype functype() const override { return COLLATE_FUNC; }
1166 void print(const THD *thd, String *str,
1167 enum_query_type query_type) const override;
1169 /* this function is transparent for view updating */
1170 return args[0]->field_for_view_update();
1171 }
1172
1173 protected:
1174 void add_json_info(Json_object *obj) override {
1175 obj->add_alias("collation",
1176 create_dom_ptr<Json_string>(collation_string.str,
1178 }
1179};
1180
1181class Item_func_charset final : public Item_str_func {
1182 public:
1183 Item_func_charset(const POS &pos, Item *a) : Item_str_func(pos, a) {
1184 null_on_null = false;
1185 }
1186 String *val_str(String *) override;
1187 const char *func_name() const override { return "charset"; }
1188 bool resolve_type(THD *thd) override {
1190 set_nullable(false);
1191 return Item_str_func::resolve_type(thd);
1192 }
1193};
1194
1196 public:
1197 Item_func_collation(const POS &pos, Item *a) : Item_str_func(pos, a) {
1198 null_on_null = false;
1199 }
1200 String *val_str(String *) override;
1201 const char *func_name() const override { return "collation"; }
1202 bool resolve_type(THD *thd) override {
1203 if (Item_str_func::resolve_type(thd)) return true;
1205 set_nullable(false);
1206 return false;
1207 }
1208};
1209
1212
1214 uint flags;
1215 const uint result_length;
1217 const bool as_binary;
1218
1219 public:
1220 const uint num_codepoints;
1221 Item_func_weight_string(const POS &pos, Item *a, uint result_length_arg,
1222 uint num_codepoints_arg, uint flags_arg,
1223 bool as_binary_arg = false)
1224 : Item_str_func(pos, a),
1225 flags(flags_arg),
1226 result_length(result_length_arg),
1227 as_binary(as_binary_arg),
1228 num_codepoints(num_codepoints_arg) {}
1229
1230 bool do_itemize(Parse_context *pc, Item **res) override;
1231
1232 const char *func_name() const override { return "weight_string"; }
1233 bool eq_specific(const Item *item) const override;
1234 String *val_str(String *) override;
1235 bool resolve_type(THD *) override;
1236 void print(const THD *thd, String *str,
1237 enum_query_type query_type) const override;
1238};
1239
1240class Item_func_crc32 final : public Item_int_func {
1242
1243 public:
1244 Item_func_crc32(const POS &pos, Item *a) : Item_int_func(pos, a) {
1245 unsigned_flag = true;
1246 }
1247 const char *func_name() const override { return "crc32"; }
1248 bool resolve_type(THD *thd) override {
1249 if (param_type_is_default(thd, 0, 1)) return true;
1250 max_length = 10;
1251 return false;
1252 }
1253 longlong val_int() override;
1254};
1255
1258
1259 public:
1261 : Item_int_func(pos, a) {}
1262 const char *func_name() const override { return "uncompressed_length"; }
1263 bool resolve_type(THD *thd) override {
1264 if (param_type_is_default(thd, 0, 1)) return true;
1265 if (reject_vector_args()) return true;
1267 return false;
1268 }
1269 longlong val_int() override;
1270};
1271
1272class Item_func_compress final : public Item_str_func {
1274
1275 public:
1276 Item_func_compress(const POS &pos, Item *a) : Item_str_func(pos, a) {}
1277 bool resolve_type(THD *thd) override;
1278 const char *func_name() const override { return "compress"; }
1279 String *val_str(String *str) override;
1280};
1281
1284
1285 public:
1286 Item_func_to_vector(const POS &pos, Item *a) : Item_str_func(pos, a) {}
1287 bool resolve_type(THD *thd) override;
1288 const char *func_name() const override { return "to_vector"; }
1289 String *val_str(String *str) override;
1290};
1291
1293 static const uint32 per_value_chars = 16;
1297
1298 public:
1301 : Item_str_ascii_func(pos, a) {}
1302 bool resolve_type(THD *thd) override;
1303 const char *func_name() const override { return "from_vector"; }
1304 String *val_str_ascii(String *str) override;
1305};
1306
1309
1310 public:
1311 Item_func_uncompress(const POS &pos, Item *a) : Item_str_func(pos, a) {}
1312 bool resolve_type(THD *thd) override {
1313 if (reject_vector_args()) return true;
1314 if (Item_str_func::resolve_type(thd)) return true;
1315 set_nullable(true);
1317 return false;
1318 }
1319 const char *func_name() const override { return "uncompress"; }
1320 String *val_str(String *str) override;
1321};
1322
1323class Item_func_uuid final : public Item_str_func {
1325
1326 public:
1328 explicit Item_func_uuid(const POS &pos) : Item_str_func(pos) {}
1329
1330 bool do_itemize(Parse_context *pc, Item **res) override;
1332 return RAND_TABLE_BIT;
1333 }
1334 bool resolve_type(THD *) override;
1335 const char *func_name() const override { return "uuid"; }
1336 String *val_str(String *) override;
1337 bool check_function_as_value_generator(uchar *checker_args) override {
1339 pointer_cast<Check_function_as_value_generator_parameters *>(
1340 checker_args);
1341 func_arg->banned_function_name = func_name();
1342 return ((func_arg->source == VGS_GENERATED_COLUMN) ||
1343 (func_arg->source == VGS_CHECK_CONSTRAINT));
1344 }
1345};
1346
1349
1350 public:
1352 explicit Item_func_current_role(const POS &pos)
1353 : super(pos), value_cache_set(false) {}
1354 const char *func_name() const override { return "current_role"; }
1355 void cleanup() override;
1356 String *val_str(String *) override;
1357 bool resolve_type(THD *) override {
1359 return false;
1360 }
1362 return NAME_STRING("current_role()");
1363 }
1364
1365 protected:
1366 void set_current_role(THD *thd);
1367 /** a flag whether @ref value_cache is set or not */
1369 /**
1370 @brief Cache for the result value
1371
1372 Set by init(). And consumed by val_str().
1373 Needed to avoid re-calculation of the current_roles() in the
1374 course of the query.
1375 */
1377};
1378
1381
1382 public:
1384 explicit Item_func_roles_graphml(const POS &pos)
1385 : super(pos), value_cache_set(false) {}
1386 String *val_str(String *) override;
1387 void cleanup() override;
1388
1389 bool resolve_type(THD *) override {
1391 return false;
1392 }
1393
1394 const char *func_name() const override { return "roles_graphml"; }
1395
1397 return NAME_STRING("roles_graphml()");
1398 }
1399
1400 protected:
1401 bool calculate_graphml(THD *thd);
1402 /**
1403 @brief Cache for the result value
1404
1405 Set by init(). And consumed by val_str().
1406 Needed to avoid re-calculation of the current_roles() in the
1407 course of the query.
1408 */
1410
1411 /** Set to true if @ref value_cache is set */
1413};
1414
1416 public:
1418 : Item_str_func(pos, a, b, c) {}
1419
1420 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1421 bool resolve_type(THD *) override {
1422 /*
1423 There are 14 kinds of grants, with a max length
1424 per privileges is 11 chars.
1425 So, setting max approximate to 200.
1426 */
1428 set_nullable(true);
1429 null_on_null = false;
1430
1431 return false;
1432 }
1433
1434 const char *func_name() const override { return "get_dd_column_privileges"; }
1435
1436 String *val_str(String *) override;
1437};
1438
1440 public:
1442 : Item_str_func(pos, a, b, c) {}
1443
1444 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1445 bool resolve_type(THD *) override {
1446 // maximum string length of all options is expected
1447 // to be less than 256 characters.
1449 set_nullable(false);
1450 null_on_null = false;
1451
1452 return false;
1453 }
1454
1455 const char *func_name() const override { return "get_dd_create_options"; }
1456
1457 String *val_str(String *) override;
1458};
1459
1461 public:
1463 : Item_str_func(pos, a) {}
1464
1465 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1466 bool resolve_type(THD *) override {
1467 // maximum string length of all options is expected
1468 // to be less than 256 characters.
1470 set_nullable(false);
1471 null_on_null = false;
1472
1473 return false;
1474 }
1475
1476 const char *func_name() const override { return "get_dd_schema_options"; }
1477
1478 String *val_str(String *) override;
1479};
1480
1482 public:
1484 : Item_str_func(pos, list) {}
1485
1486 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1487 bool resolve_type(THD *) override {
1488 /*
1489 maximum expected string length to be less than 2048 characters,
1490 which is same as size of column holding comments in dictionary,
1491 i.e., the mysql.tables.comment DD column.
1492 */
1494 set_nullable(true);
1495 null_on_null = false;
1496
1497 return false;
1498 }
1499
1500 const char *func_name() const override {
1501 return "internal_get_comment_or_error";
1502 }
1503
1504 String *val_str(String *) override;
1505};
1506
1508 public:
1510 : Item_str_func(pos, a, b) {}
1511
1512 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1513 bool resolve_type(THD *) override {
1514 /* maximum string length of the property value is expected
1515 to be less than 256 characters. */
1517 set_nullable(false);
1518 null_on_null = false;
1519
1520 return false;
1521 }
1522
1523 const char *func_name() const override {
1524 return "get_dd_tablespace_private_data";
1525 }
1526
1527 String *val_str(String *) override;
1528};
1529
1531 public:
1533 : Item_str_func(pos, a, b) {}
1534
1535 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1536 bool resolve_type(THD *) override {
1537 /* maximum string length of the property value is expected
1538 to be less than 256 characters. */
1540 set_nullable(false);
1541 null_on_null = false;
1542
1543 return false;
1544 }
1545
1546 const char *func_name() const override { return "get_dd_index_private_data"; }
1547
1548 String *val_str(String *) override;
1549};
1550
1552 public:
1554 : Item_str_func(pos, a) {}
1555
1556 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1557 bool resolve_type(THD *) override {
1558 // maximum string length of all options is expected
1559 // to be less than 256 characters.
1561 set_nullable(true);
1562 null_on_null = false;
1563
1564 return false;
1565 }
1566
1567 const char *func_name() const override {
1568 return "internal_get_partition_nodegroup";
1569 }
1570
1571 String *val_str(String *) override;
1572};
1573
1575 public:
1577 Item *d)
1578 : Item_str_func(pos, a, b, c, d) {}
1579
1580 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1581 bool resolve_type(THD *) override {
1582 // maximum string length of all options is expected
1583 // to be less than 256 characters.
1585 set_nullable(true);
1586 null_on_null = false;
1587
1588 return false;
1589 }
1590
1591 const char *func_name() const override { return "internal_tablespace_type"; }
1592
1593 String *val_str(String *) override;
1594};
1595
1597 public:
1599 Item *b, Item *c, Item *d)
1600 : Item_str_func(pos, a, b, c, d) {}
1601
1602 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1603 bool resolve_type(THD *) override {
1604 // maximum string length of all options is expected
1605 // to be less than 256 characters.
1607 set_nullable(true);
1608 null_on_null = false;
1609
1610 return false;
1611 }
1612
1613 const char *func_name() const override {
1614 return "internal_tablespace_logfile_group_name";
1615 }
1616
1617 String *val_str(String *) override;
1618};
1619
1621 public:
1623 Item *c, Item *d)
1624 : Item_str_func(pos, a, b, c, d) {}
1625
1626 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1627 bool resolve_type(THD *) override {
1628 // maximum string length of all options is expected
1629 // to be less than 256 characters.
1631 set_nullable(true);
1632 null_on_null = false;
1633
1634 return false;
1635 }
1636
1637 const char *func_name() const override {
1638 return "internal_tablespace_status";
1639 }
1640 String *val_str(String *) override;
1641};
1642
1644 public:
1646 Item *c, Item *d)
1647 : Item_str_func(pos, a, b, c, d) {}
1648
1649 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1650 bool resolve_type(THD *) override {
1651 // maximum string length of all options is expected
1652 // to be less than 256 characters.
1654 set_nullable(true);
1655 null_on_null = false;
1656
1657 return false;
1658 }
1659
1660 const char *func_name() const override {
1661 return "internal_tablespace_row_format";
1662 }
1663
1664 String *val_str(String *) override;
1665};
1666
1668 public:
1670 Item *d)
1671 : Item_str_func(pos, a, b, c, d) {}
1672
1673 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1674 bool resolve_type(THD *) override {
1675 // maximum string length of all options is expected
1676 // to be less than 256 characters.
1678 set_nullable(true);
1679 null_on_null = false;
1680
1681 return false;
1682 }
1683
1684 const char *func_name() const override { return "internal_tablespace_extra"; }
1685
1686 String *val_str(String *) override;
1687};
1688
1690 public:
1692 : Item_str_func(pos, list) {}
1693
1694 bool resolve_type(THD *) override {
1695 set_nullable(false);
1697 return false;
1698 }
1699
1700 const char *func_name() const override { return "convert_cpu_id_mask"; }
1701
1702 String *val_str(String *) override;
1703};
1704
1706 public:
1708 : Item_str_func(pos, a, b) {}
1709
1710 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1711 bool resolve_type(THD *) override {
1713 set_nullable(true);
1714 null_on_null = false;
1715
1716 return false;
1717 }
1718
1719 const char *func_name() const override { return "get_dd_property_key_value"; }
1720
1721 String *val_str(String *) override;
1722};
1723
1725 public:
1727 Item *c, Item *d)
1728 : Item_str_func(pos, a, b, c, d) {}
1729
1730 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1731 bool resolve_type(THD *) override {
1733 set_nullable(true);
1734 null_on_null = false;
1735
1736 return false;
1737 }
1738
1739 const char *func_name() const override {
1740 return "get_jdv_property_key_value";
1741 }
1742
1743 String *val_str(String *) override;
1744};
1745
1747 public:
1749 : Item_str_func(pos, a, b) {}
1750
1751 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1752 bool resolve_type(THD *) override {
1754 set_nullable(true);
1755 null_on_null = false;
1756
1757 return false;
1758 }
1759
1760 const char *func_name() const override { return "remove_dd_property_key"; }
1761
1762 String *val_str(String *) override;
1763};
1764
1766 public:
1768 : Item_str_func(pos, a, b) {}
1769
1770 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1771 bool resolve_type(THD *) override {
1772 // maximum string length of all options is expected
1773 // to be less than 256 characters.
1775 set_nullable(true);
1776 null_on_null = false;
1777
1778 return false;
1779 }
1780
1781 const char *func_name() const override {
1782 return "convert_interval_to_user_interval";
1783 }
1784
1785 String *val_str(String *) override;
1786};
1787
1789 public:
1791 : Item_str_func(pos, list) {}
1792
1793 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1794 bool resolve_type(THD *) override {
1796 set_nullable(true);
1797 null_on_null = false;
1798
1799 return false;
1800 }
1801
1802 const char *func_name() const override { return "internal_get_username"; }
1803
1804 String *val_str(String *) override;
1805};
1806
1808 public:
1810 : Item_str_func(pos, list) {}
1811
1812 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1813 bool resolve_type(THD *) override {
1815 set_nullable(true);
1816 null_on_null = false;
1817
1818 return false;
1819 }
1820
1821 const char *func_name() const override { return "internal_get_hostname"; }
1822
1823 String *val_str(String *) override;
1824};
1825
1827 public:
1829 : Item_str_func(pos) {}
1830
1831 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1832 bool resolve_type(THD *) override {
1834 set_nullable(true);
1835 null_on_null = false;
1836
1837 return false;
1838 }
1839
1840 const char *func_name() const override {
1841 return "internal_get_enabled_role_json";
1842 }
1843
1844 String *val_str(String *) override;
1845};
1846
1848 public:
1850 : Item_str_func(pos) {}
1851
1852 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1853 bool resolve_type(THD *) override {
1855 set_nullable(true);
1856 null_on_null = false;
1857
1858 return false;
1859 }
1860
1861 const char *func_name() const override {
1862 return "internal_get_mandatory_roles_json";
1863 }
1864
1865 String *val_str(String *) override;
1866};
1867
1869 public:
1871 : Item_str_func(pos, list) {}
1872
1873 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1874 bool resolve_type(THD *) override {
1875 // maximum string length of all options is expected
1876 // to be less than 256 characters.
1878 set_nullable(false);
1879 null_on_null = false;
1880
1881 return false;
1882 }
1883
1884 const char *func_name() const override {
1885 return "internal_get_dd_column_extra";
1886 }
1887
1888 String *val_str(String *) override;
1889};
1890
1893
1894 public:
1896 : Item_bool_func(pos, a) {}
1897
1898 bool check_function_as_value_generator(uchar *checker_args) final {
1900 pointer_cast<Check_function_as_value_generator_parameters *>(
1901 checker_args);
1902 func_arg->banned_function_name = func_name();
1903 return ((func_arg->source >= VGS_GENERATED_COLUMN) &&
1904 (func_arg->source <= VGS_CHECK_CONSTRAINT));
1905 }
1906
1907 longlong val_int() final;
1908
1909 bool do_itemize(Parse_context *pc, Item **res) final;
1910
1912
1913 private:
1914 /**
1915 Used to pass a security context to the resolver functions.
1916 Only used for definer views. In all other contexts, the security context
1917 passed here is nullptr and is instead looked up dynamically at run time
1918 from the current THD.
1919 */
1921
1922#ifndef NDEBUG
1923 // Keeps track of whether this function has been called. For testing only.
1924 bool m_called = false;
1925#endif
1926
1927 /**
1928 Checks if the user or role in the security context is part of the
1929 comma-separated list. Subclasses override this to check for correct auth ID
1930 type (either user or role).
1931 */
1932 virtual bool auth_id_in(
1933 const Security_context &sctx,
1934 std::string_view comma_separated_auth_id_list) const = 0;
1935};
1936
1937inline void tohex(char *to, uint64_t from, uint len) {
1938 to += len;
1939 while (len--) {
1940 *--to = dig_vec_lower[from & 15];
1941 from >>= 4;
1942 }
1943}
1944
1947 public:
1950 const char *func_name() const override { return "current_role_in"; }
1951 enum Functype functype() const override { return CURRENT_ROLE_IN_FUNC; }
1952
1953 private:
1954 bool auth_id_in(const Security_context &sctx,
1955 std::string_view comma_separated_auth_id_list) const override;
1956};
1957
1960 public:
1963 const char *func_name() const override { return "current_user_in"; }
1964 enum Functype functype() const override { return CURRENT_USER_IN_FUNC; }
1965
1966 private:
1967 bool auth_id_in(const Security_context &sctx,
1968 std::string_view comma_separated_auth_id_list) const override;
1969};
1970
1971#endif /* ITEM_STRFUNC_INCLUDED */
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:247
void set(const DTCollation &dt)
Definition: item.h:204
void set_repertoire(uint repertoire_arg)
Definition: item.h:230
const CHARSET_INFO * collation
Definition: item.h:186
Date_val is a temporal type that represents dates within the range 0000-01-01 and 9999-12-31.
Definition: my_temporal.h:421
Definition: my_temporal.h:341
static const uint32 max_dimensions
Definition: field.h:3807
Definition: field.h:573
Definition: item_cmpfunc.h:305
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_cmpfunc.h:339
The following types of conversions are considered safe:
Definition: item_strfunc.h:997
const CHARSET_INFO * m_cast_cs
The character set we are converting to.
Definition: item_strfunc.h:1002
bool m_safe
Definition: item_strfunc.h:1011
bool m_charset_conversion
If true, conversion is needed so do it, else allow string copy.
Definition: item_strfunc.h:1000
const CHARSET_INFO * m_from_cs
The character set we are converting from.
Definition: item_strfunc.h:1004
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:3636
Item_charset_conversion(const POS &pos, Item *a, const CHARSET_INFO *cs_arg)
Definition: item_strfunc.h:1049
bool m_use_cached_value
Marks whether the underlying Item is constant and may be cached.
Definition: item_strfunc.h:1007
String * val_str(String *) override
Definition: item_strfunc.cc:3526
void add_json_info(Json_object *obj) override
Add all the node-specific json fields.
Definition: item_strfunc.h:1024
longlong m_cast_length
Length argument value, if any given.
Definition: item_strfunc.h:1009
String m_tmp_value
Definition: item_strfunc.h:1005
Item_charset_conversion(THD *thd, Item *a, const CHARSET_INFO *cs_arg, bool cache_if_const)
Definition: item_strfunc.h:1030
uint32 compute_max_char_length()
Helper for CAST and CONVERT type resolution: common logic to compute the maximum numbers of character...
Definition: item_strfunc.cc:3605
Definition: item.h:4540
Definition: item_strfunc.h:305
Item_func_aes_decrypt(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_strfunc.h:318
Item_func_aes_decrypt(const POS &pos, Item *a, Item *b, Item *c, Item *d, Item *e)
Definition: item_strfunc.h:322
String * val_str(String *) override
Definition: item_strfunc.cc:609
void destroy_op_context()
Definition: item_strfunc.cc:597
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_strfunc.cc:599
Item_func_aes_decrypt(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_strfunc.h:314
Item_func_aes_decrypt(const POS &pos, Item *a, Item *b)
Definition: item_strfunc.h:310
Item_str_func super
Definition: item_strfunc.h:306
EVP_CIPHER_CTX * ctx
Definition: item_strfunc.h:307
const char * func_name() const override
Definition: item_strfunc.h:339
Item_func_aes_decrypt(const POS &pos, Item *a, Item *b, Item *c, Item *d, Item *e, Item *f)
Definition: item_strfunc.h:327
void create_op_context()
Definition: item_strfunc.cc:595
~Item_func_aes_decrypt() override
Definition: item_strfunc.h:332
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:656
Definition: item_strfunc.h:267
Item_func_aes_encrypt(const POS &pos, Item *a, Item *b, Item *c, Item *d, Item *e, Item *f)
Definition: item_strfunc.h:290
void create_op_context()
Definition: item_strfunc.cc:516
String * val_str(String *) override
Definition: item_strfunc.cc:530
const char * func_name() const override
Definition: item_strfunc.h:302
EVP_CIPHER_CTX * ctx
Definition: item_strfunc.h:270
Item_func_aes_encrypt(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_strfunc.h:277
Item_func_aes_encrypt(const POS &pos, Item *a, Item *b)
Definition: item_strfunc.h:273
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_strfunc.cc:520
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:585
Item_func_aes_encrypt(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_strfunc.h:281
~Item_func_aes_encrypt() override
Definition: item_strfunc.h:295
String tmp_value
Definition: item_strfunc.h:268
Item_str_func super
Definition: item_strfunc.h:269
Item_func_aes_encrypt(const POS &pos, Item *a, Item *b, Item *c, Item *d, Item *e)
Definition: item_strfunc.h:285
void destroy_op_context()
Definition: item_strfunc.cc:518
Definition: item_strfunc.h:890
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:2896
String * val_str_ascii(String *) override
Definition: item_strfunc.cc:2906
Item_func_bin_to_uuid(const POS &pos, Item *arg1, Item *arg2)
Definition: item_strfunc.h:897
Item_func_bin_to_uuid(const POS &pos, Item *arg1)
Definition: item_strfunc.h:895
const char * func_name() const override
Definition: item_strfunc.h:901
char m_text_buf[mysql::gtid::Uuid::TEXT_LENGTH+1]
Buffer to store the text result.
Definition: item_strfunc.h:892
Definition: item_strfunc.h:808
Item_func_char(const POS &pos, PT_item_list *list)
Definition: item_strfunc.h:810
void add_json_info(Json_object *obj) override
Add all the node-specific json fields.
Definition: item_strfunc.h:828
Item_func_char(const POS &pos, PT_item_list *list, const CHARSET_INFO *cs)
Definition: item_strfunc.h:815
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:821
String * val_str(String *) override
Definition: item_strfunc.cc:2538
const char * func_name() const override
Definition: item_strfunc.h:827
Definition: item_strfunc.h:1181
Item_func_charset(const POS &pos, Item *a)
Definition: item_strfunc.h:1183
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1188
String * val_str(String *) override
Definition: item_strfunc.cc:3203
const char * func_name() const override
Definition: item_strfunc.h:1187
Definition: item_strfunc.h:1195
String * val_str(String *) override
Definition: item_strfunc.cc:3217
const char * func_name() const override
Definition: item_strfunc.h:1201
Item_func_collation(const POS &pos, Item *a)
Definition: item_strfunc.h:1197
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1202
Definition: item_strfunc.h:1272
String buffer
Definition: item_strfunc.h:1273
Item_func_compress(const POS &pos, Item *a)
Definition: item_strfunc.h:1276
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:4109
String * val_str(String *str) override
Definition: item_strfunc.cc:4117
const char * func_name() const override
Definition: item_strfunc.h:1278
Definition: item_strfunc.h:375
const char * func_name() const override
Definition: item_strfunc.h:388
Item_func_concat_ws(const POS &pos, PT_item_list *opt_list)
Definition: item_strfunc.h:382
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:1144
String tmp_value
Definition: item_strfunc.h:376
String * val_str(String *) override
concat with separator.
Definition: item_strfunc.cc:1111
Item_func_concat_ws(mem_root_deque< Item * > *list)
Definition: item_strfunc.h:378
Definition: item_strfunc.h:361
String * val_str(String *) override
Concatenate args with the following premises: If only one arg (which is ok), return value of arg;.
Definition: item_strfunc.cc:1061
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:1086
Item_func_concat(const POS &pos, Item *a, Item *b)
Definition: item_strfunc.h:367
Item_func_concat(Item *a, Item *b)
Definition: item_strfunc.h:366
Item_func_concat(const POS &pos, PT_item_list *opt_list)
Definition: item_strfunc.h:364
const char * func_name() const override
Definition: item_strfunc.h:372
String tmp_value
Definition: item_strfunc.h:362
Definition: item_strfunc.h:1132
bool eq_specific(const Item *item) const override
Provide a more specific equality check for a function.
Definition: item_strfunc.cc:3115
Item_func_conv_charset(const POS &pos, Item *a, const CHARSET_INFO *cs)
Definition: item_strfunc.h:1134
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_strfunc.cc:3121
const char * func_name() const override
Definition: item_strfunc.h:1144
Item_func_conv_charset(THD *thd, Item *a, const CHARSET_INFO *cs, bool cache_if_const)
Definition: item_strfunc.h:1139
Definition: item_strfunc.h:919
String * val_str(String *) override
Definition: item_strfunc.cc:3041
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:3033
static constexpr uint32_t CONV_MAX_LENGTH
Definition: item_strfunc.h:922
Item_func_conv(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_strfunc.h:923
const char * func_name() const override
Definition: item_strfunc.h:925
Definition: item_strfunc.h:1689
const char * func_name() const override
Definition: item_strfunc.h:1700
Item_func_convert_cpu_id_mask(const POS &pos, Item *list)
Definition: item_strfunc.h:1691
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1694
String * val_str(String *) override
Definition: item_strfunc.cc:5178
Definition: item_strfunc.h:1765
const char * func_name() const override
Definition: item_strfunc.h:1781
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1771
enum Functype functype() const override
Definition: item_strfunc.h:1770
String * val_str(String *) override
Definition: item_strfunc.cc:5477
Item_func_convert_interval_to_user_interval(const POS &pos, Item *a, Item *b)
Definition: item_strfunc.h:1767
Definition: item_strfunc.h:1240
const char * func_name() const override
Definition: item_strfunc.h:1247
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1248
Item_func_crc32(const POS &pos, Item *a)
Definition: item_strfunc.h:1244
longlong val_int() override
Definition: item_strfunc.cc:4097
String value
Definition: item_strfunc.h:1241
Definition: item_strfunc.h:1891
bool m_called
Definition: item_strfunc.h:1924
Item_func_current_auth_id_type_in(const POS &pos, Item *a)
Definition: item_strfunc.h:1895
table_map get_initial_pseudo_tables() const final
Returns the pseudo tables depended upon in order to evaluate this function expression.
Definition: item_strfunc.h:1911
Item_bool_func super
Definition: item_strfunc.h:1892
bool check_function_as_value_generator(uchar *checker_args) final
Check if this item is allowed for a virtual column or inside a default expression.
Definition: item_strfunc.h:1898
longlong val_int() final
Definition: item_strfunc.cc:5746
virtual bool auth_id_in(const Security_context &sctx, std::string_view comma_separated_auth_id_list) const =0
Checks if the user or role in the security context is part of the comma-separated list.
Name_resolution_context * m_name_resolution_ctx
Used to pass a security context to the resolver functions.
Definition: item_strfunc.h:1920
bool do_itemize(Parse_context *pc, Item **res) final
The core function that does the actual itemization.
Definition: item_strfunc.cc:5737
Definition: item_strfunc.h:1946
enum Functype functype() const override
Definition: item_strfunc.h:1951
const char * func_name() const override
Definition: item_strfunc.h:1950
bool auth_id_in(const Security_context &sctx, std::string_view comma_separated_auth_id_list) const override
Checks if the user or role in the security context is part of the comma-separated list.
Definition: item_strfunc.cc:5781
Item_func_current_role_in(const POS &pos, Item *a)
Definition: item_strfunc.h:1948
Definition: item_strfunc.h:1347
const Name_string fully_qualified_func_name() const override
Definition: item_strfunc.h:1361
void set_current_role(THD *thd)
Definition: item_strfunc.cc:5234
Item_func_current_role()
Definition: item_strfunc.h:1351
const char * func_name() const override
Definition: item_strfunc.h:1354
bool value_cache_set
a flag whether value_cache is set or not
Definition: item_strfunc.h:1368
Item_func_sysconst super
Definition: item_strfunc.h:1348
Item_func_current_role(const POS &pos)
Definition: item_strfunc.h:1352
String * val_str(String *) override
Definition: item_strfunc.cc:5229
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1357
String value_cache
Cache for the result value.
Definition: item_strfunc.h:1376
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_strfunc.cc:5221
Definition: item_strfunc.h:1959
const char * func_name() const override
Definition: item_strfunc.h:1963
Item_func_current_user_in(const POS &pos, Item *a)
Definition: item_strfunc.h:1961
bool auth_id_in(const Security_context &sctx, std::string_view comma_separated_auth_id_list) const override
Checks if the user or role in the security context is part of the comma-separated list.
Definition: item_strfunc.cc:5775
enum Functype functype() const override
Definition: item_strfunc.h:1964
Definition: item_strfunc.h:717
Item_func_user super
Definition: item_strfunc.h:718
bool resolve_type(THD *) override
Overridden to copy definer priv_user and priv_host.
Definition: item_strfunc.cc:2028
Item_func_current_user(const POS &pos)
Definition: item_strfunc.h:739
const Name_string fully_qualified_func_name() const override
Definition: item_strfunc.h:743
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_strfunc.cc:2105
const char * func_name() const override
Definition: item_strfunc.h:742
LEX_CSTRING m_definer_priv_host
Definition: item_strfunc.h:730
type_conversion_status save_in_field_inner(Field *field, bool) override
We override Item::save_in_field_inner() for reasons explained in the comment of that function - we ne...
Definition: item_strfunc.cc:2022
LEX_CSTRING m_definer_priv_user
Copied from m_name_resolution_ctx in fix_fields if the definer Security_context is set in Name_resolu...
Definition: item_strfunc.h:729
String * val_str(String *) override
Definition: item_strfunc.cc:2053
Name_resolution_context * m_name_resolution_ctx
Used to pass a security context to the resolver functions.
Definition: item_strfunc.h:725
Definition: item_strfunc.h:649
Item_func_sysconst super
Definition: item_strfunc.h:650
String * val_str(String *) override
Definition: item_strfunc.cc:1992
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:658
const Name_string fully_qualified_func_name() const override
Definition: item_strfunc.h:664
Item_func_database(const POS &pos)
Definition: item_strfunc.h:653
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_strfunc.cc:1984
const char * func_name() const override
Definition: item_strfunc.h:663
Definition: item_strfunc.h:761
const char * func_name() const override
Definition: item_strfunc.h:769
longlong val_int() override
Definition: item_strfunc.cc:2437
String * val_str(String *str) override
Definition: item_strfunc.cc:2450
double val_real() override
Definition: item_strfunc.cc:2425
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:2406
Item_func_elt(const POS &pos, PT_item_list *opt_list)
Definition: item_strfunc.h:763
This class represents the function ETAG which is used to traverse the input arguments and compute a 1...
Definition: item_strfunc.h:395
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_strfunc.h:406
String * val_str(String *) override
Definition: item_strfunc.cc:1166
Item_func_etag(const POS &pos, PT_item_list *opt_list)
Definition: item_strfunc.h:399
Item_func_etag(Item *a, Item *b)
Definition: item_strfunc.h:401
const char * func_name() const override
Definition: item_strfunc.h:405
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:1232
String m_tmp_value
Definition: item_strfunc.h:396
Definition: item_strfunc.h:1108
Item_func_export_set(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_strfunc.h:1110
Item_func_export_set(const POS &pos, Item *a, Item *b, Item *c, Item *d, Item *e)
Definition: item_strfunc.h:1114
Item_func_export_set(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_strfunc.h:1112
String * val_str(String *str) override
Definition: item_strfunc.cc:3762
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:3831
const char * func_name() const override
Definition: item_strfunc.h:1119
Definition: item_strfunc.h:790
const char * func_name() const override
Definition: item_strfunc.h:803
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_strfunc.cc:2393
String tmp_str
Definition: item_strfunc.h:791
MY_LOCALE * get_locale(Item *item)
Definition: item_strfunc.cc:2262
MY_LOCALE * locale
Definition: item_strfunc.h:792
Item_func_format(const POS &pos, Item *org, Item *dec)
Definition: item_strfunc.h:795
String * val_str_ascii(String *) override
Definition: item_strfunc.cc:2302
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:2277
Item_func_format(const POS &pos, Item *org, Item *dec, Item *lang)
Definition: item_strfunc.h:797
Definition: item_strfunc.h:257
String tmp_value
Definition: item_strfunc.h:258
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:754
const char * func_name() const override
Definition: item_strfunc.h:264
String * val_str(String *) override
Definition: item_strfunc.cc:768
Item_func_from_base64(const POS &pos, Item *a)
Definition: item_strfunc.h:261
Definition: item_strfunc.h:1292
Item_func_from_vector(const POS &pos, Item *a)
Definition: item_strfunc.h:1300
const char * func_name() const override
Definition: item_strfunc.h:1303
String * val_str_ascii(String *str) override
Definition: item_strfunc.cc:4225
String buffer
Definition: item_strfunc.h:1296
static const uint32 per_value_chars
Definition: item_strfunc.h:1293
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:4209
static const uint32 max_output_bytes
Definition: item_strfunc.h:1294
Item_func_from_vector(Item *a)
Definition: item_strfunc.h:1299
Definition: item_strfunc.h:1415
Item_func_get_dd_column_privileges(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_strfunc.h:1417
const char * func_name() const override
Definition: item_strfunc.h:1434
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1421
enum Functype functype() const override
Definition: item_strfunc.h:1420
String * val_str(String *) override
This function prepares string with list of column privileges.
Definition: item_strfunc.cc:4476
Definition: item_strfunc.h:1439
enum Functype functype() const override
Definition: item_strfunc.h:1444
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1445
String * val_str(String *) override
This function prepares string representing create_options for table.
Definition: item_strfunc.cc:4548
Item_func_get_dd_create_options(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_strfunc.h:1441
const char * func_name() const override
Definition: item_strfunc.h:1455
Definition: item_strfunc.h:1530
const char * func_name() const override
Definition: item_strfunc.h:1546
Item_func_get_dd_index_private_data(const POS &pos, Item *a, Item *b)
Definition: item_strfunc.h:1532
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1536
String * val_str(String *) override
This function prepares string representing se_private_data for index.
Definition: item_strfunc.cc:5093
enum Functype functype() const override
Definition: item_strfunc.h:1535
Definition: item_strfunc.h:1705
String * val_str(String *) override
This function prepares string representing value stored at key supplied.
Definition: item_strfunc.cc:5289
enum Functype functype() const override
Definition: item_strfunc.h:1710
Item_func_get_dd_property_key_value(const POS &pos, Item *a, Item *b)
Definition: item_strfunc.h:1707
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1711
const char * func_name() const override
Definition: item_strfunc.h:1719
Definition: item_strfunc.h:1460
String * val_str(String *) override
This function prepares string representing options for a schema.
Definition: item_strfunc.cc:4749
const char * func_name() const override
Definition: item_strfunc.h:1476
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1466
enum Functype functype() const override
Definition: item_strfunc.h:1465
Item_func_get_dd_schema_options(const POS &pos, Item *a)
Definition: item_strfunc.h:1462
Definition: item_strfunc.h:1507
String * val_str(String *) override
This function prepares string representing se_private_data for tablespace.
Definition: item_strfunc.cc:5027
const char * func_name() const override
Definition: item_strfunc.h:1523
enum Functype functype() const override
Definition: item_strfunc.h:1512
Item_func_get_dd_tablespace_private_data(const POS &pos, Item *a, Item *b)
Definition: item_strfunc.h:1509
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1513
Definition: item_strfunc.h:1724
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1731
enum Functype functype() const override
Definition: item_strfunc.h:1730
String * val_str(String *) override
This function prepares a string representing the value associated with the logical key that is suppli...
Definition: item_strfunc.cc:5344
const char * func_name() const override
Definition: item_strfunc.h:1739
Item_func_get_jdv_property_key_value(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_strfunc.h:1726
Definition: item_strfunc.h:1551
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1557
String * val_str(String *) override
Definition: item_strfunc.cc:4874
enum Functype functype() const override
Definition: item_strfunc.h:1556
Item_func_get_partition_nodegroup(const POS &pos, Item *a)
Definition: item_strfunc.h:1553
const char * func_name() const override
Definition: item_strfunc.h:1567
Definition: item_strfunc.h:930
String tmp_value
Definition: item_strfunc.h:931
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:3383
Item_func_hex(const POS &pos, Item *a)
Definition: item_strfunc.h:934
String * val_str_ascii(String *) override
Definition: item_strfunc.cc:3395
const char * func_name() const override
Definition: item_strfunc.h:935
Definition: item_strfunc.h:441
String * val_str(String *) override
Definition: item_strfunc.cc:1381
const char * func_name() const override
Definition: item_strfunc.h:452
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:1434
String tmp_value_res
Holds result in case we need to allocate our own result buffer.
Definition: item_strfunc.h:444
Item_func_insert(const POS &pos, Item *org, Item *start, Item *length, Item *new_str)
Definition: item_strfunc.h:447
String tmp_value
Definition: item_strfunc.h:442
Definition: item_strfunc.h:1481
Item_func_internal_get_comment_or_error(const POS &pos, PT_item_list *list)
Definition: item_strfunc.h:1483
const char * func_name() const override
Definition: item_strfunc.h:1500
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1487
String * val_str(String *) override
Definition: item_strfunc.cc:4797
enum Functype functype() const override
Definition: item_strfunc.h:1486
Definition: item_strfunc.h:1868
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1874
String * val_str(String *) override
This function prepares string representing EXTRA column for I_S.COLUMNS.
Definition: item_strfunc.cc:5654
const char * func_name() const override
Definition: item_strfunc.h:1884
Item_func_internal_get_dd_column_extra(const POS &pos, PT_item_list *list)
Definition: item_strfunc.h:1870
enum Functype functype() const override
Definition: item_strfunc.h:1873
Definition: item_strfunc.h:1826
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1832
enum Functype functype() const override
Definition: item_strfunc.h:1831
Item_func_internal_get_enabled_role_json(const POS &pos)
Definition: item_strfunc.h:1828
String * val_str(String *) override
Definition: item_strfunc.cc:5573
const char * func_name() const override
Definition: item_strfunc.h:1840
Definition: item_strfunc.h:1807
Item_func_internal_get_hostname(const POS &pos, PT_item_list *list)
Definition: item_strfunc.h:1809
enum Functype functype() const override
Definition: item_strfunc.h:1812
const char * func_name() const override
Definition: item_strfunc.h:1821
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1813
String * val_str(String *) override
Definition: item_strfunc.cc:5538
Definition: item_strfunc.h:1847
const char * func_name() const override
Definition: item_strfunc.h:1861
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1853
enum Functype functype() const override
Definition: item_strfunc.h:1852
Item_func_internal_get_mandatory_roles_json(const POS &pos)
Definition: item_strfunc.h:1849
String * val_str(String *) override
Definition: item_strfunc.cc:5605
Definition: item_strfunc.h:1788
String * val_str(String *) override
Definition: item_strfunc.cc:5501
Item_func_internal_get_username(const POS &pos, PT_item_list *list)
Definition: item_strfunc.h:1790
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1794
enum Functype functype() const override
Definition: item_strfunc.h:1793
const char * func_name() const override
Definition: item_strfunc.h:1802
Definition: item_strfunc.h:1667
String * val_str(String *) override
Definition: item_strfunc.cc:4993
const char * func_name() const override
Definition: item_strfunc.h:1684
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1674
enum Functype functype() const override
Definition: item_strfunc.h:1673
Item_func_internal_tablespace_extra(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_strfunc.h:1669
const char * func_name() const override
Definition: item_strfunc.h:1613
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1603
String * val_str(String *) override
Definition: item_strfunc.cc:4931
Item_func_internal_tablespace_logfile_group_name(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_strfunc.h:1598
enum Functype functype() const override
Definition: item_strfunc.h:1602
Definition: item_strfunc.h:1643
const char * func_name() const override
Definition: item_strfunc.h:1660
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1650
Item_func_internal_tablespace_row_format(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_strfunc.h:1645
String * val_str(String *) override
Definition: item_strfunc.cc:4971
enum Functype functype() const override
Definition: item_strfunc.h:1649
Definition: item_strfunc.h:1620
Item_func_internal_tablespace_status(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_strfunc.h:1622
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1627
String * val_str(String *) override
Definition: item_strfunc.cc:4954
enum Functype functype() const override
Definition: item_strfunc.h:1626
const char * func_name() const override
Definition: item_strfunc.h:1637
Definition: item_strfunc.h:1574
enum Functype functype() const override
Definition: item_strfunc.h:1580
String * val_str(String *) override
Definition: item_strfunc.cc:4914
const char * func_name() const override
Definition: item_strfunc.h:1591
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1581
Item_func_internal_tablespace_type(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_strfunc.h:1576
Definition: item_strfunc.h:904
const char * func_name() const override
Definition: item_strfunc.h:910
longlong val_int() override
Definition: item_strfunc.cc:2946
Item_func_is_uuid(const POS &pos, Item *a)
Definition: item_strfunc.h:908
Item_bool_func super
Definition: item_strfunc.h:905
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:911
Definition: item_strfunc.h:480
Item_func_left(const POS &pos, Item *a, Item *b)
Definition: item_strfunc.h:484
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:1557
String tmp_value
Definition: item_strfunc.h:481
String * val_str(String *) override
Definition: item_strfunc.cc:1507
const char * func_name() const override
Definition: item_strfunc.h:487
Definition: item_strfunc.h:982
const char * func_name() const override
Definition: item_strfunc.h:986
Item_func_like_range_max(const POS &pos, Item *a, Item *b)
Definition: item_strfunc.h:984
Definition: item_strfunc.h:975
const char * func_name() const override
Definition: item_strfunc.h:979
Item_func_like_range_min(const POS &pos, Item *a, Item *b)
Definition: item_strfunc.h:977
Definition: item_strfunc.h:954
String max_str
Definition: item_strfunc.h:957
const bool is_min
Definition: item_strfunc.h:958
Item_func_like_range(const POS &pos, Item *a, Item *b, bool is_min_arg)
Definition: item_strfunc.h:961
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:966
String min_str
Definition: item_strfunc.h:956
String * val_str(String *) override
Definition: item_strfunc.cc:3470
Definition: item_strfunc.h:466
const char * func_name() const override
Definition: item_strfunc.h:469
Item_func_lower(const POS &pos, Item *item)
Definition: item_strfunc.h:468
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:1483
Definition: item_strfunc.h:865
String * val_str(String *) override
Definition: item_strfunc.cc:2960
Item_func_lpad(const POS &pos, Item *arg1, Item *arg2, Item *arg3)
Definition: item_strfunc.h:869
String tmp_value
Definition: item_strfunc.h:866
String lpad_str
Definition: item_strfunc.h:866
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:2827
const char * func_name() const override
Definition: item_strfunc.h:873
Definition: item_strfunc.h:611
Item_func_ltrim(const POS &pos, Item *a)
Definition: item_strfunc.h:613
Definition: item_strfunc.h:772
String * val_str(String *str) override
Definition: item_strfunc.cc:2490
Item_str_func super
Definition: item_strfunc.h:773
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_strfunc.cc:2527
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:2474
String tmp_str
Definition: item_strfunc.h:775
Item_func_make_set(const POS &pos, PT_item_list *opt_list)
Definition: item_strfunc.h:778
bool fix_fields(THD *thd, Item **ref) override
Definition: item_strfunc.cc:2470
const char * func_name() const override
Definition: item_strfunc.h:784
Definition: item_strfunc.h:1122
String * val_str(String *) override
QUOTE() function returns argument string in single quotes suitable for using in a SQL statement.
Definition: item_strfunc.cc:3892
Item_func_quote(const POS &pos, Item *a)
Definition: item_strfunc.h:1126
String tmp_value
Definition: item_strfunc.h:1123
const char * func_name() const override
Definition: item_strfunc.h:1127
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:3851
Definition: item_strfunc.h:342
table_map get_initial_pseudo_tables() const override
Returns the pseudo tables depended upon in order to evaluate this function expression.
Definition: item_strfunc.h:356
static const ulonglong MAX_RANDOM_BYTES_BUFFER
limitation from the SSL library
Definition: item_strfunc.h:346
Item_str_func super
Definition: item_strfunc.h:343
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_strfunc.cc:664
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:681
Item_func_random_bytes(const POS &pos, Item *a)
Definition: item_strfunc.h:349
String * val_str(String *a) override
Definition: item_strfunc.cc:688
const char * func_name() const override
Definition: item_strfunc.h:355
Definition: item_strfunc.h:1746
Item_func_remove_dd_property_key(const POS &pos, Item *a, Item *b)
Definition: item_strfunc.h:1748
const char * func_name() const override
Definition: item_strfunc.h:1760
String * val_str(String *) override
This function removes a key value from given property string.
Definition: item_strfunc.cc:5431
enum Functype functype() const override
Definition: item_strfunc.h:1751
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1752
Definition: item_strfunc.h:835
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:2588
String * val_str(String *) override
Item_func_repeat::str is carefully written to avoid reallocs as much as possible at the cost of a loc...
Definition: item_strfunc.cc:2622
String tmp_value
Definition: item_strfunc.h:836
Item_func_repeat(const POS &pos, Item *arg1, Item *arg2)
Definition: item_strfunc.h:839
const char * func_name() const override
Definition: item_strfunc.h:843
Definition: item_strfunc.h:428
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:1359
String * val_str(String *) override
Replace all occurrences of string2 in string1 with string3.
Definition: item_strfunc.cc:1297
const char * func_name() const override
Definition: item_strfunc.h:438
String tmp_value
Definition: item_strfunc.h:429
String tmp_value_res
Holds result in case we need to allocate our own result buffer.
Definition: item_strfunc.h:431
String tmp_value2
Definition: item_strfunc.h:429
Item_func_replace(const POS &pos, Item *org, Item *find, Item *replace)
Definition: item_strfunc.h:434
Definition: item_strfunc.h:416
Item_func_reverse(Item *a)
Definition: item_strfunc.h:420
String * val_str(String *) override
Definition: item_strfunc.cc:1242
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:1284
String tmp_value
Definition: item_strfunc.h:417
Item_func_reverse(const POS &pos, Item *a)
Definition: item_strfunc.h:421
const char * func_name() const override
Definition: item_strfunc.h:425
Definition: item_strfunc.h:490
Item_func_right(const POS &pos, Item *a, Item *b)
Definition: item_strfunc.h:494
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:1592
const char * func_name() const override
Definition: item_strfunc.h:498
String * val_str(String *) override
Definition: item_strfunc.cc:1567
String tmp_value
Definition: item_strfunc.h:491
Definition: item_strfunc.h:1379
Item_func_roles_graphml(const POS &pos)
Definition: item_strfunc.h:1384
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_strfunc.cc:5272
String value_cache
Cache for the result value.
Definition: item_strfunc.h:1409
Item_func_sysconst super
Definition: item_strfunc.h:1380
const char * func_name() const override
Definition: item_strfunc.h:1394
Item_func_roles_graphml()
Definition: item_strfunc.h:1383
bool calculate_graphml(THD *thd)
Constructs and caches the graphml string.
Definition: item_strfunc.cc:5252
String * val_str(String *) override
Definition: item_strfunc.cc:5267
bool value_cache_set
Set to true if value_cache is set.
Definition: item_strfunc.h:1412
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1389
const Name_string fully_qualified_func_name() const override
Definition: item_strfunc.h:1396
Definition: item_strfunc.h:854
String tmp_value
Definition: item_strfunc.h:855
Item_func_rpad(const POS &pos, Item *arg1, Item *arg2, Item *arg3)
Definition: item_strfunc.h:858
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:2728
String * val_str(String *) override
Definition: item_strfunc.cc:2755
const char * func_name() const override
Definition: item_strfunc.h:862
String rpad_str
Definition: item_strfunc.h:855
Definition: item_strfunc.h:617
Item_func_rtrim(const POS &pos, Item *a)
Definition: item_strfunc.h:619
Definition: item_strfunc.h:1150
bool eq(const Item *item) const override
Compare this item with another item for equality.
Definition: item_strfunc.cc:3179
Item_field * field_for_view_update() override
Definition: item_strfunc.h:1168
LEX_CSTRING collation_string
Definition: item_strfunc.h:1153
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_strfunc.cc:3192
void add_json_info(Json_object *obj) override
Add all the node-specific json fields.
Definition: item_strfunc.h:1174
const char * func_name() const override
Definition: item_strfunc.h:1164
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:3149
enum Functype functype() const override
Definition: item_strfunc.h:1165
String * val_str(String *) override
Definition: item_strfunc.cc:3140
Item_func_set_collation(const POS &pos, Item *a, const LEX_CSTRING &collation_string_arg)
Definition: item_strfunc.h:1156
Item_str_func super
Definition: item_strfunc.h:1151
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_strfunc.cc:3130
Definition: item_strfunc.h:189
const char * func_name() const override
Definition: item_strfunc.h:195
String * val_str_ascii(String *) override
Definition: item_strfunc.cc:219
Item_func_sha2(const POS &pos, Item *a, Item *b)
Definition: item_strfunc.h:191
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:302
Definition: item_strfunc.h:750
Item_func_soundex(const POS &pos, Item *a)
Definition: item_strfunc.h:755
String tmp_value
Definition: item_strfunc.h:751
Item_func_soundex(Item *a)
Definition: item_strfunc.h:754
String * val_str(String *) override
Definition: item_strfunc.cc:2158
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:2113
const char * func_name() const override
Definition: item_strfunc.h:758
Definition: item_strfunc.h:846
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:2668
String * val_str(String *) override
Definition: item_strfunc.cc:2700
const char * func_name() const override
Definition: item_strfunc.h:851
Item_func_space(const POS &pos, Item *arg1)
Definition: item_strfunc.h:848
Definition: item_strfunc.h:231
bool resolve_type(THD *thd) override
The type is always LONGTEXT, just like the digest_text columns in Performance Schema.
Definition: item_strfunc.cc:1021
const char * func_name() const override
Definition: item_strfunc.h:236
uchar * m_token_buffer
Definition: item_strfunc.h:254
Item_func_statement_digest_text(const POS &pos, Item *query_string)
Definition: item_strfunc.h:233
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_strfunc.h:244
String * val_str(String *) override
Definition: item_strfunc.cc:1030
Definition: item_strfunc.h:209
uchar * m_token_buffer
Definition: item_strfunc.h:228
Item_func_statement_digest(const POS &pos, Item *query_string)
Definition: item_strfunc.h:211
const char * func_name() const override
Definition: item_strfunc.h:214
String * val_str_ascii(String *) override
Implementation of the STATEMENT_DIGEST() native function.
Definition: item_strfunc.cc:991
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:975
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_strfunc.h:215
Definition: item_strfunc.h:519
String * val_str(String *) override
Definition: item_strfunc.cc:1702
Item_func_substr_index(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_strfunc.h:523
String tmp_value
Definition: item_strfunc.h:520
const char * func_name() const override
Definition: item_strfunc.h:527
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:1691
Definition: item_strfunc.h:501
const char * func_name() const override
Definition: item_strfunc.h:516
Item_func_substr(Item *a, Item *b)
Definition: item_strfunc.h:507
Item_func_substr(Item *a, Item *b, Item *c)
Definition: item_strfunc.h:510
String tmp_value
Definition: item_strfunc.h:504
Item_func_substr(const POS &pos, Item *a, Item *b)
Definition: item_strfunc.h:508
Item_str_func super
Definition: item_strfunc.h:502
String * val_str(String *) override
Definition: item_strfunc.cc:1603
Item_func_substr(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_strfunc.h:511
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:1650
Definition: item_strfunc.h:623
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_strfunc.h:639
virtual const Name_string fully_qualified_func_name() const =0
Item_func_sysconst(const POS &pos)
Definition: item_strfunc.h:630
Item_str_func super
Definition: item_strfunc.h:624
Item_func_sysconst()
Definition: item_strfunc.h:627
Definition: item_strfunc.h:198
const char * func_name() const override
Definition: item_strfunc.h:206
Item_func_to_base64(const POS &pos, Item *a)
Definition: item_strfunc.h:202
Item_func_to_base64(Item *a)
Definition: item_strfunc.h:203
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:719
String * val_str_ascii(String *) override
Definition: item_strfunc.cc:736
String tmp_value
Definition: item_strfunc.h:199
Definition: item_strfunc.h:1282
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:4166
String * val_str(String *str) override
Definition: item_strfunc.cc:4181
String buffer
Definition: item_strfunc.h:1283
const char * func_name() const override
Definition: item_strfunc.h:1288
Item_func_to_vector(const POS &pos, Item *a)
Definition: item_strfunc.h:1286
Definition: item_strfunc.h:530
const bool m_trim_trailing
Definition: item_strfunc.h:551
bool trim_trailing() const
Definition: item_strfunc.h:583
bool trim_leading() const
Definition: item_strfunc.h:578
const char * func_name() const override
Definition: item_strfunc.h:590
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:1914
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_strfunc.cc:1954
TRIM_MODE
Why all the trim modes in this enum? We need to maintain parsing information, so that our print() fun...
Definition: item_strfunc.h:537
@ TRIM_BOTH_DEFAULT
Definition: item_strfunc.h:538
@ TRIM_LTRIM
Definition: item_strfunc.h:542
@ TRIM_RTRIM
Definition: item_strfunc.h:543
@ TRIM_BOTH
Definition: item_strfunc.h:539
@ TRIM_LEADING
Definition: item_strfunc.h:540
@ TRIM_TRAILING
Definition: item_strfunc.h:541
Item_func_trim(Item *a, TRIM_MODE tm)
Definition: item_strfunc.h:566
Item_func_trim(Item *a, Item *b, TRIM_MODE tm)
Definition: item_strfunc.h:554
Item_func_trim(const POS &pos, Item *a, TRIM_MODE tm)
Definition: item_strfunc.h:572
String tmp_value
Definition: item_strfunc.h:547
const TRIM_MODE m_trim_mode
Definition: item_strfunc.h:549
Item_func_trim(const POS &pos, Item *a, Item *b, TRIM_MODE tm)
Definition: item_strfunc.h:560
String remove
Definition: item_strfunc.h:548
const bool m_trim_leading
Definition: item_strfunc.h:550
String * val_str(String *) override
Definition: item_strfunc.cc:1819
Definition: item_strfunc.h:1307
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1312
const char * func_name() const override
Definition: item_strfunc.h:1319
String * val_str(String *str) override
Definition: item_strfunc.cc:4257
String buffer
Definition: item_strfunc.h:1308
Item_func_uncompress(const POS &pos, Item *a)
Definition: item_strfunc.h:1311
Definition: item_strfunc.h:1256
const char * func_name() const override
Definition: item_strfunc.h:1262
Item_func_uncompressed_length(const POS &pos, Item *a)
Definition: item_strfunc.h:1260
String value
Definition: item_strfunc.h:1257
longlong val_int() override
Definition: item_strfunc.cc:4068
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1263
Definition: item_strfunc.h:940
Item_func_unhex(const POS &pos, Item *a)
Definition: item_strfunc.h:944
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:3425
String * val_str(String *) override
Convert given hex string to a binary string.
Definition: item_strfunc.cc:3438
String tmp_value
Definition: item_strfunc.h:941
const char * func_name() const override
Definition: item_strfunc.h:948
Definition: item_strfunc.h:473
Item_func_upper(const POS &pos, Item *item)
Definition: item_strfunc.h:475
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:1495
const char * func_name() const override
Definition: item_strfunc.h:476
Definition: item_strfunc.h:669
Item_func_user(const POS &pos)
Definition: item_strfunc.h:682
table_map get_initial_pseudo_tables() const override
Returns the pseudo tables depended upon in order to evaluate this function expression.
Definition: item_strfunc.h:686
const Name_string fully_qualified_func_name() const override
Definition: item_strfunc.h:710
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_strfunc.cc:2095
String * val_str(String *) override
Definition: item_strfunc.cc:2013
Item_func_sysconst super
Definition: item_strfunc.h:670
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_strfunc.h:704
Item_func_user()
Definition: item_strfunc.h:681
const char * func_name() const override
Definition: item_strfunc.h:709
bool evaluate(const char *user, const char *host)
Evaluate user name, must be called once per execution.
Definition: item_strfunc.cc:2072
type_conversion_status save_in_field_inner(Field *field, bool) override
We override Item::save_in_field_inner() for reasons explained in the comment of that function - we ne...
Definition: item_strfunc.cc:2008
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:700
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_strfunc.h:692
bool m_evaluated
True when function value is evaluated, set to false after each execution.
Definition: item_strfunc.h:674
Definition: item_strfunc.h:876
String * val_str(String *) override
Definition: item_strfunc.cc:2864
Item_func_uuid_to_bin(const POS &pos, Item *arg1, Item *arg2)
Definition: item_strfunc.h:883
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:2855
uchar m_bin_buf[mysql::gtid::Uuid::BYTE_LENGTH]
Buffer to store the binary result.
Definition: item_strfunc.h:878
Item_func_uuid_to_bin(const POS &pos, Item *arg1)
Definition: item_strfunc.h:881
const char * func_name() const override
Definition: item_strfunc.h:887
Definition: item_strfunc.h:1323
Item_func_uuid(const POS &pos)
Definition: item_strfunc.h:1328
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_strfunc.h:1337
table_map get_initial_pseudo_tables() const override
Returns the pseudo tables depended upon in order to evaluate this function expression.
Definition: item_strfunc.h:1331
String * val_str(String *) override
Definition: item_strfunc.cc:4457
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_strfunc.cc:4342
const char * func_name() const override
Definition: item_strfunc.h:1335
Item_func_uuid()
Definition: item_strfunc.h:1327
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:4335
Item_str_func super
Definition: item_strfunc.h:1324
Definition: item_strfunc.h:1210
String * val_str(String *) override
Definition: item_strfunc.cc:3295
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:3251
const char * func_name() const override
Definition: item_strfunc.h:1232
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_strfunc.cc:3239
const uint num_codepoints
Definition: item_strfunc.h:1220
String tmp_value
Definition: item_strfunc.h:1213
Item_str_func super
Definition: item_strfunc.h:1211
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_strfunc.cc:3228
Item_field * m_field_ref
Definition: item_strfunc.h:1216
const uint result_length
Definition: item_strfunc.h:1215
bool eq_specific(const Item *item) const override
Provide a more specific equality check for a function.
Definition: item_strfunc.cc:3286
Item_func_weight_string(const POS &pos, Item *a, uint result_length_arg, uint num_codepoints_arg, uint flags_arg, bool as_binary_arg=false)
Definition: item_strfunc.h:1221
const bool as_binary
Definition: item_strfunc.h:1217
uint flags
Definition: item_strfunc.h:1214
Definition: item_func.h:101
Item ** args
Array of pointers to arguments.
Definition: item_func.h:108
bool reject_vector_args()
Definition: item_func.cc:1636
Functype
Definition: item_func.h:214
@ COLLATE_FUNC
Definition: item_func.h:261
@ DD_INTERNAL_FUNC
Definition: item_func.h:271
@ CURRENT_USER_IN_FUNC
Definition: item_func.h:365
@ CURRENT_ROLE_IN_FUNC
Definition: item_func.h:366
@ TYPECAST_FUNC
Definition: item_func.h:263
virtual const char * func_name() const =0
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:530
uint arg_count
How many arguments in 'args'.
Definition: item_func.h:131
bool null_on_null
Affects how to determine that NULL argument implies a NULL function return.
Definition: item_func.h:187
Definition: item_func.h:1048
Definition: item_strfunc.h:1077
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_strfunc.cc:3689
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1091
String tmp_value
Definition: item_strfunc.h:1080
Item_str_func super
Definition: item_strfunc.h:1078
String * val_str(String *) override
Definition: item_strfunc.cc:3697
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_strfunc.h:1099
Item_load_file(const POS &pos, Item *a)
Definition: item_strfunc.h:1083
const char * func_name() const override
Definition: item_strfunc.h:1087
table_map get_initial_pseudo_tables() const override
Returns the pseudo tables depended upon in order to evaluate this function expression.
Definition: item_strfunc.h:1088
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item.cc:11689
Definition: item_strfunc.h:152
Item_str_ascii_func(Item *a, Item *b)
Definition: item_strfunc.h:167
Item_str_ascii_func(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_strfunc.h:178
String * val_str_ascii(String *) override=0
Item_str_ascii_func()
Definition: item_strfunc.h:156
Item_str_ascii_func(Item *a, Item *b, Item *c)
Definition: item_strfunc.h:175
String ascii_buf
Definition: item_strfunc.h:153
Item_str_ascii_func(const POS &pos, Item *a, Item *b)
Definition: item_strfunc.h:170
Item_str_ascii_func(const POS &pos, Item *a)
Definition: item_strfunc.h:163
Item_str_ascii_func(Item *a)
Definition: item_strfunc.h:160
String * val_str(String *str) override
Definition: item_strfunc.h:183
Definition: item_strfunc.h:455
String * val_str(String *) override
Definition: item_strfunc.cc:1451
Item_str_conv(const POS &pos, Item *item)
Definition: item_strfunc.h:462
String tmp_value
Definition: item_strfunc.h:459
uint multiply
Definition: item_strfunc.h:457
my_charset_conv_case converter
Definition: item_strfunc.h:458
Definition: item_strfunc.h:79
Item_str_func()
Definition: item_strfunc.h:83
String * val_str_from_val_str_ascii(String *str, String *str2)
Definition: item_strfunc.cc:155
Item_str_func(Item *a, Item *b)
Definition: item_strfunc.h:91
my_decimal * val_decimal(my_decimal *) override
Definition: item_strfunc.cc:187
String * push_packet_overflow_warning(THD *thd, const char *func)
Calls push_warning_printf for packet overflow.
Definition: item_strfunc.cc:1547
Item_str_func(const POS &pos, PT_item_list *opt_list)
Definition: item_strfunc.h:115
Item_str_func(mem_root_deque< Item * > *list)
Definition: item_strfunc.h:113
Item_str_func(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_strfunc.h:97
bool val_time(Time_val *time) override
Evaluate the item and return result as a time value.
Definition: item_strfunc.h:124
void add_json_info(Json_object *obj) override
Add all the node-specific json fields.
Definition: item_strfunc.h:144
Item_func super
Definition: item_strfunc.h:80
Item_str_func(Item *a)
Definition: item_strfunc.h:87
Item_str_func(Item *a, Item *b, Item *c, Item *d)
Definition: item_strfunc.h:100
void left_right_max_length(THD *thd)
Definition: item_strfunc.cc:1530
bool val_date(Date_val *date, my_time_flags_t flags) override
Evaluate the item and return result as a date value.
Definition: item_strfunc.h:121
enum Item_result result_type() const override
Definition: item_strfunc.h:128
Item_str_func(Item *a, Item *b, Item *c)
Definition: item_strfunc.h:95
longlong val_int() override
Definition: item_strfunc.h:118
Item_str_func(const POS &pos, Item *a, Item *b, Item *c, Item *d, Item *e, Item *f)
Definition: item_strfunc.h:110
Item_str_func(const POS &pos, Item *a)
Definition: item_strfunc.h:89
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:131
double val_real() override
Definition: item_strfunc.h:119
Item_str_func(const POS &pos)
Definition: item_strfunc.h:85
Item_str_func(const POS &pos, Item *a, Item *b)
Definition: item_strfunc.h:93
Item_str_func(Item *a, Item *b, Item *c, Item *d, Item *e)
Definition: item_strfunc.h:105
bool fix_fields(THD *thd, Item **ref) override
Definition: item_strfunc.cc:177
Item_str_func(const POS &pos, Item *a, Item *b, Item *c, Item *d, Item *e)
Definition: item_strfunc.h:108
Item_str_func(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_strfunc.h:102
bool val_datetime(Datetime_val *dt, my_time_flags_t flags) override
Evaluate the item and return result as a datetime value.
Definition: item_strfunc.h:125
Definition: item_strfunc.h:1055
const char * func_name() const override
Definition: item_strfunc.h:1072
Item_typecast_char(THD *thd, Item *a, longlong length_arg, const CHARSET_INFO *cs_arg)
Definition: item_strfunc.h:1060
Item_typecast_char(const POS &pos, Item *a, longlong length_arg, const CHARSET_INFO *cs_arg)
Definition: item_strfunc.h:1065
enum Functype functype() const override
Definition: item_strfunc.h:1070
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_strfunc.cc:3507
void add_json_info(Json_object *obj) override
Add all the node-specific json fields.
Definition: item_strfunc.cc:3520
bool eq_specific(const Item *item) const override
Provide a more specific equality check for a function.
Definition: item_strfunc.cc:3500
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:935
String str_value
str_values's main purpose is to cache the value in save_in_field
Definition: item.h:3680
void set_nullable(bool nullable)
Definition: item.h:3792
void set_data_type_blob(enum_field_types type, uint32 max_l)
Set the Item to be of BLOB type.
Definition: item.h:1689
DTCollation collation
Character set and collation properties assigned for this Item.
Definition: item.h:3687
virtual Item_field * field_for_view_update()
Definition: item.h:3288
bool fixed
True if item has been resolved.
Definition: item.h:3780
bool null_value
True if item is null.
Definition: item.h:3817
bool get_datetime_from_string(Datetime_val *dt, my_time_flags_t flags)
Convert val_str() to datetime.
Definition: item.cc:1605
bool unsigned_flag
Definition: item.h:3818
bool get_date_from_string(Date_val *date, my_time_flags_t flags)
Convert val_str() to date.
Definition: item.cc:1613
longlong val_int_from_string()
Definition: item.cc:541
void set_data_type_string(uint32 max_l)
Set the Item to be variable length string.
Definition: item.h:1606
bool may_evaluate_const(const THD *thd) const
Return true if this is a const item that may be evaluated in the current phase of statement processin...
Definition: item.cc:1454
virtual String * val_str(String *str)=0
uint32 max_length
Maximum length of result of evaluating this item, in number of bytes.
Definition: item.h:3705
double val_real_from_string()
Definition: item.cc:491
bool get_time_from_string(Time_val *time)
Convert val_str() to time.
Definition: item.cc:1775
Represents a JSON container value of type "object" (ECMA), type J_OBJECT here.
Definition: json_dom.h:374
bool add_alias(std::string_view key, Json_dom *value)
Insert the value into the object.
Definition: json_dom.h:416
Definition: sql_list.h:494
Definition: sql_locale.h:37
Storage for name strings.
Definition: item.h:297
Wrapper class for an Item list head, used to allocate Item lists in the parser in a context-independe...
Definition: parse_tree_helpers.h:109
Base class for parse tree nodes (excluding the Parse_tree_root hierarchy)
Definition: parse_tree_node_base.h:231
A set of THD members describing the current authenticated user.
Definition: sql_security_ctx.h:54
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:169
void mem_free()
Definition: sql_string.h:402
void mark_as_const()
Definition: sql_string.h:249
bool copy()
Definition: sql_string.cc:198
void set(String &str, size_t offset, size_t arg_length)
Definition: sql_string.h:304
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
Time_val is a temporal type that represents only time.
Definition: my_temporal.h:57
A (partial) implementation of std::deque allocating its blocks on a MEM_ROOT.
Definition: mem_root_deque.h:172
my_decimal class limits 'decimal_t' type to what we need in MySQL.
Definition: my_decimal.h:97
constexpr std::array< const char, 37 > dig_vec_lower
Definition: dig_vec.h:36
enum_query_type
Query type constants (usable as bitmap flags).
Definition: enum_query_type.h:31
@ MYSQL_TYPE_LONGLONG
Definition: field_types.h:65
@ MYSQL_TYPE_LONG_BLOB
Definition: field_types.h:87
static const std::string dec("DECRYPTION")
static int flags[50]
Definition: hp_test1.cc:40
static void start(mysql_harness::PluginFuncEnv *env)
Definition: http_auth_backend_plugin.cc:180
#define NAME_STRING(x)
Definition: item.h:357
CHARSET_INFO * mysqld_collation_get_by_name(const char *name, CHARSET_INFO *name_cs=system_charset_info)
Get collation by name, send error to client on failure.
Definition: item_strfunc.cc:5162
String * mysql_generate_uuid(String *str)
Generate Universal Unique Identifier (UUID).
Definition: item_strfunc.cc:4350
void tohex(char *to, uint64_t from, uint len)
Definition: item_strfunc.h:1937
A better implementation of the UNIX ctype(3) library.
MYSQL_STRINGS_EXPORT CHARSET_INFO my_charset_bin
Definition: ctype-bin.cc:499
size_t(* my_charset_conv_case)(const CHARSET_INFO *, char *, size_t, char *, size_t)
Definition: m_ctype.h:336
static constexpr uint32_t MY_CS_UNICODE
Definition: m_ctype.h:130
static constexpr uint32_t MY_REPERTOIRE_ASCII
Definition: m_ctype.h:152
MYSQL_PLUGIN_IMPORT CHARSET_INFO * system_charset_info
Definition: mysqld.cc:1582
Common definition used by mysys, performance schema and server & client.
static constexpr int HOSTNAME_LENGTH
Definition: my_hostname.h:43
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
#define MY_INT32_NUM_DECIMAL_DIGITS
Definition: my_inttypes.h:100
uint32_t uint32
Definition: my_inttypes.h:67
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 int_to_datetime.
Definition: my_time.h:87
Common definition between mysql server & client.
#define MAX_BLOB_WIDTH
Default width for blob in bytes.
Definition: mysql_com.h:913
#define USERNAME_LENGTH
Definition: mysql_com.h:69
#define NAME_CHAR_LEN
Field/table name length.
Definition: mysql_com.h:60
#define USERNAME_CHAR_LENGTH
Definition: mysql_com.h:64
char * user
Definition: mysqladmin.cc:67
const char * host
Definition: mysqladmin.cc:66
static bool replace
Definition: mysqlimport.cc:70
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1077
Definition: applier_version.h:27
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
Container::const_iterator find(const Container &c, Value &&value)
Definition: generic.h:40
std::list< T, ut::allocator< T > > list
Specialization of list which uses ut_allocator.
Definition: ut0new.h:2728
type_conversion_status
Status when storing a value in a field or converting from one datatype to another.
Definition: field.h:200
@ VGS_CHECK_CONSTRAINT
Definition: field.h:474
@ VGS_GENERATED_COLUMN
Definition: field.h:472
@ DERIVATION_COERCIBLE
Definition: field.h:180
@ DERIVATION_SYSCONST
Definition: field.h:181
File containing constants that can be used throughout the server.
constexpr const table_map RAND_TABLE_BIT
Definition: sql_const.h:113
constexpr const table_map INNER_TABLE_BIT
Definition: sql_const.h:111
Our own string classes, used pervasively throughout the executor.
case opt name
Definition: sslopt-case.h:29
Definition: m_ctype.h:421
const char * csname
Definition: m_ctype.h:426
unsigned state
Definition: m_ctype.h:425
Struct used to pass around arguments to/from check_function_as_value_generator.
Definition: item.h:487
const char * banned_function_name
the name of the function which is not allowed
Definition: item.h:501
Value_generator_source source
Definition: item.h:499
Definition: mysql_lex_string.h:40
const char * str
Definition: mysql_lex_string.h:41
size_t length
Definition: mysql_lex_string.h:42
Bison "location" class.
Definition: parse_location.h:43
Instances of Name_resolution_context store the information necessary for name resolution of Items and...
Definition: item.h:414
Environment data for the contextualization phase.
Definition: parse_tree_node_base.h:422
static const size_t TEXT_LENGTH
The number of bytes in the textual representation of a Uuid.
Definition: uuid.h:168
static constexpr std::size_t BYTE_LENGTH
The number of bytes in the data of a Uuid.
Definition: uuid.h:143
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