when using oracle use LOWER() to make searching files case insensitive

This commit is contained in:
Jörn Friedrich Dreyer 2012-10-17 18:17:20 +02:00
parent 519a0ae4ab
commit a7d8519550
1 changed files with 8 additions and 2 deletions

View File

@ -217,10 +217,16 @@ class OC_FileCache{
} }
$rootLen=strlen($root); $rootLen=strlen($root);
if(!$returnData) { if(!$returnData) {
$query=OC_DB::prepare('SELECT `path` FROM `*PREFIX*fscache` WHERE `name` LIKE ? AND `user`=?'); $select = '`path`';
}else{ }else{
$query=OC_DB::prepare('SELECT * FROM `*PREFIX*fscache` WHERE `name` LIKE ? AND `user`=?'); $select = '*';
} }
if (OC_Config::getValue('dbtype') === 'oci8') {
$where = 'LOWER(`name`) LIKE LOWER(?) AND `user`=?';
} else {
$where = '`name` LIKE ? AND `user`=?';
}
$query=OC_DB::prepare('SELECT '.$select.' FROM `*PREFIX*fscache` WHERE '.$where);
$result=$query->execute(array("%$search%",OC_User::getUser())); $result=$query->execute(array("%$search%",OC_User::getUser()));
$names=array(); $names=array();
while($row=$result->fetchRow()) { while($row=$result->fetchRow()) {