diff options
author | Alexey Botchkov <holyfoot@askmonty.org> | 2019-12-17 01:37:59 +0400 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2019-12-21 10:34:02 +0100 |
commit | 9dadfdcde5a63a4d67f0f7a3720632bcb1d589d7 (patch) | |
tree | 5fd6298b3dfe07cc08bd6ffebbe65081818c13ac /sql/sys_vars.cc | |
parent | ce70573f6255d2720c39309e0d41e181dab2d685 (diff) | |
download | mariadb-git-9dadfdcde5a63a4d67f0f7a3720632bcb1d589d7.tar.gz |
MDEV-14024 PCRE2.
Related changes in the server code.
Diffstat (limited to 'sql/sys_vars.cc')
-rw-r--r-- | sql/sys_vars.cc | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index ab53f339b2b..f5b915ec916 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -5994,29 +5994,40 @@ static const char *default_regex_flags_names[]= "DOTALL", // (?s) . matches anything including NL "DUPNAMES", // (?J) Allow duplicate names for subpatterns "EXTENDED", // (?x) Ignore white space and # comments - "EXTRA", // (?X) extra features (e.g. error on unknown escape character) + "EXTENDED_MORE",//(?xx) Ignore white space and # comments inside cheracter + "EXTRA", // means nothing since PCRE2 "MULTILINE", // (?m) ^ and $ match newlines within data "UNGREEDY", // (?U) Invert greediness of quantifiers 0 }; static const int default_regex_flags_to_pcre[]= { - PCRE_DOTALL, - PCRE_DUPNAMES, - PCRE_EXTENDED, - PCRE_EXTRA, - PCRE_MULTILINE, - PCRE_UNGREEDY, + PCRE2_DOTALL, + PCRE2_DUPNAMES, + PCRE2_EXTENDED, + PCRE2_EXTENDED_MORE, + -1, /* EXTRA flag not available since PCRE2 */ + PCRE2_MULTILINE, + PCRE2_UNGREEDY, 0 }; -int default_regex_flags_pcre(const THD *thd) +int default_regex_flags_pcre(THD *thd) { ulonglong src= thd->variables.default_regex_flags; int i, res; for (i= res= 0; default_regex_flags_to_pcre[i]; i++) { if (src & (1ULL << i)) + { + if (default_regex_flags_to_pcre[i] < 0) + { + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + ER_UNKNOWN_ERROR, + "PCRE2 doens't support the EXTRA flag. Ignored."); + continue; + } res|= default_regex_flags_to_pcre[i]; + } } return res; } |