]> source.dussan.org Git - nextcloud-server.git/commitdiff
add missing sql backticks, check sharing for error and add log
authorJörn Friedrich Dreyer <jfd@butonic.de>
Mon, 12 Nov 2012 11:04:46 +0000 (12:04 +0100)
committerJörn Friedrich Dreyer <jfd@butonic.de>
Mon, 12 Nov 2012 11:04:46 +0000 (12:04 +0100)
lib/public/share.php

index 071304ec24943ffa9383d469431698737be0ea7e..e8fd6b2e920885a577b4859776f522f01fb04417 100644 (file)
@@ -552,7 +552,7 @@ class Share {
                                        $itemTypes = $collectionTypes;
                                }
                                $placeholders = join(',', array_fill(0, count($itemTypes), '?'));
-                               $where .= ' WHERE item_type IN ('.$placeholders.'))';
+                               $where .= ' WHERE `item_type` IN ('.$placeholders.'))';
                                $queryArgs = $itemTypes;
                        } else {
                                $where = ' WHERE `item_type` = ?';
@@ -629,7 +629,7 @@ class Share {
                        $queryArgs[] = $item;
                        if ($includeCollections && $collectionTypes) {
                                $placeholders = join(',', array_fill(0, count($collectionTypes), '?'));
-                               $where .= ' OR item_type IN ('.$placeholders.'))';
+                               $where .= ' OR `item_type` IN ('.$placeholders.'))';
                                $queryArgs = array_merge($queryArgs, $collectionTypes);
                        }
                }
@@ -677,6 +677,9 @@ class Share {
                $root = strlen($root);
                $query = \OC_DB::prepare('SELECT '.$select.' FROM `*PREFIX*share` '.$where, $queryLimit);
                $result = $query->execute($queryArgs);
+               if (\OC_DB::isError($result)) {
+                       \OC_Log::write('OCP\Share', \OC_DB::getErrorMessage($result) . ', select=' . $select . ' where=' . $where, \OC_Log::ERROR);
+               }
                $items = array();
                $targets = array();
                while ($row = $result->fetchRow()) {