From be7c6139938564fc2ce5a12982eb82f60087f900 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Fri, 19 Jul 2013 11:07:17 +0200 Subject: [PATCH] Fix errors from unit tests --- lib/db/adapter.php | 3 +-- lib/db/adaptersqlite.php | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/db/adapter.php b/lib/db/adapter.php index 92c24b46ff..20e7ea4a60 100644 --- a/lib/db/adapter.php +++ b/lib/db/adapter.php @@ -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() . '"
'; $entry .= 'Offending command was: ' . $query.'
'; diff --git a/lib/db/adaptersqlite.php b/lib/db/adaptersqlite.php index 61cfaa4424..fa6d308ae3 100644 --- a/lib/db/adaptersqlite.php +++ b/lib/db/adaptersqlite.php @@ -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() . '"
'; $entry .= 'Offending command was: ' . $query . '
'; @@ -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).'? ' . ')';