for oracle use BITAND() instead of & in sharing permissions sql

This commit is contained in:
Jörn Friedrich Dreyer 2013-06-24 22:52:01 +02:00
parent bca2eb39fa
commit b32d6d8487
1 changed files with 7 additions and 3 deletions

View File

@ -662,9 +662,13 @@ class Share {
// Remove the permissions for all reshares of this item
if (!empty($ids)) {
$ids = "'".implode("','", $ids)."'";
$query = \OC_DB::prepare('UPDATE `*PREFIX*share` SET `permissions` = `permissions` & ?'
.' WHERE `id` IN ('.$ids.')');
$query->execute(array($permissions));
// the binary operator & works on sqlite, mysql, postgresql and mssql
$sql = 'UPDATE `*PREFIX*share` SET `permissions` = `permissions` & ? WHERE `id` IN ('.$ids.')';
if (\OC_Config::getValue('dbtype', 'sqlite') === 'oci') {
// guess which dbms does not handle & and uses a function for this
$sql = 'UPDATE `*PREFIX*share` SET `permissions` = BITAND(`permissions`,?) WHERE `id` IN ('.$ids.')';
}
\OC_DB::executeAudited($sql, array($permissions));
}
}
}