MySQL 8.0.30
Source Code Documentation
mf_wcomp.cc File Reference

Functions for comparing with wild-cards. More...

#include "mf_wcomp.h"
#include "my_dbug.h"

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...
 

Detailed Description

Functions for comparing with wild-cards.

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