From b32d6d84878798b78afa757c4d8a068a84ab9513 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Mon, 24 Jun 2013 22:52:01 +0200 Subject: [PATCH] for oracle use BITAND() instead of & in sharing permissions sql --- lib/public/share.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/public/share.php b/lib/public/share.php index 122ab3fa03..f40cd0d77f 100644 --- a/lib/public/share.php +++ b/lib/public/share.php @@ -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)); } } }