MDL-44021 mod_glossary - fixed search multiple keywords sql duplicate parameter error
This commit is contained in:
+11
-11
@@ -152,15 +152,6 @@
|
||||
//$params = array();
|
||||
$i = 0;
|
||||
|
||||
if (empty($fullsearch)) {
|
||||
// With fullsearch disabled, look only within concepts and aliases.
|
||||
$concat = $DB->sql_concat('ge.concept', "' '", "COALESCE(al.alias, :emptychar)");
|
||||
} else {
|
||||
// With fullsearch enabled, look also within definitions.
|
||||
$concat = $DB->sql_concat('ge.concept', "' '", 'ge.definition', "' '", "COALESCE(al.alias, :emptychar)");
|
||||
}
|
||||
$params['emptychar'] = '';
|
||||
|
||||
$searchterms = explode(" ",$hook);
|
||||
|
||||
foreach ($searchterms as $searchterm) {
|
||||
@@ -169,8 +160,17 @@
|
||||
$NOT = false; /// Initially we aren't going to perform NOT LIKE searches, only MSSQL and Oracle
|
||||
/// will use it to simulate the "-" operator with LIKE clause
|
||||
|
||||
/// Under Oracle and MSSQL, trim the + and - operators and perform
|
||||
/// simpler LIKE (or NOT LIKE) queries
|
||||
if (empty($fullsearch)) {
|
||||
// With fullsearch disabled, look only within concepts and aliases.
|
||||
$concat = $DB->sql_concat('ge.concept', "' '", "COALESCE(al.alias, :emptychar".$i.")");
|
||||
} else {
|
||||
// With fullsearch enabled, look also within definitions.
|
||||
$concat = $DB->sql_concat('ge.concept', "' '", 'ge.definition', "' '", "COALESCE(al.alias, :emptychar".$i.")");
|
||||
}
|
||||
$params['emptychar'.$i] = '';
|
||||
|
||||
/// Under Oracle and MSSQL, trim the + and - operators and perform
|
||||
/// simpler LIKE (or NOT LIKE) queries
|
||||
if (!$DB->sql_regex_supported()) {
|
||||
if (substr($searchterm, 0, 1) == '-') {
|
||||
$NOT = true;
|
||||
|
||||
Reference in New Issue
Block a user