]> source.dussan.org Git - nextcloud-server.git/commitdiff
for oracle use BITAND() instead of & in sharing permissions sql
authorJörn Friedrich Dreyer <jfd@butonic.de>
Mon, 24 Jun 2013 20:52:01 +0000 (22:52 +0200)
committerJörn Friedrich Dreyer <jfd@butonic.de>
Mon, 24 Jun 2013 20:52:01 +0000 (22:52 +0200)
lib/public/share.php

index 122ab3fa03019717d15af5a199de0c493d2eaf48..f40cd0d77fabcefa2721fd6ebde2bf03b49ab7b9 100644 (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));
                                        }
                                }
                        }