Skip to content

Commit

Permalink
Transform TOKEN searches into STRING searches and trim +- chars. MDL-…
Browse files Browse the repository at this point in the history
…7312

Merged from MOODLE_17_STABLE
  • Loading branch information
stronk7 committed Oct 31, 2006
1 parent 6bb0f67 commit 7b3cf45
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/searchlib.php
Expand Up @@ -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%') )";
Expand Down

0 comments on commit 7b3cf45

Please sign in to comment.