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