Use ILIKE in cache search
This commit is contained in:
parent
67b1ec1faf
commit
0c03b2bdd5
|
@ -464,19 +464,7 @@ class Cache {
|
||||||
`mimetype`, `mimepart`, `size`, `mtime`, `encrypted`,
|
`mimetype`, `mimepart`, `size`, `mtime`, `encrypted`,
|
||||||
`unencrypted_size`, `etag`, `permissions`
|
`unencrypted_size`, `etag`, `permissions`
|
||||||
FROM `*PREFIX*filecache`
|
FROM `*PREFIX*filecache`
|
||||||
WHERE `storage` = ? AND ';
|
WHERE `storage` = ? AND `name` ILIKE ?';
|
||||||
$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 ?';
|
|
||||||
}
|
|
||||||
$result = \OC_DB::executeAudited($sql,
|
$result = \OC_DB::executeAudited($sql,
|
||||||
array($this->getNumericStorageId(), $pattern)
|
array($this->getNumericStorageId(), $pattern)
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue