diff options
author | Jörn Friedrich Dreyer <jfd@butonic.de> | 2014-04-22 20:27:50 +0200 |
---|---|---|
committer | Jörn Friedrich Dreyer <jfd@butonic.de> | 2014-04-22 20:27:50 +0200 |
commit | faaf32ecf5800c0eb70557313be265f61e67949e (patch) | |
tree | 8efb225c1396ec3216d95e5185c4cf93b3e70c23 /lib | |
parent | ec594eb53084c62936d47d22757cdbc0fd0dcd5a (diff) | |
download | nextcloud-server-faaf32ecf5800c0eb70557313be265f61e67949e.tar.gz nextcloud-server-faaf32ecf5800c0eb70557313be265f61e67949e.zip |
on oracle use regex_like to make filename search case insensitive
Diffstat (limited to 'lib')
-rw-r--r-- | lib/files/cache/cache.php | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/lib/files/cache/cache.php b/lib/files/cache/cache.php index a30598f5695..3bf0724143d 100644 --- a/lib/files/cache/cache.php +++ b/lib/files/cache/cache.php @@ -513,14 +513,23 @@ class Cache { public function search($pattern) { // normalize pattern $pattern = $this->normalize($pattern); + + $sql = 'SELECT `fileid`, `storage`, `path`, `parent`, `name`, + `mimetype`, `mimepart`, `size`, `mtime`, + `encrypted`, `unencrypted_size`, `etag` + FROM `*PREFIX*filecache` + WHERE `storage` = ? AND '; + if(\OC_Config::getValue( 'dbtype', 'sqlite' ) === 'oci') { + //remove starting and ending % from the pattern + $pattern = trim($pattern, '%'); + $sql .= 'REGEXP_LIKE(`name`, ?, \'i\')'; + } else { + $sql .= '`name` LIKE ?'; + } - $result = \OC_DB::executeAudited(' - SELECT `fileid`, `storage`, `path`, `parent`, `name`, - `mimetype`, `mimepart`, `size`, `mtime`, - `encrypted`, `unencrypted_size`, `etag` - FROM `*PREFIX*filecache` - WHERE `name` LIKE ? AND `storage` = ?', - array($pattern, $this->numericId) + $result = \OC_DB::executeAudited( + $sql, + array($this->numericId, $pattern) ); $files = array(); while ($row = $result->fetchRow()) { |