]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix errors from unit tests
authorBart Visscher <bartv@thisnet.nl>
Fri, 19 Jul 2013 09:07:17 +0000 (11:07 +0200)
committerBart Visscher <bartv@thisnet.nl>
Sun, 21 Jul 2013 21:17:37 +0000 (23:17 +0200)
lib/db/adapter.php
lib/db/adaptersqlite.php

index 92c24b46fff6dad7b186aae35c55e21a4ebbf32b..20e7ea4a600db572702937bccfa4f948b7437d9f 100644 (file)
@@ -38,8 +38,7 @@ class Adapter {
                $inserts = array_merge($inserts, $inserts);
 
                try {
-                       $statement = $this->conn->prepare($query);
-                       $result = $statement->execute($inserts);
+                       $result = $this->conn->executeUpdate($query, $inserts);
                } catch(\Doctrine\DBAL\DBALException $e) {
                        $entry = 'DB Error: "'.$e->getMessage() . '"<br />';
                        $entry .= 'Offending command was: ' . $query.'<br />';
index 61cfaa442425811a99813a6505f2ac35550ec4c9..fa6d308ae328c85d73c2ac1ff16485797aa1c09f 100644 (file)
@@ -27,7 +27,7 @@ class AdapterSqlite extends Adapter {
                $query = substr($query, 0, strlen($query) - 5);
                try {
                        $stmt = $this->conn->prepare($query);
-                       $result = $stmt->execute(array($input));
+                       $result = $stmt->execute(array_values($input));
                } catch(\Doctrine\DBAL\DBALException $e) {
                        $entry = 'DB Error: "'.$e->getMessage() . '"<br />';
                        $entry .= 'Offending command was: ' . $query . '<br />';
@@ -36,7 +36,7 @@ class AdapterSqlite extends Adapter {
                        \OC_Template::printErrorPage( $entry );
                }
 
-               if ($stmt->fetchColumn() === 0) {
+               if ($stmt->fetchColumn() === '0') {
                        $query = 'INSERT INTO `' . $table . '` (`'
                                . implode('`,`', array_keys($input)) . '`) VALUES('
                                . str_repeat('?,', count($input)-1).'? ' . ')';