From: stronk7 Date: Tue, 31 Oct 2006 20:17:03 +0000 (+0000) Subject: Transform TOKEN searches into STRING searches and trim +- chars. MDL-7312 X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=7b3cf4595162efaddf8241a91ae07ae95f4833c2;p=moodle.git Transform TOKEN searches into STRING searches and trim +- chars. MDL-7312 Merged from MOODLE_17_STABLE --- diff --git a/lib/searchlib.php b/lib/searchlib.php index b3f6a56791..0e15c496ad 100644 --- a/lib/searchlib.php +++ b/lib/searchlib.php @@ -339,6 +339,14 @@ function search_generate_SQL($parsetree, $datafield, $metafield, $mainidfield, $ $type = $parsetree[$i]->getType(); $value = $parsetree[$i]->getValue(); + /// Under Oracle and MSSQL, transform TOKEN searches into STRING searches and trim +- chars + if ($CFG->dbtype == 'oci8po' || $CFG->dbtype == 'mssql' || $CFG->dbtype == 'mssql_n' || $CFG->dbtype == 'odbc_mssql') { + $value = trim($value, '+-'); + if ($type == TOKEN_EXACT) { + $type = TOKEN_STRING; + } + } + switch($type){ case TOKEN_STRING: $SQLString .= "(($datafield $LIKE '%$value%') OR ($metafield $LIKE '%$value%') )";