Use ILIKE in cache search

This commit is contained in:
Robin Appelman 2014-09-17 16:12:54 +02:00
parent 67b1ec1faf
commit 0c03b2bdd5
1 changed files with 1 additions and 13 deletions

View File

@ -464,19 +464,7 @@ class Cache {
`mimetype`, `mimepart`, `size`, `mtime`, `encrypted`,
`unencrypted_size`, `etag`, `permissions`
FROM `*PREFIX*filecache`
WHERE `storage` = ? AND ';
$dbtype = \OC_Config::getValue( 'dbtype', 'sqlite' );
if($dbtype === 'oci') {
//remove starting and ending % from the pattern
$pattern = '^'.str_replace('%', '.*', $pattern).'$';
$sql .= 'REGEXP_LIKE(`name`, ?, \'i\')';
} else if($dbtype === 'pgsql') {
$sql .= '`name` ILIKE ?';
} else if ($dbtype === 'mysql') {
$sql .= '`name` COLLATE utf8_general_ci LIKE ?';
} else {
$sql .= '`name` LIKE ?';
}
WHERE `storage` = ? AND `name` ILIKE ?';
$result = \OC_DB::executeAudited($sql,
array($this->getNumericStorageId(), $pattern)
);