MySQL 9.7.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#if OPENSSL_VERSION_NUMBER < 0x10100000L
272 EVP_CIPHER_CTX stack_ctx;
273#endif
274
275 public:
276 Item_func_aes_encrypt(const POS &pos, Item *a, Item *b)
277 : Item_str_func(pos, a, b) {
279 }
280 Item_func_aes_encrypt(const POS &pos, Item *a, Item *b, Item *c)
281 : Item_str_func(pos, a, b, c) {
283 }
284 Item_func_aes_encrypt(const POS &pos, Item *a, Item *b, Item *c, Item *d)
285 : Item_str_func(pos, a, b, c, d) {
287 }
288 Item_func_aes_encrypt(const POS &pos, Item *a, Item *b, Item *c, Item *d,
289 Item *e)
290 : Item_str_func(pos, a, b, c, d, e) {
292 }
293 Item_func_aes_encrypt(const POS &pos, Item *a, Item *b, Item *c, Item *d,
294 Item *e, Item *f)
295 : Item_str_func(pos, a, b, c, d, e, f) {
297 }
299
300 void create_op_context();
301 void destroy_op_context();
302 bool do_itemize(Parse_context *pc, Item **res) override;
303 String *val_str(String *) override;
304 bool resolve_type(THD *) override;
305 const char *func_name() const override { return "aes_encrypt"; }
306};
307
310 EVP_CIPHER_CTX *ctx{nullptr};
311#if OPENSSL_VERSION_NUMBER < 0x10100000L
312 EVP_CIPHER_CTX stack_ctx;
313#endif
314
315 public:
316 Item_func_aes_decrypt(const POS &pos, Item *a, Item *b)
317 : Item_str_func(pos, a, b) {
319 }
320 Item_func_aes_decrypt(const POS &pos, Item *a, Item *b, Item *c)
321 : Item_str_func(pos, a, b, c) {
323 }
324 Item_func_aes_decrypt(const POS &pos, Item *a, Item *b, Item *c, Item *d)
325 : Item_str_func(pos, a, b, c, d) {
327 }
328 Item_func_aes_decrypt(const POS &pos, Item *a, Item *b, Item *c, Item *d,
329 Item *e)
330 : Item_str_func(pos, a, b, c, d, e) {
332 }
333 Item_func_aes_decrypt(const POS &pos, Item *a, Item *b, Item *c, Item *d,
334 Item *e, Item *f)
335 : Item_str_func(pos, a, b, c, d, e, f) {
337 }
339
340 void create_op_context();
341 void destroy_op_context();
342 bool do_itemize(Parse_context *pc, Item **res) override;
343 String *val_str(String *) override;
344 bool resolve_type(THD *thd) override;
345 const char *func_name() const override { return "aes_decrypt"; }
346};
347
350
351 /** limitation from the SSL library */
353
354 public:
355 Item_func_random_bytes(const POS &pos, Item *a) : Item_str_func(pos, a) {}
356
357 bool do_itemize(Parse_context *pc, Item **res) override;
358 bool resolve_type(THD *thd) override;
359 String *val_str(String *a) override;
360
361 const char *func_name() const override { return "random_bytes"; }
363 return RAND_TABLE_BIT;
364 }
365};
366
368 String tmp_value{"", 0, collation.collation}; // Initialize to empty
369 public:
370 Item_func_concat(const POS &pos, PT_item_list *opt_list)
371 : Item_str_func(pos, opt_list) {}
373 Item_func_concat(const POS &pos, Item *a, Item *b)
374 : Item_str_func(pos, a, b) {}
375
376 String *val_str(String *) override;
377 bool resolve_type(THD *thd) override;
378 const char *func_name() const override { return "concat"; }
379};
380
382 String tmp_value{"", 0, collation.collation}; // Initialize to empty
383 public:
386 null_on_null = false;
387 }
388 Item_func_concat_ws(const POS &pos, PT_item_list *opt_list)
389 : Item_str_func(pos, opt_list) {
390 null_on_null = false;
391 }
392 String *val_str(String *) override;
393 bool resolve_type(THD *thd) override;
394 const char *func_name() const override { return "concat_ws"; }
395};
396
397/**
398 This class represents the function ETAG which is used to traverse the input
399 arguments and compute a 128 bits hash value.
400 */
403
404 public:
405 Item_func_etag(const POS &pos, PT_item_list *opt_list)
406 : Item_str_func(pos, opt_list) {}
408
409 String *val_str(String *) override;
410 bool resolve_type(THD *thd) override;
411 const char *func_name() const override { return "etag"; }
412 bool check_function_as_value_generator(uchar *checker_args) override {
414 pointer_cast<Check_function_as_value_generator_parameters *>(
415 checker_args);
416 func_arg->banned_function_name = func_name();
417 return ((func_arg->source == VGS_GENERATED_COLUMN) ||
418 (func_arg->source == VGS_CHECK_CONSTRAINT));
419 }
420};
421
424
425 public:
427 Item_func_reverse(const POS &pos, Item *a) : Item_str_func(pos, a) {}
428
429 String *val_str(String *) override;
430 bool resolve_type(THD *thd) override;
431 const char *func_name() const override { return "reverse"; }
432};
433
436 /// Holds result in case we need to allocate our own result buffer.
438
439 public:
441 : Item_str_func(pos, org, find, replace) {}
442 String *val_str(String *) override;
443 bool resolve_type(THD *thd) override;
444 const char *func_name() const override { return "replace"; }
445};
446
449 /// Holds result in case we need to allocate our own result buffer.
451
452 public:
454 Item *new_str)
455 : Item_str_func(pos, org, start, length, new_str) {}
456 String *val_str(String *) override;
457 bool resolve_type(THD *thd) override;
458 const char *func_name() const override { return "insert"; }
459};
460
462 protected:
466
467 public:
468 Item_str_conv(const POS &pos, Item *item) : Item_str_func(pos, item) {}
469 String *val_str(String *) override;
470};
471
473 public:
474 Item_func_lower(const POS &pos, Item *item) : Item_str_conv(pos, item) {}
475 const char *func_name() const override { return "lower"; }
476 bool resolve_type(THD *) override;
477};
478
480 public:
481 Item_func_upper(const POS &pos, Item *item) : Item_str_conv(pos, item) {}
482 const char *func_name() const override { return "upper"; }
483 bool resolve_type(THD *) override;
484};
485
488
489 public:
490 Item_func_left(const POS &pos, Item *a, Item *b) : Item_str_func(pos, a, b) {}
491 String *val_str(String *) override;
492 bool resolve_type(THD *thd) override;
493 const char *func_name() const override { return "left"; }
494};
495
498
499 public:
500 Item_func_right(const POS &pos, Item *a, Item *b)
501 : Item_str_func(pos, a, b) {}
502 String *val_str(String *) override;
503 bool resolve_type(THD *thd) override;
504 const char *func_name() const override { return "right"; }
505};
506
509
511
512 public:
514 Item_func_substr(const POS &pos, Item *a, Item *b) : super(pos, a, b) {}
515
516 Item_func_substr(Item *a, Item *b, Item *c) : Item_str_func(a, b, c) {}
517 Item_func_substr(const POS &pos, Item *a, Item *b, Item *c)
518 : super(pos, a, b, c) {}
519
520 String *val_str(String *) override;
521 bool resolve_type(THD *thd) override;
522 const char *func_name() const override { return "substr"; }
523};
524
527
528 public:
529 Item_func_substr_index(const POS &pos, Item *a, Item *b, Item *c)
530 : Item_str_func(pos, a, b, c) {}
531 String *val_str(String *) override;
532 bool resolve_type(THD *) override;
533 const char *func_name() const override { return "substring_index"; }
534};
535
537 public:
538 /**
539 Why all the trim modes in this enum?
540 We need to maintain parsing information, so that our print() function
541 can reproduce correct messages and view definitions.
542 */
550 };
551
552 private:
556 const bool m_trim_leading;
557 const bool m_trim_trailing;
558
559 public:
561 : Item_str_func(a, b),
562 m_trim_mode(tm),
565
566 Item_func_trim(const POS &pos, Item *a, Item *b, TRIM_MODE tm)
567 : Item_str_func(pos, a, b),
568 m_trim_mode(tm),
571
573 : Item_str_func(a),
574 m_trim_mode(tm),
577
578 Item_func_trim(const POS &pos, Item *a, TRIM_MODE tm)
579 : Item_str_func(pos, a),
580 m_trim_mode(tm),
583
584 bool trim_leading() const {
587 }
588
589 bool trim_trailing() const {
592 }
593
594 String *val_str(String *) override;
595 bool resolve_type(THD *) override;
596 const char *func_name() const override {
597 switch (m_trim_mode) {
599 return "trim";
600 case TRIM_BOTH:
601 return "trim";
602 case TRIM_LEADING:
603 return "ltrim";
604 case TRIM_TRAILING:
605 return "rtrim";
606 case TRIM_LTRIM:
607 return "ltrim";
608 case TRIM_RTRIM:
609 return "rtrim";
610 }
611 return nullptr;
612 }
613 void print(const THD *thd, String *str,
614 enum_query_type query_type) const override;
615};
616
617class Item_func_ltrim final : public Item_func_trim {
618 public:
619 Item_func_ltrim(const POS &pos, Item *a)
620 : Item_func_trim(pos, a, TRIM_LTRIM) {}
621};
622
623class Item_func_rtrim final : public Item_func_trim {
624 public:
625 Item_func_rtrim(const POS &pos, Item *a)
626 : Item_func_trim(pos, a, TRIM_RTRIM) {}
627};
628
631
632 public:
635 }
636 explicit Item_func_sysconst(const POS &pos) : super(pos) {
638 }
639 /*
640 Used to create correct Item name in new converted item in
641 safe_charset_converter, return string representation of this function
642 call
643 */
644 virtual const Name_string fully_qualified_func_name() const = 0;
645 bool check_function_as_value_generator(uchar *checker_args) override {
647 pointer_cast<Check_function_as_value_generator_parameters *>(
648 checker_args);
649 func_arg->banned_function_name = func_name();
650 return ((func_arg->source == VGS_GENERATED_COLUMN) ||
651 (func_arg->source == VGS_CHECK_CONSTRAINT));
652 }
653};
654
657
658 public:
659 explicit Item_func_database(const POS &pos) : Item_func_sysconst(pos) {}
660
661 bool do_itemize(Parse_context *pc, Item **res) override;
662
663 String *val_str(String *) override;
664 bool resolve_type(THD *) override {
666 set_nullable(true);
667 return false;
668 }
669 const char *func_name() const override { return "database"; }
670 const Name_string fully_qualified_func_name() const override {
671 return NAME_STRING("database()");
672 }
673};
674
677
678 protected:
679 /// True when function value is evaluated, set to false after each execution
680 bool m_evaluated = false;
681
682 /// Evaluate user name, must be called once per execution
683 bool evaluate(const char *user, const char *host);
684 type_conversion_status save_in_field_inner(Field *field, bool) override;
685
686 public:
688 explicit Item_func_user(const POS &pos) : super(pos) {
690 }
691
693 return INNER_TABLE_BIT;
694 }
695
696 bool do_itemize(Parse_context *pc, Item **res) override;
697
698 bool check_function_as_value_generator(uchar *checker_args) override {
700 pointer_cast<Check_function_as_value_generator_parameters *>(
701 checker_args);
702 func_arg->banned_function_name = func_name();
703 return ((func_arg->source == VGS_GENERATED_COLUMN) ||
704 (func_arg->source == VGS_CHECK_CONSTRAINT));
705 }
706 bool resolve_type(THD *) override {
708 return false;
709 }
710 void cleanup() override {
711 m_evaluated = false;
714 }
715 const char *func_name() const override { return "user"; }
716 const Name_string fully_qualified_func_name() const override {
717 return NAME_STRING("user()");
718 }
719
720 String *val_str(String *) override;
721};
722
725 /**
726 Used to pass a security context to the resolver functions.
727 Only used for definer views. In all other contexts, the security context
728 passed here is nullptr and is instead looked up dynamically at run time
729 from the current THD.
730 */
732
733 /// Copied from m_name_resolution_ctx in fix_fields if the definer
734 /// Security_context is set in Name_resolution_context
737
738 protected:
739 type_conversion_status save_in_field_inner(Field *field, bool) override;
740
741 /// Overridden to copy definer priv_user and priv_host
742 bool resolve_type(THD *) override;
743
744 public:
745 explicit Item_func_current_user(const POS &pos) : super(pos) {}
746
747 bool do_itemize(Parse_context *pc, Item **res) override;
748 const char *func_name() const override { return "current_user"; }
749 const Name_string fully_qualified_func_name() const override {
750 return NAME_STRING("current_user()");
751 }
752
753 String *val_str(String *) override;
754};
755
758
759 public:
761 Item_func_soundex(const POS &pos, Item *a) : Item_str_func(pos, a) {}
762 String *val_str(String *) override;
763 bool resolve_type(THD *thd) override;
764 const char *func_name() const override { return "soundex"; }
765};
766
767class Item_func_elt final : public Item_str_func {
768 public:
769 Item_func_elt(const POS &pos, PT_item_list *opt_list)
770 : Item_str_func(pos, opt_list) {}
771 double val_real() override;
772 longlong val_int() override;
773 String *val_str(String *str) override;
774 bool resolve_type(THD *thd) override;
775 const char *func_name() const override { return "elt"; }
776};
777
778class Item_func_make_set final : public Item_str_func {
780
782
783 public:
784 Item_func_make_set(const POS &pos, PT_item_list *opt_list)
785 : Item_str_func(pos, opt_list) {}
786
787 String *val_str(String *str) override;
788 bool fix_fields(THD *thd, Item **ref) override;
789 bool resolve_type(THD *) override;
790 const char *func_name() const override { return "make_set"; }
791
792 void print(const THD *thd, String *str,
793 enum_query_type query_type) const override;
794};
795
799
800 public:
801 Item_func_format(const POS &pos, Item *org, Item *dec)
802 : Item_str_ascii_func(pos, org, dec) {}
803 Item_func_format(const POS &pos, Item *org, Item *dec, Item *lang)
804 : Item_str_ascii_func(pos, org, dec, lang) {}
805
806 MY_LOCALE *get_locale(Item *item);
807 String *val_str_ascii(String *) override;
808 bool resolve_type(THD *thd) override;
809 const char *func_name() const override { return "format"; }
810 void print(const THD *thd, String *str,
811 enum_query_type query_type) const override;
812};
813
814class Item_func_char final : public Item_str_func {
815 public:
817 : Item_str_func(pos, list) {
819 null_on_null = false;
820 }
822 : Item_str_func(pos, list) {
824 null_on_null = false;
825 }
826 String *val_str(String *) override;
827 bool resolve_type(THD *thd) override {
828 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_LONGLONG)) return true;
829 if (reject_vector_args()) return true;
831 return false;
832 }
833 const char *func_name() const override { return "char"; }
834 void add_json_info(Json_object *obj) override {
836 obj->add_alias("charset",
837 create_dom_ptr<Json_string>(collation.collation->csname));
838 }
839};
840
841class Item_func_repeat final : public Item_str_func {
843
844 public:
845 Item_func_repeat(const POS &pos, Item *arg1, Item *arg2)
846 : Item_str_func(pos, arg1, arg2) {}
847 String *val_str(String *) override;
848 bool resolve_type(THD *thd) override;
849 const char *func_name() const override { return "repeat"; }
850};
851
852class Item_func_space final : public Item_str_func {
853 public:
854 Item_func_space(const POS &pos, Item *arg1) : Item_str_func(pos, arg1) {}
855 String *val_str(String *) override;
856 bool resolve_type(THD *) override;
857 const char *func_name() const override { return "space"; }
858};
859
860class Item_func_rpad final : public Item_str_func {
862
863 public:
864 Item_func_rpad(const POS &pos, Item *arg1, Item *arg2, Item *arg3)
865 : Item_str_func(pos, arg1, arg2, arg3) {}
866 String *val_str(String *) override;
867 bool resolve_type(THD *) override;
868 const char *func_name() const override { return "rpad"; }
869};
870
871class Item_func_lpad final : public Item_str_func {
873
874 public:
875 Item_func_lpad(const POS &pos, Item *arg1, Item *arg2, Item *arg3)
876 : Item_str_func(pos, arg1, arg2, arg3) {}
877 String *val_str(String *) override;
878 bool resolve_type(THD *) override;
879 const char *func_name() const override { return "lpad"; }
880};
881
883 /// Buffer to store the binary result
885
886 public:
887 Item_func_uuid_to_bin(const POS &pos, Item *arg1)
888 : Item_str_func(pos, arg1) {}
889 Item_func_uuid_to_bin(const POS &pos, Item *arg1, Item *arg2)
890 : Item_str_func(pos, arg1, arg2) {}
891 String *val_str(String *) override;
892 bool resolve_type(THD *) override;
893 const char *func_name() const override { return "uuid_to_bin"; }
894};
895
897 /// Buffer to store the text result
899
900 public:
901 Item_func_bin_to_uuid(const POS &pos, Item *arg1)
902 : Item_str_ascii_func(pos, arg1) {}
903 Item_func_bin_to_uuid(const POS &pos, Item *arg1, Item *arg2)
904 : Item_str_ascii_func(pos, arg1, arg2) {}
905 String *val_str_ascii(String *) override;
906 bool resolve_type(THD *thd) override;
907 const char *func_name() const override { return "bin_to_uuid"; }
908};
909
910class Item_func_is_uuid final : public Item_bool_func {
912
913 public:
914 Item_func_is_uuid(const POS &pos, Item *a) : Item_bool_func(pos, a) {}
915 longlong val_int() override;
916 const char *func_name() const override { return "is_uuid"; }
917 bool resolve_type(THD *thd) override {
918 if (reject_vector_args()) return true;
919 bool res = super::resolve_type(thd);
920 set_nullable(true);
921 return res;
922 }
923};
924
925class Item_func_conv final : public Item_str_func {
926 public:
927 // 64 digits plus possible '-'.
928 static constexpr uint32_t CONV_MAX_LENGTH = 64U + 1U;
929 Item_func_conv(const POS &pos, Item *a, Item *b, Item *c)
930 : Item_str_func(pos, a, b, c) {}
931 const char *func_name() const override { return "conv"; }
932 String *val_str(String *) override;
933 bool resolve_type(THD *) override;
934};
935
938
939 public:
940 Item_func_hex(const POS &pos, Item *a) : Item_str_ascii_func(pos, a) {}
941 const char *func_name() const override { return "hex"; }
942 String *val_str_ascii(String *) override;
943 bool resolve_type(THD *thd) override;
944};
945
946class Item_func_unhex final : public Item_str_func {
948
949 public:
950 Item_func_unhex(const POS &pos, Item *a) : Item_str_func(pos, a) {
951 /* there can be bad hex strings */
952 set_nullable(true);
953 }
954 const char *func_name() const override { return "unhex"; }
955 String *val_str(String *) override;
956 bool resolve_type(THD *thd) override;
957};
958
959#ifndef NDEBUG
961 protected:
964 const bool is_min;
965
966 public:
967 Item_func_like_range(const POS &pos, Item *a, Item *b, bool is_min_arg)
968 : Item_str_func(pos, a, b), is_min(is_min_arg) {
969 set_nullable(true);
970 }
971 String *val_str(String *) override;
972 bool resolve_type(THD *thd) override {
973 if (param_type_is_default(thd, 0, 1)) return true;
974 if (param_type_is_default(thd, 1, 2, MYSQL_TYPE_LONGLONG)) return true;
975 if (reject_vector_args()) return true;
977 return false;
978 }
979};
980
982 public:
984 : Item_func_like_range(pos, a, b, true) {}
985 const char *func_name() const override { return "like_range_min"; }
986};
987
989 public:
991 : Item_func_like_range(pos, a, b, false) {}
992 const char *func_name() const override { return "like_range_max"; }
993};
994#endif
995
996/**
997 The following types of conversions are considered safe:
998
999 Conversion to and from "binary".
1000 Conversion to Unicode.
1001 Other kind of conversions are potentially lossy.
1002*/
1004 protected:
1005 /// If true, conversion is needed so do it, else allow string copy.
1007 /// The character set we are converting to
1009 /// The character set we are converting from
1010 const CHARSET_INFO *m_from_cs{nullptr};
1012 /// Marks whether the underlying Item is constant and may be cached.
1014 /// Length argument value, if any given.
1015 longlong m_cast_length{-1}; // a priori not used
1016 public:
1018
1019 protected:
1020 /**
1021 Helper for CAST and CONVERT type resolution: common logic to compute the
1022 maximum numbers of characters of the type of the conversion.
1023
1024 @returns the maximum numbers of characters possible after the conversion
1025 */
1027
1028 bool resolve_type(THD *thd) override;
1029
1030 void add_json_info(Json_object *obj) override {
1032 obj->add_alias("charset", create_dom_ptr<Json_string>(m_cast_cs->csname));
1033 }
1034
1035 public:
1037 bool cache_if_const)
1038 : Item_str_func(a), m_cast_cs(cs_arg) {
1039 if (cache_if_const && args[0]->may_evaluate_const(thd)) {
1040 uint errors = 0;
1041 String tmp, *str = args[0]->val_str(&tmp);
1042 if (!str || str_value.copy(str->ptr(), str->length(), str->charset(),
1043 m_cast_cs, &errors))
1044 null_value = true;
1045 m_use_cached_value = true;
1047 m_safe = (errors == 0);
1048 } else {
1049 m_use_cached_value = false;
1050 // Marks whether the conversion is safe
1052 cs_arg == &my_charset_bin || (cs_arg->state & MY_CS_UNICODE));
1053 }
1054 }
1055 Item_charset_conversion(const POS &pos, Item *a, const CHARSET_INFO *cs_arg)
1056 : Item_str_func(pos, a), m_cast_cs(cs_arg) {}
1057
1058 String *val_str(String *) override;
1059};
1060
1062 protected:
1063 void add_json_info(Json_object *obj) override;
1064
1065 public:
1066 Item_typecast_char(THD *thd, Item *a, longlong length_arg,
1067 const CHARSET_INFO *cs_arg)
1068 : Item_charset_conversion(thd, a, cs_arg, false) {
1069 m_cast_length = length_arg;
1070 }
1071 Item_typecast_char(const POS &pos, Item *a, longlong length_arg,
1072 const CHARSET_INFO *cs_arg)
1073 : Item_charset_conversion(pos, a, cs_arg) {
1074 m_cast_length = length_arg;
1075 }
1076 enum Functype functype() const override { return TYPECAST_FUNC; }
1077 bool eq_specific(const Item *item) const override;
1078 const char *func_name() const override { return "cast_as_char"; }
1079 void print(const THD *thd, String *str,
1080 enum_query_type query_type) const override;
1081};
1082
1083class Item_load_file final : public Item_str_func {
1085
1087
1088 public:
1089 Item_load_file(const POS &pos, Item *a) : Item_str_func(pos, a) {}
1090
1091 bool do_itemize(Parse_context *pc, Item **res) override;
1092 String *val_str(String *) override;
1093 const char *func_name() const override { return "load_file"; }
1095 return INNER_TABLE_BIT;
1096 }
1097 bool resolve_type(THD *thd) override {
1098 if (param_type_is_default(thd, 0, 1)) return true;
1099 if (reject_vector_args()) return true;
1102 set_nullable(true);
1103 return false;
1104 }
1105 bool check_function_as_value_generator(uchar *checker_args) override {
1107 pointer_cast<Check_function_as_value_generator_parameters *>(
1108 checker_args);
1109 func_arg->banned_function_name = func_name();
1110 return true;
1111 }
1112};
1113
1115 public:
1116 Item_func_export_set(const POS &pos, Item *a, Item *b, Item *c)
1117 : Item_str_func(pos, a, b, c) {}
1118 Item_func_export_set(const POS &pos, Item *a, Item *b, Item *c, Item *d)
1119 : Item_str_func(pos, a, b, c, d) {}
1120 Item_func_export_set(const POS &pos, Item *a, Item *b, Item *c, Item *d,
1121 Item *e)
1122 : Item_str_func(pos, a, b, c, d, e) {}
1123 String *val_str(String *str) override;
1124 bool resolve_type(THD *) override;
1125 const char *func_name() const override { return "export_set"; }
1126};
1127
1130
1131 public:
1132 Item_func_quote(const POS &pos, Item *a) : Item_str_func(pos, a) {}
1133 const char *func_name() const override { return "quote"; }
1134 String *val_str(String *) override;
1135 bool resolve_type(THD *thd) override;
1136};
1137
1139 public:
1141 : Item_charset_conversion(pos, a, cs) {
1142 m_safe = false;
1143 }
1144
1146 bool cache_if_const)
1147 : Item_charset_conversion(thd, a, cs, cache_if_const) {
1148 assert(args[0]->fixed);
1149 }
1150 const char *func_name() const override { return "convert"; }
1151 void print(const THD *thd, String *str,
1152 enum_query_type query_type) const override;
1153 bool eq_specific(const Item *item) const override;
1154};
1155
1158
1160
1161 public:
1163 const LEX_CSTRING &collation_string_arg)
1164 : super(pos, a, nullptr), collation_string(collation_string_arg) {}
1165
1166 bool do_itemize(Parse_context *pc, Item **res) override;
1167 String *val_str(String *) override;
1168 bool resolve_type(THD *) override;
1169 bool eq(const Item *item) const override;
1170 const char *func_name() const override { return "collate"; }
1171 enum Functype functype() const override { return COLLATE_FUNC; }
1172 void print(const THD *thd, String *str,
1173 enum_query_type query_type) const override;
1175 /* this function is transparent for view updating */
1176 return args[0]->field_for_view_update();
1177 }
1178
1179 protected:
1180 void add_json_info(Json_object *obj) override {
1181 obj->add_alias("collation",
1182 create_dom_ptr<Json_string>(collation_string.str,
1184 }
1185};
1186
1187class Item_func_charset final : public Item_str_func {
1188 public:
1189 Item_func_charset(const POS &pos, Item *a) : Item_str_func(pos, a) {
1190 null_on_null = false;
1191 }
1192 String *val_str(String *) override;
1193 const char *func_name() const override { return "charset"; }
1194 bool resolve_type(THD *thd) override {
1196 set_nullable(false);
1197 return Item_str_func::resolve_type(thd);
1198 }
1199};
1200
1202 public:
1203 Item_func_collation(const POS &pos, Item *a) : Item_str_func(pos, a) {
1204 null_on_null = false;
1205 }
1206 String *val_str(String *) override;
1207 const char *func_name() const override { return "collation"; }
1208 bool resolve_type(THD *thd) override {
1209 if (Item_str_func::resolve_type(thd)) return true;
1211 set_nullable(false);
1212 return false;
1213 }
1214};
1215
1218
1220 uint flags;
1221 const uint result_length;
1223 const bool as_binary;
1224
1225 public:
1226 const uint num_codepoints;
1227 Item_func_weight_string(const POS &pos, Item *a, uint result_length_arg,
1228 uint num_codepoints_arg, uint flags_arg,
1229 bool as_binary_arg = false)
1230 : Item_str_func(pos, a),
1231 flags(flags_arg),
1232 result_length(result_length_arg),
1233 as_binary(as_binary_arg),
1234 num_codepoints(num_codepoints_arg) {}
1235
1236 bool do_itemize(Parse_context *pc, Item **res) override;
1237
1238 const char *func_name() const override { return "weight_string"; }
1239 bool eq_specific(const Item *item) const override;
1240 String *val_str(String *) override;
1241 bool resolve_type(THD *) override;
1242 void print(const THD *thd, String *str,
1243 enum_query_type query_type) const override;
1244};
1245
1246class Item_func_crc32 final : public Item_int_func {
1248
1249 public:
1250 Item_func_crc32(const POS &pos, Item *a) : Item_int_func(pos, a) {
1251 unsigned_flag = true;
1252 }
1253 const char *func_name() const override { return "crc32"; }
1254 bool resolve_type(THD *thd) override {
1255 if (param_type_is_default(thd, 0, 1)) return true;
1256 max_length = 10;
1257 return false;
1258 }
1259 longlong val_int() override;
1260};
1261
1264
1265 public:
1267 : Item_int_func(pos, a) {}
1268 const char *func_name() const override { return "uncompressed_length"; }
1269 bool resolve_type(THD *thd) override {
1270 if (param_type_is_default(thd, 0, 1)) return true;
1271 if (reject_vector_args()) return true;
1272 max_length = 10;
1273 return false;
1274 }
1275 longlong val_int() override;
1276};
1277
1278class Item_func_compress final : public Item_str_func {
1280
1281 public:
1282 Item_func_compress(const POS &pos, Item *a) : Item_str_func(pos, a) {}
1283 bool resolve_type(THD *thd) override;
1284 const char *func_name() const override { return "compress"; }
1285 String *val_str(String *str) override;
1286};
1287
1290
1291 public:
1292 Item_func_to_vector(const POS &pos, Item *a) : Item_str_func(pos, a) {}
1293 bool resolve_type(THD *thd) override;
1294 const char *func_name() const override { return "to_vector"; }
1295 String *val_str(String *str) override;
1296};
1297
1299 static const uint32 per_value_chars = 16;
1303
1304 public:
1307 : Item_str_ascii_func(pos, a) {}
1308 bool resolve_type(THD *thd) override;
1309 const char *func_name() const override { return "from_vector"; }
1310 String *val_str_ascii(String *str) override;
1311};
1312
1315
1316 public:
1317 Item_func_uncompress(const POS &pos, Item *a) : Item_str_func(pos, a) {}
1318 bool resolve_type(THD *thd) override {
1319 if (reject_vector_args()) return true;
1320 if (Item_str_func::resolve_type(thd)) return true;
1321 set_nullable(true);
1323 return false;
1324 }
1325 const char *func_name() const override { return "uncompress"; }
1326 String *val_str(String *str) override;
1327};
1328
1329class Item_func_uuid final : public Item_str_func {
1331
1332 public:
1334 explicit Item_func_uuid(const POS &pos) : Item_str_func(pos) {}
1335
1336 bool do_itemize(Parse_context *pc, Item **res) override;
1338 return RAND_TABLE_BIT;
1339 }
1340 bool resolve_type(THD *) override;
1341 const char *func_name() const override { return "uuid"; }
1342 String *val_str(String *) override;
1343 bool check_function_as_value_generator(uchar *checker_args) override {
1345 pointer_cast<Check_function_as_value_generator_parameters *>(
1346 checker_args);
1347 func_arg->banned_function_name = func_name();
1348 return ((func_arg->source == VGS_GENERATED_COLUMN) ||
1349 (func_arg->source == VGS_CHECK_CONSTRAINT));
1350 }
1351};
1352
1355
1356 public:
1358 explicit Item_func_current_role(const POS &pos)
1359 : super(pos), value_cache_set(false) {}
1360 const char *func_name() const override { return "current_role"; }
1361 void cleanup() override;
1362 String *val_str(String *) override;
1363 bool resolve_type(THD *) override {
1365 return false;
1366 }
1368 return NAME_STRING("current_role()");
1369 }
1370
1371 protected:
1372 void set_current_role(THD *thd);
1373 /** a flag whether @ref value_cache is set or not */
1375 /**
1376 @brief Cache for the result value
1377
1378 Set by init(). And consumed by val_str().
1379 Needed to avoid re-calculation of the current_roles() in the
1380 course of the query.
1381 */
1383};
1384
1387
1388 public:
1390 explicit Item_func_roles_graphml(const POS &pos)
1391 : super(pos), value_cache_set(false) {}
1392 String *val_str(String *) override;
1393 void cleanup() override;
1394
1395 bool resolve_type(THD *) override {
1397 return false;
1398 }
1399
1400 const char *func_name() const override { return "roles_graphml"; }
1401
1403 return NAME_STRING("roles_graphml()");
1404 }
1405
1406 protected:
1407 bool calculate_graphml(THD *thd);
1408 /**
1409 @brief Cache for the result value
1410
1411 Set by init(). And consumed by val_str().
1412 Needed to avoid re-calculation of the current_roles() in the
1413 course of the query.
1414 */
1416
1417 /** Set to true if @ref value_cache is set */
1419};
1420
1422 public:
1424 : Item_str_func(pos, a, b, c) {}
1425
1426 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1427 bool resolve_type(THD *) override {
1428 /*
1429 There are 14 kinds of grants, with a max length
1430 per privileges is 11 chars.
1431 So, setting max approximate to 200.
1432 */
1434 set_nullable(true);
1435 null_on_null = false;
1436
1437 return false;
1438 }
1439
1440 const char *func_name() const override { return "get_dd_column_privileges"; }
1441
1442 String *val_str(String *) override;
1443};
1444
1446 public:
1448 : Item_str_func(pos, a, b, c) {}
1449
1450 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1451 bool resolve_type(THD *) override {
1452 // maximum string length of all options is expected
1453 // to be less than 256 characters.
1455 set_nullable(false);
1456 null_on_null = false;
1457
1458 return false;
1459 }
1460
1461 const char *func_name() const override { return "get_dd_create_options"; }
1462
1463 String *val_str(String *) override;
1464};
1465
1467 public:
1469 : Item_str_func(pos, a) {}
1470
1471 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1472 bool resolve_type(THD *) override {
1473 // maximum string length of all options is expected
1474 // to be less than 256 characters.
1476 set_nullable(false);
1477 null_on_null = false;
1478
1479 return false;
1480 }
1481
1482 const char *func_name() const override { return "get_dd_schema_options"; }
1483
1484 String *val_str(String *) override;
1485};
1486
1488 public:
1490 : Item_str_func(pos, list) {}
1491
1492 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1493 bool resolve_type(THD *) override {
1494 /*
1495 maximum expected string length to be less than 2048 characters,
1496 which is same as size of column holding comments in dictionary,
1497 i.e., the mysql.tables.comment DD column.
1498 */
1500 set_nullable(true);
1501 null_on_null = false;
1502
1503 return false;
1504 }
1505
1506 const char *func_name() const override {
1507 return "internal_get_comment_or_error";
1508 }
1509
1510 String *val_str(String *) override;
1511};
1512
1514 public:
1516 : Item_str_func(pos, a, b) {}
1517
1518 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1519 bool resolve_type(THD *) override {
1520 /* maximum string length of the property value is expected
1521 to be less than 256 characters. */
1523 set_nullable(false);
1524 null_on_null = false;
1525
1526 return false;
1527 }
1528
1529 const char *func_name() const override {
1530 return "get_dd_tablespace_private_data";
1531 }
1532
1533 String *val_str(String *) override;
1534};
1535
1537 public:
1539 : Item_str_func(pos, a, b) {}
1540
1541 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1542 bool resolve_type(THD *) override {
1543 /* maximum string length of the property value is expected
1544 to be less than 256 characters. */
1546 set_nullable(false);
1547 null_on_null = false;
1548
1549 return false;
1550 }
1551
1552 const char *func_name() const override { return "get_dd_index_private_data"; }
1553
1554 String *val_str(String *) override;
1555};
1556
1558 public:
1560 : Item_str_func(pos, a) {}
1561
1562 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1563 bool resolve_type(THD *) override {
1564 // maximum string length of all options is expected
1565 // to be less than 256 characters.
1567 set_nullable(true);
1568 null_on_null = false;
1569
1570 return false;
1571 }
1572
1573 const char *func_name() const override {
1574 return "internal_get_partition_nodegroup";
1575 }
1576
1577 String *val_str(String *) override;
1578};
1579
1581 public:
1583 Item *d)
1584 : Item_str_func(pos, a, b, c, d) {}
1585
1586 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1587 bool resolve_type(THD *) override {
1588 // maximum string length of all options is expected
1589 // to be less than 256 characters.
1591 set_nullable(true);
1592 null_on_null = false;
1593
1594 return false;
1595 }
1596
1597 const char *func_name() const override { return "internal_tablespace_type"; }
1598
1599 String *val_str(String *) override;
1600};
1601
1603 public:
1605 Item *b, Item *c, Item *d)
1606 : Item_str_func(pos, a, b, c, d) {}
1607
1608 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1609 bool resolve_type(THD *) override {
1610 // maximum string length of all options is expected
1611 // to be less than 256 characters.
1613 set_nullable(true);
1614 null_on_null = false;
1615
1616 return false;
1617 }
1618
1619 const char *func_name() const override {
1620 return "internal_tablespace_logfile_group_name";
1621 }
1622
1623 String *val_str(String *) override;
1624};
1625
1627 public:
1629 Item *c, Item *d)
1630 : Item_str_func(pos, a, b, c, d) {}
1631
1632 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1633 bool resolve_type(THD *) override {
1634 // maximum string length of all options is expected
1635 // to be less than 256 characters.
1637 set_nullable(true);
1638 null_on_null = false;
1639
1640 return false;
1641 }
1642
1643 const char *func_name() const override {
1644 return "internal_tablespace_status";
1645 }
1646 String *val_str(String *) override;
1647};
1648
1650 public:
1652 Item *c, Item *d)
1653 : Item_str_func(pos, a, b, c, d) {}
1654
1655 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1656 bool resolve_type(THD *) override {
1657 // maximum string length of all options is expected
1658 // to be less than 256 characters.
1660 set_nullable(true);
1661 null_on_null = false;
1662
1663 return false;
1664 }
1665
1666 const char *func_name() const override {
1667 return "internal_tablespace_row_format";
1668 }
1669
1670 String *val_str(String *) override;
1671};
1672
1674 public:
1676 Item *d)
1677 : Item_str_func(pos, a, b, c, d) {}
1678
1679 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1680 bool resolve_type(THD *) override {
1681 // maximum string length of all options is expected
1682 // to be less than 256 characters.
1684 set_nullable(true);
1685 null_on_null = false;
1686
1687 return false;
1688 }
1689
1690 const char *func_name() const override { return "internal_tablespace_extra"; }
1691
1692 String *val_str(String *) override;
1693};
1694
1696 public:
1698 : Item_str_func(pos, list) {}
1699
1700 bool resolve_type(THD *) override {
1701 set_nullable(false);
1703 return false;
1704 }
1705
1706 const char *func_name() const override { return "convert_cpu_id_mask"; }
1707
1708 String *val_str(String *) override;
1709};
1710
1712 public:
1714 : Item_str_func(pos, a, b) {}
1715
1716 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1717 bool resolve_type(THD *) override {
1719 set_nullable(true);
1720 null_on_null = false;
1721
1722 return false;
1723 }
1724
1725 const char *func_name() const override { return "get_dd_property_key_value"; }
1726
1727 String *val_str(String *) override;
1728};
1729
1731 public:
1733 Item *c, Item *d)
1734 : Item_str_func(pos, a, b, c, d) {}
1735
1736 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1737 bool resolve_type(THD *) override {
1739 set_nullable(true);
1740 null_on_null = false;
1741
1742 return false;
1743 }
1744
1745 const char *func_name() const override {
1746 return "get_jdv_property_key_value";
1747 }
1748
1749 String *val_str(String *) override;
1750};
1751
1753 public:
1755 : Item_str_func(pos, a, b) {}
1756
1757 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1758 bool resolve_type(THD *) override {
1760 set_nullable(true);
1761 null_on_null = false;
1762
1763 return false;
1764 }
1765
1766 const char *func_name() const override { return "remove_dd_property_key"; }
1767
1768 String *val_str(String *) override;
1769};
1770
1772 public:
1774 : Item_str_func(pos, a, b) {}
1775
1776 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1777 bool resolve_type(THD *) override {
1778 // maximum string length of all options is expected
1779 // to be less than 256 characters.
1781 set_nullable(true);
1782 null_on_null = false;
1783
1784 return false;
1785 }
1786
1787 const char *func_name() const override {
1788 return "convert_interval_to_user_interval";
1789 }
1790
1791 String *val_str(String *) override;
1792};
1793
1795 public:
1797 : Item_str_func(pos, list) {}
1798
1799 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1800 bool resolve_type(THD *) override {
1802 set_nullable(true);
1803 null_on_null = false;
1804
1805 return false;
1806 }
1807
1808 const char *func_name() const override { return "internal_get_username"; }
1809
1810 String *val_str(String *) override;
1811};
1812
1814 public:
1816 : Item_str_func(pos, list) {}
1817
1818 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1819 bool resolve_type(THD *) override {
1821 set_nullable(true);
1822 null_on_null = false;
1823
1824 return false;
1825 }
1826
1827 const char *func_name() const override { return "internal_get_hostname"; }
1828
1829 String *val_str(String *) override;
1830};
1831
1833 public:
1835 : Item_str_func(pos) {}
1836
1837 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1838 bool resolve_type(THD *) override {
1840 set_nullable(true);
1841 null_on_null = false;
1842
1843 return false;
1844 }
1845
1846 const char *func_name() const override {
1847 return "internal_get_enabled_role_json";
1848 }
1849
1850 String *val_str(String *) override;
1851};
1852
1854 public:
1856 : Item_str_func(pos) {}
1857
1858 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1859 bool resolve_type(THD *) override {
1861 set_nullable(true);
1862 null_on_null = false;
1863
1864 return false;
1865 }
1866
1867 const char *func_name() const override {
1868 return "internal_get_mandatory_roles_json";
1869 }
1870
1871 String *val_str(String *) override;
1872};
1873
1875 public:
1877 : Item_str_func(pos, list) {}
1878
1879 enum Functype functype() const override { return DD_INTERNAL_FUNC; }
1880 bool resolve_type(THD *) override {
1881 // maximum string length of all options is expected
1882 // to be less than 256 characters.
1884 set_nullable(false);
1885 null_on_null = false;
1886
1887 return false;
1888 }
1889
1890 const char *func_name() const override {
1891 return "internal_get_dd_column_extra";
1892 }
1893
1894 String *val_str(String *) override;
1895};
1896
1899
1900 public:
1902 : Item_bool_func(pos, a) {}
1903
1904 bool check_function_as_value_generator(uchar *checker_args) final {
1906 pointer_cast<Check_function_as_value_generator_parameters *>(
1907 checker_args);
1908 func_arg->banned_function_name = func_name();
1909 return ((func_arg->source >= VGS_GENERATED_COLUMN) &&
1910 (func_arg->source <= VGS_CHECK_CONSTRAINT));
1911 }
1912
1913 longlong val_int() final;
1914
1915 bool do_itemize(Parse_context *pc, Item **res) final;
1916
1918
1919 private:
1920 /**
1921 Used to pass a security context to the resolver functions.
1922 Only used for definer views. In all other contexts, the security context
1923 passed here is nullptr and is instead looked up dynamically at run time
1924 from the current THD.
1925 */
1927
1928#ifndef NDEBUG
1929 // Keeps track of whether this function has been called. For testing only.
1930 bool m_called = false;
1931#endif
1932
1933 /**
1934 Checks if the user or role in the security context is part of the
1935 comma-separated list. Subclasses override this to check for correct auth ID
1936 type (either user or role).
1937 */
1938 virtual bool auth_id_in(
1939 const Security_context &sctx,
1940 std::string_view comma_separated_auth_id_list) const = 0;
1941};
1942
1943inline void tohex(char *to, uint64_t from, uint len) {
1944 to += len;
1945 while (len--) {
1946 *--to = dig_vec_lower[from & 15];
1947 from >>= 4;
1948 }
1949}
1950
1953 public:
1956 const char *func_name() const override { return "current_role_in"; }
1957 enum Functype functype() const override { return CURRENT_ROLE_IN_FUNC; }
1958
1959 private:
1960 bool auth_id_in(const Security_context &sctx,
1961 std::string_view comma_separated_auth_id_list) const override;
1962};
1963
1966 public:
1969 const char *func_name() const override { return "current_user_in"; }
1970 enum Functype functype() const override { return CURRENT_USER_IN_FUNC; }
1971
1972 private:
1973 bool auth_id_in(const Security_context &sctx,
1974 std::string_view comma_separated_auth_id_list) const override;
1975};
1976
1977#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:3793
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:1003
const CHARSET_INFO * m_cast_cs
The character set we are converting to.
Definition: item_strfunc.h:1008
bool m_safe
Definition: item_strfunc.h:1017
bool m_charset_conversion
If true, conversion is needed so do it, else allow string copy.
Definition: item_strfunc.h:1006
const CHARSET_INFO * m_from_cs
The character set we are converting from.
Definition: item_strfunc.h:1010
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:3652
Item_charset_conversion(const POS &pos, Item *a, const CHARSET_INFO *cs_arg)
Definition: item_strfunc.h:1055
bool m_use_cached_value
Marks whether the underlying Item is constant and may be cached.
Definition: item_strfunc.h:1013
String * val_str(String *) override
Definition: item_strfunc.cc:3542
void add_json_info(Json_object *obj) override
Add all the node-specific json fields.
Definition: item_strfunc.h:1030
longlong m_cast_length
Length argument value, if any given.
Definition: item_strfunc.h:1015
String m_tmp_value
Definition: item_strfunc.h:1011
Item_charset_conversion(THD *thd, Item *a, const CHARSET_INFO *cs_arg, bool cache_if_const)
Definition: item_strfunc.h:1036
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:3621
Definition: item.h:4529
Definition: item_strfunc.h:308
Item_func_aes_decrypt(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_strfunc.h:324
Item_func_aes_decrypt(const POS &pos, Item *a, Item *b, Item *c, Item *d, Item *e)
Definition: item_strfunc.h:328
String * val_str(String *) override
Definition: item_strfunc.cc:637
void destroy_op_context()
Definition: item_strfunc.cc:621
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_strfunc.cc:627
Item_func_aes_decrypt(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_strfunc.h:320
Item_func_aes_decrypt(const POS &pos, Item *a, Item *b)
Definition: item_strfunc.h:316
Item_str_func super
Definition: item_strfunc.h:309
EVP_CIPHER_CTX * ctx
Definition: item_strfunc.h:310
const char * func_name() const override
Definition: item_strfunc.h:345
Item_func_aes_decrypt(const POS &pos, Item *a, Item *b, Item *c, Item *d, Item *e, Item *f)
Definition: item_strfunc.h:333
void create_op_context()
Definition: item_strfunc.cc:613
~Item_func_aes_decrypt() override
Definition: item_strfunc.h:338
EVP_CIPHER_CTX stack_ctx
Definition: item_strfunc.h:312
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:688
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:293
void create_op_context()
Definition: item_strfunc.cc:520
String * val_str(String *) override
Definition: item_strfunc.cc:544
const char * func_name() const override
Definition: item_strfunc.h:305
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:280
EVP_CIPHER_CTX stack_ctx
Definition: item_strfunc.h:272
Item_func_aes_encrypt(const POS &pos, Item *a, Item *b)
Definition: item_strfunc.h:276
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_strfunc.cc:534
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:603
Item_func_aes_encrypt(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_strfunc.h:284
~Item_func_aes_encrypt() override
Definition: item_strfunc.h:298
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:288
void destroy_op_context()
Definition: item_strfunc.cc:528
Definition: item_strfunc.h:896
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:2912
String * val_str_ascii(String *) override
Definition: item_strfunc.cc:2922
Item_func_bin_to_uuid(const POS &pos, Item *arg1, Item *arg2)
Definition: item_strfunc.h:903
Item_func_bin_to_uuid(const POS &pos, Item *arg1)
Definition: item_strfunc.h:901
const char * func_name() const override
Definition: item_strfunc.h:907
char m_text_buf[mysql::gtid::Uuid::TEXT_LENGTH+1]
Buffer to store the text result.
Definition: item_strfunc.h:898
Definition: item_strfunc.h:814
Item_func_char(const POS &pos, PT_item_list *list)
Definition: item_strfunc.h:816
void add_json_info(Json_object *obj) override
Add all the node-specific json fields.
Definition: item_strfunc.h:834
Item_func_char(const POS &pos, PT_item_list *list, const CHARSET_INFO *cs)
Definition: item_strfunc.h:821
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:827
String * val_str(String *) override
Definition: item_strfunc.cc:2554
const char * func_name() const override
Definition: item_strfunc.h:833
Definition: item_strfunc.h:1187
Item_func_charset(const POS &pos, Item *a)
Definition: item_strfunc.h:1189
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1194
String * val_str(String *) override
Definition: item_strfunc.cc:3219
const char * func_name() const override
Definition: item_strfunc.h:1193
Definition: item_strfunc.h:1201
String * val_str(String *) override
Definition: item_strfunc.cc:3233
const char * func_name() const override
Definition: item_strfunc.h:1207
Item_func_collation(const POS &pos, Item *a)
Definition: item_strfunc.h:1203
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1208
Definition: item_strfunc.h:1278
String buffer
Definition: item_strfunc.h:1279
Item_func_compress(const POS &pos, Item *a)
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:4125
String * val_str(String *str) override
Definition: item_strfunc.cc:4133
const char * func_name() const override
Definition: item_strfunc.h:1284
Definition: item_strfunc.h:381
const char * func_name() const override
Definition: item_strfunc.h:394
Item_func_concat_ws(const POS &pos, PT_item_list *opt_list)
Definition: item_strfunc.h:388
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:1161
String tmp_value
Definition: item_strfunc.h:382
String * val_str(String *) override
concat with separator.
Definition: item_strfunc.cc:1128
Item_func_concat_ws(mem_root_deque< Item * > *list)
Definition: item_strfunc.h:384
Definition: item_strfunc.h:367
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:1078
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:1103
Item_func_concat(const POS &pos, Item *a, Item *b)
Definition: item_strfunc.h:373
Item_func_concat(Item *a, Item *b)
Definition: item_strfunc.h:372
Item_func_concat(const POS &pos, PT_item_list *opt_list)
Definition: item_strfunc.h:370
const char * func_name() const override
Definition: item_strfunc.h:378
String tmp_value
Definition: item_strfunc.h:368
Definition: item_strfunc.h:1138
bool eq_specific(const Item *item) const override
Provide a more specific equality check for a function.
Definition: item_strfunc.cc:3131
Item_func_conv_charset(const POS &pos, Item *a, const CHARSET_INFO *cs)
Definition: item_strfunc.h:1140
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_strfunc.cc:3137
const char * func_name() const override
Definition: item_strfunc.h:1150
Item_func_conv_charset(THD *thd, Item *a, const CHARSET_INFO *cs, bool cache_if_const)
Definition: item_strfunc.h:1145
Definition: item_strfunc.h:925
String * val_str(String *) override
Definition: item_strfunc.cc:3057
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:3049
static constexpr uint32_t CONV_MAX_LENGTH
Definition: item_strfunc.h:928
Item_func_conv(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_strfunc.h:929
const char * func_name() const override
Definition: item_strfunc.h:931
Definition: item_strfunc.h:1695
const char * func_name() const override
Definition: item_strfunc.h:1706
Item_func_convert_cpu_id_mask(const POS &pos, Item *list)
Definition: item_strfunc.h:1697
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1700
String * val_str(String *) override
Definition: item_strfunc.cc:5194
Definition: item_strfunc.h:1771
const char * func_name() const override
Definition: item_strfunc.h:1787
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1777
enum Functype functype() const override
Definition: item_strfunc.h:1776
String * val_str(String *) override
Definition: item_strfunc.cc:5493
Item_func_convert_interval_to_user_interval(const POS &pos, Item *a, Item *b)
Definition: item_strfunc.h:1773
Definition: item_strfunc.h:1246
const char * func_name() const override
Definition: item_strfunc.h:1253
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1254
Item_func_crc32(const POS &pos, Item *a)
Definition: item_strfunc.h:1250
longlong val_int() override
Definition: item_strfunc.cc:4113
String value
Definition: item_strfunc.h:1247
Definition: item_strfunc.h:1897
bool m_called
Definition: item_strfunc.h:1930
Item_func_current_auth_id_type_in(const POS &pos, Item *a)
Definition: item_strfunc.h:1901
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:1917
Item_bool_func super
Definition: item_strfunc.h:1898
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:1904
longlong val_int() final
Definition: item_strfunc.cc:5762
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:1926
bool do_itemize(Parse_context *pc, Item **res) final
The core function that does the actual itemization.
Definition: item_strfunc.cc:5753
Definition: item_strfunc.h:1952
enum Functype functype() const override
Definition: item_strfunc.h:1957
const char * func_name() const override
Definition: item_strfunc.h:1956
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:5797
Item_func_current_role_in(const POS &pos, Item *a)
Definition: item_strfunc.h:1954
Definition: item_strfunc.h:1353
const Name_string fully_qualified_func_name() const override
Definition: item_strfunc.h:1367
void set_current_role(THD *thd)
Definition: item_strfunc.cc:5250
Item_func_current_role()
Definition: item_strfunc.h:1357
const char * func_name() const override
Definition: item_strfunc.h:1360
bool value_cache_set
a flag whether value_cache is set or not
Definition: item_strfunc.h:1374
Item_func_sysconst super
Definition: item_strfunc.h:1354
Item_func_current_role(const POS &pos)
Definition: item_strfunc.h:1358
String * val_str(String *) override
Definition: item_strfunc.cc:5245
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1363
String value_cache
Cache for the result value.
Definition: item_strfunc.h:1382
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_strfunc.cc:5237
Definition: item_strfunc.h:1965
const char * func_name() const override
Definition: item_strfunc.h:1969
Item_func_current_user_in(const POS &pos, Item *a)
Definition: item_strfunc.h:1967
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:5791
enum Functype functype() const override
Definition: item_strfunc.h:1970
Definition: item_strfunc.h:723
Item_func_user super
Definition: item_strfunc.h:724
bool resolve_type(THD *) override
Overridden to copy definer priv_user and priv_host.
Definition: item_strfunc.cc:2044
Item_func_current_user(const POS &pos)
Definition: item_strfunc.h:745
const Name_string fully_qualified_func_name() const override
Definition: item_strfunc.h:749
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_strfunc.cc:2121
const char * func_name() const override
Definition: item_strfunc.h:748
LEX_CSTRING m_definer_priv_host
Definition: item_strfunc.h:736
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:2038
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:735
String * val_str(String *) override
Definition: item_strfunc.cc:2069
Name_resolution_context * m_name_resolution_ctx
Used to pass a security context to the resolver functions.
Definition: item_strfunc.h:731
Definition: item_strfunc.h:655
Item_func_sysconst super
Definition: item_strfunc.h:656
String * val_str(String *) override
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:664
const Name_string fully_qualified_func_name() const override
Definition: item_strfunc.h:670
Item_func_database(const POS &pos)
Definition: item_strfunc.h:659
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_strfunc.cc:2000
const char * func_name() const override
Definition: item_strfunc.h:669
Definition: item_strfunc.h:767
const char * func_name() const override
Definition: item_strfunc.h:775
longlong val_int() override
Definition: item_strfunc.cc:2453
String * val_str(String *str) override
Definition: item_strfunc.cc:2466
double val_real() override
Definition: item_strfunc.cc:2441
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:2422
Item_func_elt(const POS &pos, PT_item_list *opt_list)
Definition: item_strfunc.h:769
This class represents the function ETAG which is used to traverse the input arguments and compute a 1...
Definition: item_strfunc.h:401
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:412
String * val_str(String *) override
Definition: item_strfunc.cc:1183
Item_func_etag(const POS &pos, PT_item_list *opt_list)
Definition: item_strfunc.h:405
Item_func_etag(Item *a, Item *b)
Definition: item_strfunc.h:407
const char * func_name() const override
Definition: item_strfunc.h:411
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:1249
String m_tmp_value
Definition: item_strfunc.h:402
Definition: item_strfunc.h:1114
Item_func_export_set(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_strfunc.h:1116
Item_func_export_set(const POS &pos, Item *a, Item *b, Item *c, Item *d, Item *e)
Definition: item_strfunc.h:1120
Item_func_export_set(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_strfunc.h:1118
String * val_str(String *str) override
Definition: item_strfunc.cc:3778
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:3847
const char * func_name() const override
Definition: item_strfunc.h:1125
Definition: item_strfunc.h:796
const char * func_name() const override
Definition: item_strfunc.h:809
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_strfunc.cc:2409
String tmp_str
Definition: item_strfunc.h:797
MY_LOCALE * get_locale(Item *item)
Definition: item_strfunc.cc:2278
MY_LOCALE * locale
Definition: item_strfunc.h:798
Item_func_format(const POS &pos, Item *org, Item *dec)
Definition: item_strfunc.h:801
String * val_str_ascii(String *) override
Definition: item_strfunc.cc:2318
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:2293
Item_func_format(const POS &pos, Item *org, Item *dec, Item *lang)
Definition: item_strfunc.h:803
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:786
const char * func_name() const override
Definition: item_strfunc.h:264
String * val_str(String *) override
Definition: item_strfunc.cc:800
Item_func_from_base64(const POS &pos, Item *a)
Definition: item_strfunc.h:261
Definition: item_strfunc.h:1298
Item_func_from_vector(const POS &pos, Item *a)
Definition: item_strfunc.h:1306
const char * func_name() const override
Definition: item_strfunc.h:1309
String * val_str_ascii(String *str) override
Definition: item_strfunc.cc:4241
String buffer
Definition: item_strfunc.h:1302
static const uint32 per_value_chars
Definition: item_strfunc.h:1299
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:4225
static const uint32 max_output_bytes
Definition: item_strfunc.h:1300
Item_func_from_vector(Item *a)
Definition: item_strfunc.h:1305
Definition: item_strfunc.h:1421
Item_func_get_dd_column_privileges(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_strfunc.h:1423
const char * func_name() const override
Definition: item_strfunc.h:1440
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1427
enum Functype functype() const override
Definition: item_strfunc.h:1426
String * val_str(String *) override
This function prepares string with list of column privileges.
Definition: item_strfunc.cc:4492
Definition: item_strfunc.h:1445
enum Functype functype() const override
Definition: item_strfunc.h:1450
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1451
String * val_str(String *) override
This function prepares string representing create_options for table.
Definition: item_strfunc.cc:4564
Item_func_get_dd_create_options(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_strfunc.h:1447
const char * func_name() const override
Definition: item_strfunc.h:1461
Definition: item_strfunc.h:1536
const char * func_name() const override
Definition: item_strfunc.h:1552
Item_func_get_dd_index_private_data(const POS &pos, Item *a, Item *b)
Definition: item_strfunc.h:1538
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1542
String * val_str(String *) override
This function prepares string representing se_private_data for index.
Definition: item_strfunc.cc:5109
enum Functype functype() const override
Definition: item_strfunc.h:1541
Definition: item_strfunc.h:1711
String * val_str(String *) override
This function prepares string representing value stored at key supplied.
Definition: item_strfunc.cc:5305
enum Functype functype() const override
Definition: item_strfunc.h:1716
Item_func_get_dd_property_key_value(const POS &pos, Item *a, Item *b)
Definition: item_strfunc.h:1713
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1717
const char * func_name() const override
Definition: item_strfunc.h:1725
Definition: item_strfunc.h:1466
String * val_str(String *) override
This function prepares string representing options for a schema.
Definition: item_strfunc.cc:4765
const char * func_name() const override
Definition: item_strfunc.h:1482
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1472
enum Functype functype() const override
Definition: item_strfunc.h:1471
Item_func_get_dd_schema_options(const POS &pos, Item *a)
Definition: item_strfunc.h:1468
Definition: item_strfunc.h:1513
String * val_str(String *) override
This function prepares string representing se_private_data for tablespace.
Definition: item_strfunc.cc:5043
const char * func_name() const override
Definition: item_strfunc.h:1529
enum Functype functype() const override
Definition: item_strfunc.h:1518
Item_func_get_dd_tablespace_private_data(const POS &pos, Item *a, Item *b)
Definition: item_strfunc.h:1515
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1519
Definition: item_strfunc.h:1730
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1737
enum Functype functype() const override
Definition: item_strfunc.h:1736
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:5360
const char * func_name() const override
Definition: item_strfunc.h:1745
Item_func_get_jdv_property_key_value(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_strfunc.h:1732
Definition: item_strfunc.h:1557
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1563
String * val_str(String *) override
Definition: item_strfunc.cc:4890
enum Functype functype() const override
Definition: item_strfunc.h:1562
Item_func_get_partition_nodegroup(const POS &pos, Item *a)
Definition: item_strfunc.h:1559
const char * func_name() const override
Definition: item_strfunc.h:1573
Definition: item_strfunc.h:936
String tmp_value
Definition: item_strfunc.h:937
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:3399
Item_func_hex(const POS &pos, Item *a)
Definition: item_strfunc.h:940
String * val_str_ascii(String *) override
Definition: item_strfunc.cc:3411
const char * func_name() const override
Definition: item_strfunc.h:941
Definition: item_strfunc.h:447
String * val_str(String *) override
Definition: item_strfunc.cc:1398
const char * func_name() const override
Definition: item_strfunc.h:458
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:1450
String tmp_value_res
Holds result in case we need to allocate our own result buffer.
Definition: item_strfunc.h:450
Item_func_insert(const POS &pos, Item *org, Item *start, Item *length, Item *new_str)
Definition: item_strfunc.h:453
String tmp_value
Definition: item_strfunc.h:448
Definition: item_strfunc.h:1487
Item_func_internal_get_comment_or_error(const POS &pos, PT_item_list *list)
Definition: item_strfunc.h:1489
const char * func_name() const override
Definition: item_strfunc.h:1506
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1493
String * val_str(String *) override
Definition: item_strfunc.cc:4813
enum Functype functype() const override
Definition: item_strfunc.h:1492
Definition: item_strfunc.h:1874
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1880
String * val_str(String *) override
This function prepares string representing EXTRA column for I_S.COLUMNS.
Definition: item_strfunc.cc:5670
const char * func_name() const override
Definition: item_strfunc.h:1890
Item_func_internal_get_dd_column_extra(const POS &pos, PT_item_list *list)
Definition: item_strfunc.h:1876
enum Functype functype() const override
Definition: item_strfunc.h:1879
Definition: item_strfunc.h:1832
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1838
enum Functype functype() const override
Definition: item_strfunc.h:1837
Item_func_internal_get_enabled_role_json(const POS &pos)
Definition: item_strfunc.h:1834
String * val_str(String *) override
Definition: item_strfunc.cc:5589
const char * func_name() const override
Definition: item_strfunc.h:1846
Definition: item_strfunc.h:1813
Item_func_internal_get_hostname(const POS &pos, PT_item_list *list)
Definition: item_strfunc.h:1815
enum Functype functype() const override
Definition: item_strfunc.h:1818
const char * func_name() const override
Definition: item_strfunc.h:1827
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1819
String * val_str(String *) override
Definition: item_strfunc.cc:5554
Definition: item_strfunc.h:1853
const char * func_name() const override
Definition: item_strfunc.h:1867
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1859
enum Functype functype() const override
Definition: item_strfunc.h:1858
Item_func_internal_get_mandatory_roles_json(const POS &pos)
Definition: item_strfunc.h:1855
String * val_str(String *) override
Definition: item_strfunc.cc:5621
Definition: item_strfunc.h:1794
String * val_str(String *) override
Definition: item_strfunc.cc:5517
Item_func_internal_get_username(const POS &pos, PT_item_list *list)
Definition: item_strfunc.h:1796
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1800
enum Functype functype() const override
Definition: item_strfunc.h:1799
const char * func_name() const override
Definition: item_strfunc.h:1808
Definition: item_strfunc.h:1673
String * val_str(String *) override
Definition: item_strfunc.cc:5009
const char * func_name() const override
Definition: item_strfunc.h:1690
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1680
enum Functype functype() const override
Definition: item_strfunc.h:1679
Item_func_internal_tablespace_extra(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_strfunc.h:1675
const char * func_name() const override
Definition: item_strfunc.h:1619
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1609
String * val_str(String *) override
Definition: item_strfunc.cc:4947
Item_func_internal_tablespace_logfile_group_name(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_strfunc.h:1604
enum Functype functype() const override
Definition: item_strfunc.h:1608
Definition: item_strfunc.h:1649
const char * func_name() const override
Definition: item_strfunc.h:1666
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1656
Item_func_internal_tablespace_row_format(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_strfunc.h:1651
String * val_str(String *) override
Definition: item_strfunc.cc:4987
enum Functype functype() const override
Definition: item_strfunc.h:1655
Definition: item_strfunc.h:1626
Item_func_internal_tablespace_status(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_strfunc.h:1628
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1633
String * val_str(String *) override
Definition: item_strfunc.cc:4970
enum Functype functype() const override
Definition: item_strfunc.h:1632
const char * func_name() const override
Definition: item_strfunc.h:1643
Definition: item_strfunc.h:1580
enum Functype functype() const override
Definition: item_strfunc.h:1586
String * val_str(String *) override
Definition: item_strfunc.cc:4930
const char * func_name() const override
Definition: item_strfunc.h:1597
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1587
Item_func_internal_tablespace_type(const POS &pos, Item *a, Item *b, Item *c, Item *d)
Definition: item_strfunc.h:1582
Definition: item_strfunc.h:910
const char * func_name() const override
Definition: item_strfunc.h:916
longlong val_int() override
Definition: item_strfunc.cc:2962
Item_func_is_uuid(const POS &pos, Item *a)
Definition: item_strfunc.h:914
Item_bool_func super
Definition: item_strfunc.h:911
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:917
Definition: item_strfunc.h:486
Item_func_left(const POS &pos, Item *a, Item *b)
Definition: item_strfunc.h:490
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:1573
String tmp_value
Definition: item_strfunc.h:487
String * val_str(String *) override
Definition: item_strfunc.cc:1523
const char * func_name() const override
Definition: item_strfunc.h:493
Definition: item_strfunc.h:988
const char * func_name() const override
Definition: item_strfunc.h:992
Item_func_like_range_max(const POS &pos, Item *a, Item *b)
Definition: item_strfunc.h:990
Definition: item_strfunc.h:981
const char * func_name() const override
Definition: item_strfunc.h:985
Item_func_like_range_min(const POS &pos, Item *a, Item *b)
Definition: item_strfunc.h:983
Definition: item_strfunc.h:960
String max_str
Definition: item_strfunc.h:963
const bool is_min
Definition: item_strfunc.h:964
Item_func_like_range(const POS &pos, Item *a, Item *b, bool is_min_arg)
Definition: item_strfunc.h:967
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:972
String min_str
Definition: item_strfunc.h:962
String * val_str(String *) override
Definition: item_strfunc.cc:3486
Definition: item_strfunc.h:472
const char * func_name() const override
Definition: item_strfunc.h:475
Item_func_lower(const POS &pos, Item *item)
Definition: item_strfunc.h:474
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:1499
Definition: item_strfunc.h:871
String * val_str(String *) override
Definition: item_strfunc.cc:2976
Item_func_lpad(const POS &pos, Item *arg1, Item *arg2, Item *arg3)
Definition: item_strfunc.h:875
String tmp_value
Definition: item_strfunc.h:872
String lpad_str
Definition: item_strfunc.h:872
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:2843
const char * func_name() const override
Definition: item_strfunc.h:879
Definition: item_strfunc.h:617
Item_func_ltrim(const POS &pos, Item *a)
Definition: item_strfunc.h:619
Definition: item_strfunc.h:778
String * val_str(String *str) override
Definition: item_strfunc.cc:2506
Item_str_func super
Definition: item_strfunc.h:779
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_strfunc.cc:2543
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:2490
String tmp_str
Definition: item_strfunc.h:781
Item_func_make_set(const POS &pos, PT_item_list *opt_list)
Definition: item_strfunc.h:784
bool fix_fields(THD *thd, Item **ref) override
Definition: item_strfunc.cc:2486
const char * func_name() const override
Definition: item_strfunc.h:790
Definition: item_strfunc.h:1128
String * val_str(String *) override
QUOTE() function returns argument string in single quotes suitable for using in a SQL statement.
Definition: item_strfunc.cc:3908
Item_func_quote(const POS &pos, Item *a)
Definition: item_strfunc.h:1132
String tmp_value
Definition: item_strfunc.h:1129
const char * func_name() const override
Definition: item_strfunc.h:1133
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:3867
Definition: item_strfunc.h:348
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:362
static const ulonglong MAX_RANDOM_BYTES_BUFFER
limitation from the SSL library
Definition: item_strfunc.h:352
Item_str_func super
Definition: item_strfunc.h:349
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_strfunc.cc:696
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:713
Item_func_random_bytes(const POS &pos, Item *a)
Definition: item_strfunc.h:355
String * val_str(String *a) override
Definition: item_strfunc.cc:720
const char * func_name() const override
Definition: item_strfunc.h:361
Definition: item_strfunc.h:1752
Item_func_remove_dd_property_key(const POS &pos, Item *a, Item *b)
Definition: item_strfunc.h:1754
const char * func_name() const override
Definition: item_strfunc.h:1766
String * val_str(String *) override
This function removes a key value from given property string.
Definition: item_strfunc.cc:5447
enum Functype functype() const override
Definition: item_strfunc.h:1757
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1758
Definition: item_strfunc.h:841
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:2604
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:2638
String tmp_value
Definition: item_strfunc.h:842
Item_func_repeat(const POS &pos, Item *arg1, Item *arg2)
Definition: item_strfunc.h:845
const char * func_name() const override
Definition: item_strfunc.h:849
Definition: item_strfunc.h:434
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:1376
String * val_str(String *) override
Replace all occurrences of string2 in string1 with string3.
Definition: item_strfunc.cc:1314
const char * func_name() const override
Definition: item_strfunc.h:444
String tmp_value
Definition: item_strfunc.h:435
String tmp_value_res
Holds result in case we need to allocate our own result buffer.
Definition: item_strfunc.h:437
String tmp_value2
Definition: item_strfunc.h:435
Item_func_replace(const POS &pos, Item *org, Item *find, Item *replace)
Definition: item_strfunc.h:440
Definition: item_strfunc.h:422
Item_func_reverse(Item *a)
Definition: item_strfunc.h:426
String * val_str(String *) override
Definition: item_strfunc.cc:1259
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:1301
String tmp_value
Definition: item_strfunc.h:423
Item_func_reverse(const POS &pos, Item *a)
Definition: item_strfunc.h:427
const char * func_name() const override
Definition: item_strfunc.h:431
Definition: item_strfunc.h:496
Item_func_right(const POS &pos, Item *a, Item *b)
Definition: item_strfunc.h:500
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:1608
const char * func_name() const override
Definition: item_strfunc.h:504
String * val_str(String *) override
Definition: item_strfunc.cc:1583
String tmp_value
Definition: item_strfunc.h:497
Definition: item_strfunc.h:1385
Item_func_roles_graphml(const POS &pos)
Definition: item_strfunc.h:1390
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_strfunc.cc:5288
String value_cache
Cache for the result value.
Definition: item_strfunc.h:1415
Item_func_sysconst super
Definition: item_strfunc.h:1386
const char * func_name() const override
Definition: item_strfunc.h:1400
Item_func_roles_graphml()
Definition: item_strfunc.h:1389
bool calculate_graphml(THD *thd)
Constructs and caches the graphml string.
Definition: item_strfunc.cc:5268
String * val_str(String *) override
Definition: item_strfunc.cc:5283
bool value_cache_set
Set to true if value_cache is set.
Definition: item_strfunc.h:1418
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1395
const Name_string fully_qualified_func_name() const override
Definition: item_strfunc.h:1402
Definition: item_strfunc.h:860
String tmp_value
Definition: item_strfunc.h:861
Item_func_rpad(const POS &pos, Item *arg1, Item *arg2, Item *arg3)
Definition: item_strfunc.h:864
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:2744
String * val_str(String *) override
Definition: item_strfunc.cc:2771
const char * func_name() const override
Definition: item_strfunc.h:868
String rpad_str
Definition: item_strfunc.h:861
Definition: item_strfunc.h:623
Item_func_rtrim(const POS &pos, Item *a)
Definition: item_strfunc.h:625
Definition: item_strfunc.h:1156
bool eq(const Item *item) const override
Compare this item with another item for equality.
Definition: item_strfunc.cc:3195
Item_field * field_for_view_update() override
Definition: item_strfunc.h:1174
LEX_CSTRING collation_string
Definition: item_strfunc.h:1159
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_strfunc.cc:3208
void add_json_info(Json_object *obj) override
Add all the node-specific json fields.
Definition: item_strfunc.h:1180
const char * func_name() const override
Definition: item_strfunc.h:1170
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:3165
enum Functype functype() const override
Definition: item_strfunc.h:1171
String * val_str(String *) override
Definition: item_strfunc.cc:3156
Item_func_set_collation(const POS &pos, Item *a, const LEX_CSTRING &collation_string_arg)
Definition: item_strfunc.h:1162
Item_str_func super
Definition: item_strfunc.h:1157
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_strfunc.cc:3146
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:756
Item_func_soundex(const POS &pos, Item *a)
Definition: item_strfunc.h:761
String tmp_value
Definition: item_strfunc.h:757
Item_func_soundex(Item *a)
Definition: item_strfunc.h:760
String * val_str(String *) override
Definition: item_strfunc.cc:2174
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:2129
const char * func_name() const override
Definition: item_strfunc.h:764
Definition: item_strfunc.h:852
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:2684
String * val_str(String *) override
Definition: item_strfunc.cc:2716
const char * func_name() const override
Definition: item_strfunc.h:857
Item_func_space(const POS &pos, Item *arg1)
Definition: item_strfunc.h:854
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:1038
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:1047
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:1008
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:992
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:525
String * val_str(String *) override
Definition: item_strfunc.cc:1718
Item_func_substr_index(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_strfunc.h:529
String tmp_value
Definition: item_strfunc.h:526
const char * func_name() const override
Definition: item_strfunc.h:533
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:1707
Definition: item_strfunc.h:507
const char * func_name() const override
Definition: item_strfunc.h:522
Item_func_substr(Item *a, Item *b)
Definition: item_strfunc.h:513
Item_func_substr(Item *a, Item *b, Item *c)
Definition: item_strfunc.h:516
String tmp_value
Definition: item_strfunc.h:510
Item_func_substr(const POS &pos, Item *a, Item *b)
Definition: item_strfunc.h:514
Item_str_func super
Definition: item_strfunc.h:508
String * val_str(String *) override
Definition: item_strfunc.cc:1619
Item_func_substr(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_strfunc.h:517
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:1666
Definition: item_strfunc.h:629
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:645
virtual const Name_string fully_qualified_func_name() const =0
Item_func_sysconst(const POS &pos)
Definition: item_strfunc.h:636
Item_str_func super
Definition: item_strfunc.h:630
Item_func_sysconst()
Definition: item_strfunc.h:633
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:751
String * val_str_ascii(String *) override
Definition: item_strfunc.cc:768
String tmp_value
Definition: item_strfunc.h:199
Definition: item_strfunc.h:1288
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:4182
String * val_str(String *str) override
Definition: item_strfunc.cc:4197
String buffer
Definition: item_strfunc.h:1289
const char * func_name() const override
Definition: item_strfunc.h:1294
Item_func_to_vector(const POS &pos, Item *a)
Definition: item_strfunc.h:1292
Definition: item_strfunc.h:536
const bool m_trim_trailing
Definition: item_strfunc.h:557
bool trim_trailing() const
Definition: item_strfunc.h:589
bool trim_leading() const
Definition: item_strfunc.h:584
const char * func_name() const override
Definition: item_strfunc.h:596
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:1930
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_strfunc.cc:1970
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:543
@ TRIM_BOTH_DEFAULT
Definition: item_strfunc.h:544
@ TRIM_LTRIM
Definition: item_strfunc.h:548
@ TRIM_RTRIM
Definition: item_strfunc.h:549
@ TRIM_BOTH
Definition: item_strfunc.h:545
@ TRIM_LEADING
Definition: item_strfunc.h:546
@ TRIM_TRAILING
Definition: item_strfunc.h:547
Item_func_trim(Item *a, TRIM_MODE tm)
Definition: item_strfunc.h:572
Item_func_trim(Item *a, Item *b, TRIM_MODE tm)
Definition: item_strfunc.h:560
Item_func_trim(const POS &pos, Item *a, TRIM_MODE tm)
Definition: item_strfunc.h:578
String tmp_value
Definition: item_strfunc.h:553
const TRIM_MODE m_trim_mode
Definition: item_strfunc.h:555
Item_func_trim(const POS &pos, Item *a, Item *b, TRIM_MODE tm)
Definition: item_strfunc.h:566
String remove
Definition: item_strfunc.h:554
const bool m_trim_leading
Definition: item_strfunc.h:556
String * val_str(String *) override
Definition: item_strfunc.cc:1835
Definition: item_strfunc.h:1313
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1318
const char * func_name() const override
Definition: item_strfunc.h:1325
String * val_str(String *str) override
Definition: item_strfunc.cc:4273
String buffer
Definition: item_strfunc.h:1314
Item_func_uncompress(const POS &pos, Item *a)
Definition: item_strfunc.h:1317
Definition: item_strfunc.h:1262
const char * func_name() const override
Definition: item_strfunc.h:1268
Item_func_uncompressed_length(const POS &pos, Item *a)
Definition: item_strfunc.h:1266
String value
Definition: item_strfunc.h:1263
longlong val_int() override
Definition: item_strfunc.cc:4084
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1269
Definition: item_strfunc.h:946
Item_func_unhex(const POS &pos, Item *a)
Definition: item_strfunc.h:950
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:3441
String * val_str(String *) override
Convert given hex string to a binary string.
Definition: item_strfunc.cc:3454
String tmp_value
Definition: item_strfunc.h:947
const char * func_name() const override
Definition: item_strfunc.h:954
Definition: item_strfunc.h:479
Item_func_upper(const POS &pos, Item *item)
Definition: item_strfunc.h:481
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:1511
const char * func_name() const override
Definition: item_strfunc.h:482
Definition: item_strfunc.h:675
Item_func_user(const POS &pos)
Definition: item_strfunc.h:688
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:692
const Name_string fully_qualified_func_name() const override
Definition: item_strfunc.h:716
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_strfunc.cc:2111
String * val_str(String *) override
Definition: item_strfunc.cc:2029
Item_func_sysconst super
Definition: item_strfunc.h:676
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_strfunc.h:710
Item_func_user()
Definition: item_strfunc.h:687
const char * func_name() const override
Definition: item_strfunc.h:715
bool evaluate(const char *user, const char *host)
Evaluate user name, must be called once per execution.
Definition: item_strfunc.cc:2088
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:2024
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:706
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:698
bool m_evaluated
True when function value is evaluated, set to false after each execution.
Definition: item_strfunc.h:680
Definition: item_strfunc.h:882
String * val_str(String *) override
Definition: item_strfunc.cc:2880
Item_func_uuid_to_bin(const POS &pos, Item *arg1, Item *arg2)
Definition: item_strfunc.h:889
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:2871
uchar m_bin_buf[mysql::gtid::Uuid::BYTE_LENGTH]
Buffer to store the binary result.
Definition: item_strfunc.h:884
Item_func_uuid_to_bin(const POS &pos, Item *arg1)
Definition: item_strfunc.h:887
const char * func_name() const override
Definition: item_strfunc.h:893
Definition: item_strfunc.h:1329
Item_func_uuid(const POS &pos)
Definition: item_strfunc.h:1334
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:1343
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:1337
String * val_str(String *) override
Definition: item_strfunc.cc:4473
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_strfunc.cc:4358
const char * func_name() const override
Definition: item_strfunc.h:1341
Item_func_uuid()
Definition: item_strfunc.h:1333
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:4351
Item_str_func super
Definition: item_strfunc.h:1330
Definition: item_strfunc.h:1216
String * val_str(String *) override
Definition: item_strfunc.cc:3311
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.cc:3267
const char * func_name() const override
Definition: item_strfunc.h:1238
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_strfunc.cc:3255
const uint num_codepoints
Definition: item_strfunc.h:1226
String tmp_value
Definition: item_strfunc.h:1219
Item_str_func super
Definition: item_strfunc.h:1217
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_strfunc.cc:3244
Item_field * m_field_ref
Definition: item_strfunc.h:1222
const uint result_length
Definition: item_strfunc.h:1221
bool eq_specific(const Item *item) const override
Provide a more specific equality check for a function.
Definition: item_strfunc.cc:3302
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:1227
const bool as_binary
Definition: item_strfunc.h:1223
uint flags
Definition: item_strfunc.h:1220
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:1083
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_strfunc.cc:3705
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_strfunc.h:1097
String tmp_value
Definition: item_strfunc.h:1086
Item_str_func super
Definition: item_strfunc.h:1084
String * val_str(String *) override
Definition: item_strfunc.cc:3713
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:1105
Item_load_file(const POS &pos, Item *a)
Definition: item_strfunc.h:1089
const char * func_name() const override
Definition: item_strfunc.h:1093
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:1094
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item.cc:11580
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:461
String * val_str(String *) override
Definition: item_strfunc.cc:1467
Item_str_conv(const POS &pos, Item *item)
Definition: item_strfunc.h:468
String tmp_value
Definition: item_strfunc.h:465
uint multiply
Definition: item_strfunc.h:463
my_charset_conv_case converter
Definition: item_strfunc.h:464
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:1563
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:1546
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:1061
const char * func_name() const override
Definition: item_strfunc.h:1078
Item_typecast_char(THD *thd, Item *a, longlong length_arg, const CHARSET_INFO *cs_arg)
Definition: item_strfunc.h:1066
Item_typecast_char(const POS &pos, Item *a, longlong length_arg, const CHARSET_INFO *cs_arg)
Definition: item_strfunc.h:1071
enum Functype functype() const override
Definition: item_strfunc.h:1076
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_strfunc.cc:3523
void add_json_info(Json_object *obj) override
Add all the node-specific json fields.
Definition: item_strfunc.cc:3536
bool eq_specific(const Item *item) const override
Provide a more specific equality check for a function.
Definition: item_strfunc.cc:3516
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:929
String str_value
str_values's main purpose is to cache the value in save_in_field
Definition: item.h:3669
void set_nullable(bool nullable)
Definition: item.h:3781
void set_data_type_blob(enum_field_types type, uint32 max_l)
Set the Item to be of BLOB type.
Definition: item.h:1683
DTCollation collation
Character set and collation properties assigned for this Item.
Definition: item.h:3676
virtual Item_field * field_for_view_update()
Definition: item.h:3277
bool fixed
True if item has been resolved.
Definition: item.h:3769
bool null_value
True if item is null.
Definition: item.h:3806
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:3807
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:1600
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:3694
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:1763
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:64
@ MYSQL_TYPE_LONG_BLOB
Definition: field_types.h:86
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:5178
String * mysql_generate_uuid(String *str)
Generate Universal Unique Identifier (UUID).
Definition: item_strfunc.cc:4366
void tohex(char *to, uint64_t from, uint len)
Definition: item_strfunc.h:1943
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:1578
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
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:907
#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: commit_order_queue.h:34
PT & ref(PT *tp)
Definition: tablespace_impl.cc:359
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:76
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:2884
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