MySQL 8.4.2
Source Code Documentation
mf_wcomp.h File Reference

Go to the source code of this file.

Functions

int wild_compare_full (const char *str, int strlen, const char *wildstr, int wildlen, bool str_is_pattern, char w_prefix, char w_one, char w_many)
 Performs wildcard matching, aka globbing, on the input string with the given wildcard pattern, and the specified wildcard characters. More...
 
int wild_compare (const char *str, int strlen, const char *wildstr, int wildlen, bool str_is_pattern)
 Performs wildcard matching, aka globbing, on the input string with the given wildcard pattern, using the standard SQL wildcard ('_', '' and '\') notation. More...
 

Variables

const char wild_prefix = '\\'
 Character constant for the escape character in a wildcard pattern (SQL style). More...
 
const char wild_one = '_'
 Character constant for wildcard representing any one character (SQL style). More...
 
const char wild_many = '%'
 Character constant for wildcard representing zero or more characters (SQL style). More...
 

Function Documentation

◆ wild_compare()

int wild_compare ( const char *  str,
int  strlen,
const char *  wildstr,
int  wildlen,
bool  str_is_pattern 
)

Performs wildcard matching, aka globbing, on the input string with the given wildcard pattern, using the standard SQL wildcard ('_', '' and '\') notation.

Deprecated:
This function is not charset-aware, and should not be used in new code.
Parameters
strinput which should be matched against pattern
strlenlength of str in bytes
wildstrpattern with wildcards
wildlenlength of wildstr in bytes
str_is_patternif true the input string is considered to be a pattern, meaning that escape sequences in the input are processed as if they appeared in the pattern.
Returns
0 if match, 1 otherwise

◆ wild_compare_full()

int wild_compare_full ( const char *  str,
int  strlen,
const char *  wildstr,
int  wildlen,
bool  str_is_pattern,
char  w_prefix,
char  w_one,
char  w_many 
)

Performs wildcard matching, aka globbing, on the input string with the given wildcard pattern, and the specified wildcard characters.

Note that when str_is_pattern is true, an escaped wildcard in the pattern will only match an escaped wildcard in the string, e.g the string "my_1" will not be matched by the pattern "my\\_1".

Deprecated:
This function is not charset-aware, and should not be used in new code.
Parameters
strinput which should be matched against pattern
strlenlength of str in bytes
wildstrpattern with wildcards
wildlenlength of wildstr in bytes
str_is_patternif true the input string is considered to be a pattern, meaning that escape sequences in the input are processed as if they appeared in the pattern
w_onewildcard character matching any single character
w_manywildcard character matching 0 or more characters
w_prefixescape character for the pattern
Returns
0 if match, 1 otherwise

Variable Documentation

◆ wild_many

const char wild_many = '%'

Character constant for wildcard representing zero or more characters (SQL style).

◆ wild_one

const char wild_one = '_'

Character constant for wildcard representing any one character (SQL style).

◆ wild_prefix

const char wild_prefix = '\\'

Character constant for the escape character in a wildcard pattern (SQL style).