MySQL 8.0.39
Source Code Documentation
regexp Namespace Reference

Classes

class  Regexp_engine
 This class exposes high-level regular expression operations to the facade. More...
 
class  Regexp_facade
 This class handles. More...
 
struct  UErrorCodeHash
 

Functions

bool check_icu_status (UErrorCode status, const UParseError *parse_error)
 
UBool QueryNotKilled (const void *context, int32_t steps)
 Implements a match callback function for icu that aborts execution if the query was killed. More...
 
const char * icu_version_string ()
 
static bool EvalExprToCharset (Item *expr, std::u16string *out, int skip=0)
 Evaluates an expression to an output buffer, performing character set conversion to regexp_lib_charset if necessary. More...
 

Variables

std::unordered_map< UErrorCode, int, UErrorCodeHasherror_map
 Map from ICU error codes to MySQL dittos. More...
 
static constexpr CHARSET_INFOregexp_lib_charset
 
static const CHARSET_INFOfaux_binary_charset = &my_charset_latin1
 When dealing with the binary character set, we tell ICU that we're using CP-1252. More...
 

Function Documentation

◆ check_icu_status()

bool regexp::check_icu_status ( UErrorCode  status,
const UParseError *  parse_error 
)

◆ EvalExprToCharset()

static bool regexp::EvalExprToCharset ( Item expr,
std::u16string *  out,
int  skip = 0 
)
static

Evaluates an expression to an output buffer, performing character set conversion to regexp_lib_charset if necessary.

The procedure supports the optimization that code points before the start position are not converted to UTF-16.

Parameters
exprThe expression to be printed.
[out]outWill be cleared, and the result stored.
skipIf present, this number of code points will be exempted from conversion. If the string is smaller than that, an out of bounds error is raised.
Returns
false on success, true on error.

◆ icu_version_string()

const char * regexp::icu_version_string ( )

◆ QueryNotKilled()

UBool regexp::QueryNotKilled ( const void *  context,
int32_t  steps 
)

Implements a match callback function for icu that aborts execution if the query was killed.

Parameters
contextThe session to check for killed query.
stepsNot used.
Return values
falseQuery was killed in the session and the match should abort.
trueQuery was not killed, matching should continue.

Variable Documentation

◆ error_map

std::unordered_map<UErrorCode, int, UErrorCodeHash> regexp::error_map

Map from ICU error codes to MySQL dittos.

We strive to keep this list in the same order as the enum UErrorCode in common/unicode/utypes.h.

ICU version 67 introduced a new implementation for '\X' "Match a Grapheme Cluster". This means that our bundled version will return ER_REGEXP_MISSING_RESOURCE while for system ICU we return ER_WARN_REGEXP_USING_DEFAULT as a Note.

TODO(tdidriks) Bundle data files in icudt69b/brkitr/ icudt69l/brkitr/ so that bundled and system ICU results are aligned.

◆ faux_binary_charset

const CHARSET_INFO* regexp::faux_binary_charset = &my_charset_latin1
static

When dealing with the binary character set, we tell ICU that we're using CP-1252.

This way, comparisons will happen as the user expects; each octet value is equal to itself, and only to itself. And of course, CP-1252 is known as "latin1" in MySQL.

◆ regexp_lib_charset

constexpr CHARSET_INFO* regexp::regexp_lib_charset
staticconstexpr
Initial value:
=
CHARSET_INFO my_charset_utf16le_general_ci
Definition: ctype-ucs2.cc:1571