]> git.mjollnir.org Git - moodle.git/commitdiff
Prevent +/- operators (REGEXP) on course searches for MSSQL and Oracle. MDL-7312
authorstronk7 <stronk7>
Tue, 31 Oct 2006 19:54:46 +0000 (19:54 +0000)
committerstronk7 <stronk7>
Tue, 31 Oct 2006 19:54:46 +0000 (19:54 +0000)
Merged from MOODLE_17_STABLE

lib/datalib.php

index 877e2b14604a583a12aeaaf0bd64812356a0f79f..d27d93f465fdecf6246ffedcdfbe99964ceb6c89 100644 (file)
@@ -717,6 +717,13 @@ function get_courses_search($searchterms, $sort='fullname ASC', $page=0, $record
     $summarysearch = '';
 
     foreach ($searchterms as $searchterm) {
+
+    /// Under Oracle and MSSQL, trim the + and - operators and perform
+    /// simpler LIKE search
+        if ($CFG->dbtype == 'oci8po' || $CFG->dbtype == 'mssql' || $CFG->dbtype == 'mssql_n' || $CFG->dbtype == 'odbc_mssql') {
+            $searchterm = trim($searchterm, '+-');
+        }
+
         if ($fullnamesearch) {
             $fullnamesearch .= ' AND ';
         }