1#ifndef SQL_ITEM_REGEXP_FUNC_H_
2#define SQL_ITEM_REGEXP_FUNC_H_
62#include <unicode/uregex.h>
76#if defined(__GNUC__) && !defined(__clang__)
77#pragma GCC diagnostic push
78#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
115 if (the_index != -1 &&
arg_count >=
static_cast<uint>(the_index) + 1) {
134 if (the_index != -1 &&
arg_count >=
static_cast<uint>(the_index) + 1) {
153 if (the_index != -1 &&
arg_count >=
static_cast<uint>(the_index) + 1) {
161 return std::string{};
191 const char *end_not_used;
193 if (res ==
nullptr)
return 0.0;
202 if (res ==
nullptr)
return 0;
244 const char *
func_name()
const override {
return "regexp_instr"; }
249 if (the_index != -1 &&
arg_count >=
static_cast<uint>(the_index) + 1) {
252 return std::optional<int>();
299 const char *
func_name()
const override {
return "regexp_like"; }
343 const char *
func_name()
const override {
return "regexp_replace"; }
380 const char *
func_name()
const override {
return "regexp_substr"; }
411#if defined(__GNUC__) && !defined(__clang__)
412#pragma GCC diagnostic pop
const CHARSET_INFO * collation
Definition: item.h:175
Definition: item_regexp_func.h:402
Item_func_icu_version(const POS &pos)
Definition: item_regexp_func.cc:316
bool itemize(Parse_context *pc, Item **res) override
The same as contextualize() but with additional parameter.
Definition: item_regexp_func.cc:322
Definition: item_regexp_func.h:227
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Copy-pasted from Item_int_func.
Definition: item_regexp_func.h:266
int retopt_arg_pos() const
The position in the argument list of occurrence.
Definition: item_regexp_func.h:277
const char * func_name() const override
Definition: item_regexp_func.h:244
bool fix_fields(THD *thd, Item **arguments) override
Decides on the mode for matching, case sensitivity etc.
Definition: item_regexp_func.cc:157
Item_func_regexp_instr(const POS &pos, PT_item_list *opt_list)
Definition: item_regexp_func.h:229
String * val_str(String *str) override
Definition: item_regexp_func.h:238
double val_real() override
Definition: item_regexp_func.h:240
bool get_time(MYSQL_TIME *t) override
Definition: item_regexp_func.h:270
int occ_arg_pos() const override
The position in the argument list of 'occurrence'.
Definition: item_regexp_func.h:275
int match_arg_pos() const override
The position in the argument list of match_parameter.
Definition: item_regexp_func.h:278
std::optional< int > return_option() const
The value of the return_option argument, or its default if absent.
Definition: item_regexp_func.h:247
bool resolve_type(THD *) final
Resolves the collation to use for comparison.
Definition: item_regexp_func.cc:170
Item_result result_type() const override
Definition: item_regexp_func.h:234
longlong val_int() override
Definition: item_regexp_func.cc:178
int pos_arg_pos() const override
The position in the argument list of 'position'.
Definition: item_regexp_func.h:274
Definition: item_regexp_func.h:284
bool is_bool_func() const override
Definition: item_regexp_func.h:301
int occ_arg_pos() const override
The position in the argument list of 'occurrence'.
Definition: item_regexp_func.h:319
bool resolve_type(THD *) final
Resolves the collation to use for comparison.
Definition: item_regexp_func.cc:226
int pos_arg_pos() const override
The position in the argument list of 'position'.
Definition: item_regexp_func.h:318
String * val_str(String *str) override
Definition: item_regexp_func.h:293
longlong val_int() override
Definition: item_regexp_func.cc:202
Item_func_regexp_like(const POS &pos, PT_item_list *opt_list)
Definition: item_regexp_func.h:286
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Copy-pasted from Item_int_func.
Definition: item_regexp_func.h:310
int match_arg_pos() const override
The position in the argument list of match_parameter.
Definition: item_regexp_func.h:320
double val_real() override
Definition: item_regexp_func.h:295
Item_result result_type() const override
Definition: item_regexp_func.h:291
const char * func_name() const override
Definition: item_regexp_func.h:299
bool get_time(MYSQL_TIME *t) override
Definition: item_regexp_func.h:314
Definition: item_regexp_func.h:326
double val_real() override
Definition: item_regexp_func.h:341
Item_func_regexp_replace(const POS &pos, PT_item_list *item_list)
Definition: item_regexp_func.h:328
const char * func_name() const override
Definition: item_regexp_func.h:343
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Copy-pasted from Item_str_func.
Definition: item_regexp_func.h:352
longlong val_int() override
Definition: item_regexp_func.h:337
bool get_time(MYSQL_TIME *t) override
Definition: item_regexp_func.h:356
int pos_arg_pos() const override
The position in the argument list of 'position'.
Definition: item_regexp_func.h:360
Item * replacement()
Definition: item_regexp_func.h:335
int occ_arg_pos() const override
The position in the argument list of 'occurrence'.
Definition: item_regexp_func.h:361
bool resolve_type(THD *) final
Resolves the collation to use for comparison.
Definition: item_regexp_func.cc:233
Item_result result_type() const override
Definition: item_regexp_func.h:331
String * val_str(String *result) override
Definition: item_regexp_func.cc:260
int match_arg_pos() const override
The position in the argument list of match_parameter.
Definition: item_regexp_func.h:362
Definition: item_regexp_func.h:365
longlong val_int() override
Definition: item_regexp_func.h:374
int pos_arg_pos() const override
The position in the argument list of 'position'.
Definition: item_regexp_func.h:397
const char * func_name() const override
Definition: item_regexp_func.h:380
bool resolve_type(THD *) final
Resolves the collation to use for comparison.
Definition: item_regexp_func.cc:284
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Copy-pasted from Item_str_func.
Definition: item_regexp_func.h:389
double val_real() override
Definition: item_regexp_func.h:378
int match_arg_pos() const override
The position in the argument list of match_parameter.
Definition: item_regexp_func.h:399
int occ_arg_pos() const override
The position in the argument list of 'occurrence'.
Definition: item_regexp_func.h:398
String * val_str(String *result) override
Definition: item_regexp_func.cc:294
Item_func_regexp_substr(const POS &pos, PT_item_list *item_list)
Definition: item_regexp_func.h:367
bool get_time(MYSQL_TIME *t) override
Definition: item_regexp_func.h:393
Item_result result_type() const override
Definition: item_regexp_func.h:370
Base class for all regular expression function classes.
Definition: item_regexp_func.h:85
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_regexp_func.cc:135
std::optional< int > position() const
The value of the position argument, or its default if absent.
Definition: item_regexp_func.h:113
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:151
Item * pattern() const
The expression for the pattern string.
Definition: item_regexp_func.h:110
Item * subject() const
The expression for the subject string.
Definition: item_regexp_func.h:107
my_decimal * convert_int_to_decimal(my_decimal *value)
Definition: item_regexp_func.h:175
bool fix_fields(THD *thd, Item **) override
Decides on the mode for matching, case sensitivity etc.
Definition: item_regexp_func.cc:124
bool set_pattern()
Definition: item_regexp_func.cc:140
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:224
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:198
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:108
String * convert_int_to_str(String *str)
Definition: item_regexp_func.h:167
double convert_int_to_real()
Definition: item_regexp_func.h:183
std::optional< int > occurrence() const
The value of the occurrence argument, or its default if absent.
Definition: item_regexp_func.h:132
Item_func_regexp(const POS &pos, PT_item_list *opt_list)
Definition: item_regexp_func.h:87
double convert_str_to_real()
Definition: item_regexp_func.h:188
Definition: item_func.h:93
Item ** args
Array of pointers to arguments.
Definition: item_func.h:100
uint arg_count
How many arguments in 'args'.
Definition: item_func.h:123
Item ** arguments() const
Definition: item_func.h:127
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:5397
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:850
String str_value
str_values's main purpose is to cache the value in save_in_field
Definition: item.h:3310
DTCollation collation
Character set and collation properties assigned for this Item.
Definition: item.h:3317
void set_data_type_bool()
Definition: item.h:1395
bool is_nullable() const
Definition: item.h:3399
bool get_time_from_string(MYSQL_TIME *ltime)
Convert val_str() to time in MYSQL_TIME.
Definition: item.cc:1518
virtual longlong val_int()=0
bool fixed
True if item has been resolved.
Definition: item.h:3388
bool null_value
True if item is null.
Definition: item.h:3425
bool unsigned_flag
Definition: item.h:3426
bool get_date_from_string(MYSQL_TIME *ltime, my_time_flags_t flags)
Convert val_str() to date in MYSQL_TIME.
Definition: item.cc:1431
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:1459
void set_data_type_longlong()
Set the data type of the Item to be longlong.
Definition: item.h:1406
bool get_time_from_int(MYSQL_TIME *ltime)
Convert val_int() to time in MYSQL_TIME.
Definition: item.cc:1546
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:138
String class wrapper with a preallocated buffer of size buff_sz.
Definition: sql_string.h:629
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:33
my_decimal class limits 'decimal_t' type to what we need in MySQL.
Definition: my_decimal.h:93
#define E_DEC_FATAL_ERROR
Definition: decimal.h:148
static std::string to_string(const LEX_STRING &str)
Definition: lex_string.h:49
#define my_strntoll(s, a, b, c, d, e)
Definition: m_ctype.h:768
#define my_strntod(s, a, b, c, d)
Definition: m_ctype.h:772
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:356
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:1063
Definition: buf0block_hint.cc:29
static Value err()
Create a Value object that represents an error condition.
Definition: json_binary.cc:909
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
Environment data for the contextualization phase.
Definition: parse_tree_node_base.h:120
Bison "location" class.
Definition: parse_location.h:42
unsigned int uint
Definition: uca-dump.cc:29
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