Oracle doesn't know & as bitwise AND

Conflicts:
	lib/public/share.php
This commit is contained in:
Bart Visscher 2013-06-26 21:40:31 +02:00 committed by Jörn Friedrich Dreyer
parent b32d6d8487
commit 6ad7a0336f
1 changed files with 8 additions and 6 deletions

View File

@ -662,13 +662,15 @@ class Share {
// Remove the permissions for all reshares of this item
if (!empty($ids)) {
$ids = "'".implode("','", $ids)."'";
// 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.')';
// TODO this should be done with Doctrine platform objects
if (\OC_Config::getValue( "dbtype") === 'oci') {
$andOp = 'BITAND(`permissions`, ?)';
} else {
$andOp = '`permissions` & ?';
}
\OC_DB::executeAudited($sql, array($permissions));
$query = \OC_DB::prepare('UPDATE `*PREFIX*share` SET `permissions` = '.$andOp
.' WHERE `id` IN ('.$ids.')');
$query->execute(array($permissions));
}
}
}