[Pkg-owncloud-commits] [owncloud] 01/06: on oracle use regex_like to make filename search case insensitive

David Prévot taffit at moszumanska.debian.org
Tue Jun 17 21:58:32 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to annotated tag v5.0.17beta1
in repository owncloud.

commit faaf32ecf5800c0eb70557313be265f61e67949e
Author: Jörn Friedrich Dreyer <jfd at butonic.de>
Date:   Tue Apr 22 20:27:50 2014 +0200

    on oracle use regex_like to make filename search case insensitive
---
 lib/files/cache/cache.php | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/lib/files/cache/cache.php b/lib/files/cache/cache.php
index a30598f..3bf0724 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()) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list