]> source.dussan.org Git - nextcloud-server.git/commitdiff
Oracle can not return statements but only values
authorJoas Schilling <nickvergessen@owncloud.com>
Fri, 13 Nov 2015 09:32:45 +0000 (10:32 +0100)
committerJoas Schilling <nickvergessen@owncloud.com>
Mon, 30 Nov 2015 16:12:48 +0000 (17:12 +0100)
So evaluate the condition directly and return 1 or 0

apps/files/lib/activity.php
apps/files/tests/activitytest.php

index f3bbff486403a001a5949812bf283347fc459f34..d473120b31fc946ad13c39187c93f4f2b0ab2b48 100644 (file)
@@ -379,6 +379,7 @@ class Activity implements IExtension {
                         */
                        $parameters = $fileQueryList = [];
                        $parameters[] = self::APP_FILES;
+                       $parameters[] = self::APP_FILES;
 
                        $fileQueryList[] = '(`type` <> ? AND `type` <> ?)';
                        $parameters[] = self::TYPE_SHARE_CREATED;
@@ -393,10 +394,12 @@ class Activity implements IExtension {
                                $parameters[] = $favorite . '/%';
                        }
 
-                       $parameters[] = self::APP_FILES;
-
                        return [
-                               ' CASE WHEN `app` = ? THEN (' . implode(' OR ', $fileQueryList) . ') ELSE `app` <> ? END ',
+                               ' CASE '
+                                       . 'WHEN `app` <> ? THEN 1 '
+                                       . 'WHEN `app` = ? AND (' . implode(' OR ', $fileQueryList) . ') THEN 1 '
+                                       . 'ELSE 0 '
+                               . 'END = 1 ',
                                $parameters,
                        ];
                }
index cdb1d21bcd88e55d6bd3c5f4e99613374e12c26f..485c559d488bfc5da0cc123db092285fab861d57 100644 (file)
@@ -290,16 +290,16 @@ class ActivityTest extends TestCase {
                                        'items' => [],
                                        'folders' => [],
                                ],
-                               ' CASE WHEN `app` = ? THEN ((`type` <> ? AND `type` <> ?)) ELSE `app` <> ? END ',
-                               ['files', Activity::TYPE_SHARE_CREATED, Activity::TYPE_SHARE_CHANGED, 'files']
+                               ' CASE WHEN `app` <> ? THEN 1 WHEN `app` = ? AND ((`type` <> ? AND `type` <> ?)) THEN 1 ELSE 0 END = 1 ',
+                               ['files', 'files', Activity::TYPE_SHARE_CREATED, Activity::TYPE_SHARE_CHANGED]
                        ],
                        [
                                [
                                        'items' => ['file.txt', 'folder'],
                                        'folders' => ['folder'],
                                ],
-                               ' CASE WHEN `app` = ? THEN ((`type` <> ? AND `type` <> ?) OR `file` = ? OR `file` = ? OR `file` LIKE ?) ELSE `app` <> ? END ',
-                               ['files', Activity::TYPE_SHARE_CREATED, Activity::TYPE_SHARE_CHANGED, 'file.txt', 'folder', 'folder/%', 'files']
+                               ' CASE WHEN `app` <> ? THEN 1 WHEN `app` = ? AND ((`type` <> ? AND `type` <> ?) OR `file` = ? OR `file` = ? OR `file` LIKE ?) THEN 1 ELSE 0 END = 1 ',
+                               ['files', 'files', Activity::TYPE_SHARE_CREATED, Activity::TYPE_SHARE_CHANGED, 'file.txt', 'folder', 'folder/%']
                        ],
                ];
        }