summaryrefslogtreecommitdiffstats
path: root/lib/private/db
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2014-07-02 15:27:27 +0200
committerRobin Appelman <icewind@owncloud.com>2014-07-02 15:27:27 +0200
commitc4fa07d7cfa06073e8c59ad7641a4221a844254c (patch)
treef63aa25a56f8547542dee6b17406cea838a5b6fb /lib/private/db
parentb20018928d9500faba89d5f3af0fc483f866d4c7 (diff)
downloadnextcloud-server-c4fa07d7cfa06073e8c59ad7641a4221a844254c.tar.gz
nextcloud-server-c4fa07d7cfa06073e8c59ad7641a4221a844254c.zip
Also update sqliteadapter
Diffstat (limited to 'lib/private/db')
-rw-r--r--lib/private/db/adaptersqlite.php14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/private/db/adaptersqlite.php b/lib/private/db/adaptersqlite.php
index fa6d308ae32..5b9c5a437da 100644
--- a/lib/private/db/adaptersqlite.php
+++ b/lib/private/db/adaptersqlite.php
@@ -21,13 +21,21 @@ class AdapterSqlite extends Adapter {
// NOTE: For SQLite we have to use this clumsy approach
// otherwise all fieldnames used must have a unique key.
$query = 'SELECT COUNT(*) FROM `' . $table . '` WHERE ';
- foreach($input as $key => $value) {
- $query .= '`' . $key . '` = ? AND ';
+ $inserts = array();
+ foreach ($input as $key => $value) {
+ $query .= '`' . $key . '`';
+ if (is_null($value)) {
+ $query .= ' IS NULL AND ';
+ } else {
+ $inserts[] = $value;
+ $query .= ' = ? AND ';
+ }
}
$query = substr($query, 0, strlen($query) - 5);
+
try {
$stmt = $this->conn->prepare($query);
- $result = $stmt->execute(array_values($input));
+ $result = $stmt->execute($inserts);
} catch(\Doctrine\DBAL\DBALException $e) {
$entry = 'DB Error: "'.$e->getMessage() . '"<br />';
$entry .= 'Offending command was: ' . $query . '<br />';