1#ifndef SQL_ITEM_REGEXP_FUNC_H_
2#define SQL_ITEM_REGEXP_FUNC_H_
62#include <unicode/uregex.h>
77#if defined(__GNUC__) && !defined(__clang__)
78#pragma GCC diagnostic push
79#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
116 if (the_index != -1 &&
arg_count >=
static_cast<uint
>(the_index) + 1) {
135 if (the_index != -1 &&
arg_count >=
static_cast<uint
>(the_index) + 1) {
154 if (the_index != -1 &&
arg_count >=
static_cast<uint
>(the_index) + 1) {
162 return std::string{};
192 const char *end_not_used;
194 if (res ==
nullptr)
return 0.0;
203 if (res ==
nullptr)
return 0;
245 const char *
func_name()
const override {
return "regexp_instr"; }
250 if (the_index != -1 &&
arg_count >=
static_cast<uint
>(the_index) + 1) {
253 return std::optional<int>();
300 const char *
func_name()
const override {
return "regexp_like"; }
344 const char *
func_name()
const override {
return "regexp_replace"; }
381 const char *
func_name()
const override {
return "regexp_substr"; }
412#if defined(__GNUC__) && !defined(__clang__)
413#pragma GCC diagnostic pop
const CHARSET_INFO * collation
Definition: item.h:178
Definition: item_regexp_func.h:403
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_regexp_func.cc:338
Item_func_icu_version(const POS &pos)
Definition: item_regexp_func.cc:332
Definition: item_regexp_func.h:228
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Copy-pasted from Item_int_func.
Definition: item_regexp_func.h:267
int retopt_arg_pos() const
The position in the argument list of occurrence.
Definition: item_regexp_func.h:278
const char * func_name() const override
Definition: item_regexp_func.h:245
bool fix_fields(THD *thd, Item **arguments) override
Decides on the mode for matching, case sensitivity etc.
Definition: item_regexp_func.cc:158
Item_func_regexp_instr(const POS &pos, PT_item_list *opt_list)
Definition: item_regexp_func.h:230
String * val_str(String *str) override
Definition: item_regexp_func.h:239
double val_real() override
Definition: item_regexp_func.h:241
bool get_time(MYSQL_TIME *t) override
Definition: item_regexp_func.h:271
int occ_arg_pos() const override
The position in the argument list of 'occurrence'.
Definition: item_regexp_func.h:276
int match_arg_pos() const override
The position in the argument list of match_parameter.
Definition: item_regexp_func.h:279
std::optional< int > return_option() const
The value of the return_option argument, or its default if absent.
Definition: item_regexp_func.h:248
bool resolve_type(THD *) final
Resolves the collation to use for comparison.
Definition: item_regexp_func.cc:180
Item_result result_type() const override
Definition: item_regexp_func.h:235
longlong val_int() override
Definition: item_regexp_func.cc:188
int pos_arg_pos() const override
The position in the argument list of 'position'.
Definition: item_regexp_func.h:275
Definition: item_regexp_func.h:285
bool is_bool_func() const override
Definition: item_regexp_func.h:302
int occ_arg_pos() const override
The position in the argument list of 'occurrence'.
Definition: item_regexp_func.h:320
bool resolve_type(THD *) final
Resolves the collation to use for comparison.
Definition: item_regexp_func.cc:242
int pos_arg_pos() const override
The position in the argument list of 'position'.
Definition: item_regexp_func.h:319
String * val_str(String *str) override
Definition: item_regexp_func.h:294
longlong val_int() override
Definition: item_regexp_func.cc:218
Item_func_regexp_like(const POS &pos, PT_item_list *opt_list)
Definition: item_regexp_func.h:287
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Copy-pasted from Item_int_func.
Definition: item_regexp_func.h:311
int match_arg_pos() const override
The position in the argument list of match_parameter.
Definition: item_regexp_func.h:321
double val_real() override
Definition: item_regexp_func.h:296
Item_result result_type() const override
Definition: item_regexp_func.h:292
const char * func_name() const override
Definition: item_regexp_func.h:300
bool get_time(MYSQL_TIME *t) override
Definition: item_regexp_func.h:315
Definition: item_regexp_func.h:327
double val_real() override
Definition: item_regexp_func.h:342
Item_func_regexp_replace(const POS &pos, PT_item_list *item_list)
Definition: item_regexp_func.h:329
const char * func_name() const override
Definition: item_regexp_func.h:344
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Copy-pasted from Item_str_func.
Definition: item_regexp_func.h:353
longlong val_int() override
Definition: item_regexp_func.h:338
bool get_time(MYSQL_TIME *t) override
Definition: item_regexp_func.h:357
int pos_arg_pos() const override
The position in the argument list of 'position'.
Definition: item_regexp_func.h:361
Item * replacement()
Definition: item_regexp_func.h:336
int occ_arg_pos() const override
The position in the argument list of 'occurrence'.
Definition: item_regexp_func.h:362
bool resolve_type(THD *) final
Resolves the collation to use for comparison.
Definition: item_regexp_func.cc:249
Item_result result_type() const override
Definition: item_regexp_func.h:332
String * val_str(String *result) override
Definition: item_regexp_func.cc:276
int match_arg_pos() const override
The position in the argument list of match_parameter.
Definition: item_regexp_func.h:363
Definition: item_regexp_func.h:366
longlong val_int() override
Definition: item_regexp_func.h:375
int pos_arg_pos() const override
The position in the argument list of 'position'.
Definition: item_regexp_func.h:398
const char * func_name() const override
Definition: item_regexp_func.h:381
bool resolve_type(THD *) final
Resolves the collation to use for comparison.
Definition: item_regexp_func.cc:300
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Copy-pasted from Item_str_func.
Definition: item_regexp_func.h:390
double val_real() override
Definition: item_regexp_func.h:379
int match_arg_pos() const override
The position in the argument list of match_parameter.
Definition: item_regexp_func.h:400
int occ_arg_pos() const override
The position in the argument list of 'occurrence'.
Definition: item_regexp_func.h:399
String * val_str(String *result) override
Definition: item_regexp_func.cc:310
Item_func_regexp_substr(const POS &pos, PT_item_list *item_list)
Definition: item_regexp_func.h:368
bool get_time(MYSQL_TIME *t) override
Definition: item_regexp_func.h:394
Item_result result_type() const override
Definition: item_regexp_func.h:371
Base class for all regular expression function classes.
Definition: item_regexp_func.h:86
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_regexp_func.cc:136
std::optional< int > position() const
The value of the position argument, or its default if absent.
Definition: item_regexp_func.h:114
std::optional< std::string > match_parameter() const
The value of the match_parameter argument, or an empty string if absent.
Definition: item_regexp_func.h:152
Item * pattern() const
The expression for the pattern string.
Definition: item_regexp_func.h:111
Item * subject() const
The expression for the subject string.
Definition: item_regexp_func.h:108
my_decimal * convert_int_to_decimal(my_decimal *value)
Definition: item_regexp_func.h:176
bool fix_fields(THD *thd, Item **) override
Decides on the mode for matching, case sensitivity etc.
Definition: item_regexp_func.cc:125
bool set_pattern()
Definition: item_regexp_func.cc:141
virtual int pos_arg_pos() const =0
The position in the argument list of 'position'.
unique_ptr_destroy_only< regexp::Regexp_facade > m_facade
Definition: item_regexp_func.h:225
virtual int match_arg_pos() const =0
The position in the argument list of match_parameter.
longlong convert_str_to_int()
Definition: item_regexp_func.h:199
virtual int occ_arg_pos() const =0
The position in the argument list of 'occurrence'.
bool resolve_type(THD *) override
Resolves the collation to use for comparison.
Definition: item_regexp_func.cc:109
String * convert_int_to_str(String *str)
Definition: item_regexp_func.h:168
double convert_int_to_real()
Definition: item_regexp_func.h:184
std::optional< int > occurrence() const
The value of the occurrence argument, or its default if absent.
Definition: item_regexp_func.h:133
Item_func_regexp(const POS &pos, PT_item_list *opt_list)
Definition: item_regexp_func.h:88
double convert_str_to_real()
Definition: item_regexp_func.h:189
Definition: item_func.h:100
Item ** args
Array of pointers to arguments.
Definition: item_func.h:107
uint arg_count
How many arguments in 'args'.
Definition: item_func.h:130
Item ** arguments() const
Definition: item_func.h:132
Item_static_string_func(const Name_string &name_par, const char *str, size_t length, const CHARSET_INFO *cs, Derivation dv=DERIVATION_COERCIBLE)
Definition: item.h:5619
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:932
String str_value
str_values's main purpose is to cache the value in save_in_field
Definition: item.h:3496
DTCollation collation
Character set and collation properties assigned for this Item.
Definition: item.h:3503
void set_data_type_bool()
Definition: item.h:1514
bool is_nullable() const
Definition: item.h:3604
bool get_time_from_string(MYSQL_TIME *ltime)
Convert val_str() to time in MYSQL_TIME.
Definition: item.cc:1685
virtual longlong val_int()=0
bool fixed
True if item has been resolved.
Definition: item.h:3593
bool null_value
True if item is null.
Definition: item.h:3630
bool unsigned_flag
Definition: item.h:3631
bool get_date_from_string(MYSQL_TIME *ltime, my_time_flags_t flags)
Convert val_str() to date in MYSQL_TIME.
Definition: item.cc:1598
virtual String * val_str(String *str)=0
bool get_date_from_int(MYSQL_TIME *ltime, my_time_flags_t flags)
Convert val_int() to date in MYSQL_TIME.
Definition: item.cc:1626
void set_data_type_longlong()
Set the data type of the Item to be longlong.
Definition: item.h:1543
bool get_time_from_int(MYSQL_TIME *ltime)
Convert val_int() to time in MYSQL_TIME.
Definition: item.cc:1713
Wrapper class for an Item list head, used to allocate Item lists in the parser in a context-independe...
Definition: parse_tree_helpers.h:104
Base class for parse tree nodes (excluding the Parse_tree_root hierarchy)
Definition: parse_tree_node_base.h:229
String class wrapper with a preallocated buffer of size buff_sz.
Definition: sql_string.h:658
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:166
const CHARSET_INFO * charset() const
Definition: sql_string.h:239
const char * ptr() const
Definition: sql_string.h:248
size_t length() const
Definition: sql_string.h:240
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:35
bool is_error() const
true if there is an error in the error stack.
Definition: sql_class.h:3234
my_decimal class limits 'decimal_t' type to what we need in MySQL.
Definition: my_decimal.h:94
static char buf[MAX_BUF]
Definition: conf_to_src.cc:72
thread_local THD * current_thd
Definition: current_thd.cc:25
#define E_DEC_FATAL_ERROR
Definition: decimal.h:148
static std::string to_string(const LEX_STRING &str)
Definition: lex_string.h:49
A better implementation of the UNIX ctype(3) library.
int64_t my_strntoll(const CHARSET_INFO *cs, const char *str, size_t length, int base, const char **end, int *err)
Definition: m_ctype.h:751
double my_strntod(const CHARSET_INFO *cs, const char *str, size_t length, const char **end, int *err)
Definition: m_ctype.h:763
std::unique_ptr< T, Destroy_only< T > > unique_ptr_destroy_only
std::unique_ptr, but only destroying.
Definition: my_alloc.h:488
int int2my_decimal(uint mask, longlong i, bool unsigned_flag, my_decimal *d)
Definition: my_decimal.h:357
Some integer typedefs for easier portability.
long long int longlong
Definition: my_inttypes.h:54
unsigned int my_time_flags_t
Flags to str_to_datetime and number_to_datetime.
Definition: my_time.h:93
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1085
Definition: buf0block_hint.cc:29
static Value err()
Create a Value object that represents an error condition.
Definition: json_binary.cc:921
This file hides most of ICU from the Item_func_regexp subclasses.
Our own string classes, used pervasively throughout the executor.
Definition: mysql_time.h:81
Bison "location" class.
Definition: parse_location.h:42
Environment data for the contextualization phase.
Definition: parse_tree_node_base.h:418
Item_result
Type of the user defined function return slot and arguments.
Definition: udf_registration_types.h:38
@ STRING_RESULT
not valid for UDFs
Definition: udf_registration_types.h:40
@ INT_RESULT
double
Definition: udf_registration_types.h:42