MDL-74912 mod_forum: Fix regexp word boundaries markers in MySQL 8

This commit is contained in:
Matteo Scaramuccia
2022-11-05 10:07:26 +01:00
parent fee1b8ce5f
commit b82c95a075
4 changed files with 62 additions and 2 deletions
+24
View File
@@ -2515,6 +2515,30 @@ abstract class moodle_database {
return '';
}
/**
* Returns the word-beginning boundary marker if this database driver supports regex syntax when searching.
* @return string The word-beginning boundary marker. Otherwise, an empty string.
*/
public function sql_regex_get_word_beginning_boundary_marker() {
if ($this->sql_regex_supported()) {
return '[[:<:]]';
}
return '';
}
/**
* Returns the word-end boundary marker if this database driver supports regex syntax when searching.
* @return string The word-end boundary marker. Otherwise, an empty string.
*/
public function sql_regex_get_word_end_boundary_marker() {
if ($this->sql_regex_supported()) {
return '[[:>:]]';
}
return '';
}
/**
* Returns the SQL that allows to find intersection of two or more queries
*