MySQL 9.1.0
Source Code Documentation
mf_wcomp.h
Go to the documentation of this file.
1/* Copyright (c) 2016, 2024, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is designed to work with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef MF_WCOMP_INCLUDED
25#define MF_WCOMP_INCLUDED
26
27/**
28 Character constant for the escape character in a wildcard pattern
29 (SQL style).
30*/
31const char wild_prefix = '\\';
32
33/**
34 Character constant for wildcard representing any one character
35 (SQL style).
36*/
37const char wild_one = '_';
38
39/**
40 Character constant for wildcard representing zero or more
41 characters (SQL style).
42*/
43const char wild_many = '%';
44
45/**
46 Performs wildcard matching, aka globbing, on the input string with
47 the given wildcard pattern, and the specified wildcard characters.
48
49 Note that when str_is_pattern is true, an escaped wildcard in the
50 pattern will only match an escaped wildcard in the string, e.g the
51 string "my_1" will *not* be matched by the pattern "my\\_1".
52
53 @deprecated This function is not charset-aware, and should not be
54 used in new code.
55
56 @param str input which should be matched against pattern
57 @param strlen length of str in bytes
58 @param wildstr pattern with wildcards
59 @param wildlen length of wildstr in bytes
60
61 @param str_is_pattern if true the input string is considered to be a
62 pattern, meaning that escape sequences in the input are processed as
63 if they appeared in the pattern
64 @param w_one wildcard character matching any single character
65 @param w_many wildcard character matching 0 or more characters
66 @param w_prefix escape character for the pattern
67
68 @return 0 if match, 1 otherwise
69*/
70int wild_compare_full(const char *str, int strlen, const char *wildstr,
71 int wildlen, bool str_is_pattern, char w_prefix,
72 char w_one, char w_many);
73
74/**
75 Performs wildcard matching, aka globbing, on the input string with
76 the given wildcard pattern, using the standard SQL wildcard ('_',
77 '%' and '\\') notation.
78
79 @deprecated This function is not charset-aware, and should not be
80 used in new code.
81
82 @param str input which should be matched against pattern
83 @param strlen length of str in bytes
84 @param wildstr pattern with wildcards
85 @param wildlen length of wildstr in bytes
86
87 @param str_is_pattern if true the input string is considered to be a
88 pattern, meaning that escape sequences in the input are processed as
89 if they appeared in the pattern.
90
91 @return 0 if match, 1 otherwise
92 */
93int wild_compare(const char *str, int strlen, const char *wildstr, int wildlen,
94 bool str_is_pattern);
95
96#endif /* !MF_WCOMP_INCLUDED */
const char wild_prefix
Character constant for the escape character in a wildcard pattern (SQL style).
Definition: mf_wcomp.h:31
const char wild_many
Character constant for wildcard representing zero or more characters (SQL style).
Definition: mf_wcomp.h:43
const char wild_one
Character constant for wildcard representing any one character (SQL style).
Definition: mf_wcomp.h:37
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,...
Definition: mf_wcomp.cc:121
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,...
Definition: mf_wcomp.cc:44
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1105