diff options
author | Jörn Friedrich Dreyer <jfd@butonic.de> | 2014-06-03 18:11:56 +0200 |
---|---|---|
committer | Jörn Friedrich Dreyer <jfd@butonic.de> | 2014-06-03 18:11:56 +0200 |
commit | ea801dde9c57df5ea645e36ff178aa566a3110d9 (patch) | |
tree | befa967e0a7d46434eee10d85dbbdfa93a1f2b6c | |
parent | 5dc3b1dc71336be656ea35c4ae3356c0eb576c71 (diff) | |
parent | faaf32ecf5800c0eb70557313be265f61e67949e (diff) | |
download | nextcloud-server-ea801dde9c57df5ea645e36ff178aa566a3110d9.tar.gz nextcloud-server-ea801dde9c57df5ea645e36ff178aa566a3110d9.zip |
Merge pull request #8306 from owncloud/case_insensitive_search_oracle_stable5
Case insensitive search oracle stable5
-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()) { |