From 10a29556b0eca1303fd48caccbc464e1b6231d05 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Wed, 11 Jun 2014 17:02:34 +0200 Subject: - Added test to trigger index id error - re-enable encryption migration tests - sqlite requires reconnect after schema changes --- lib/private/db.php | 10 ++++++++++ lib/private/db/mdb2schemamanager.php | 6 ++++-- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/private/db.php b/lib/private/db.php index 6aaf31a30cd..221a369cad2 100644 --- a/lib/private/db.php +++ b/lib/private/db.php @@ -105,6 +105,16 @@ class OC_DB { return true; } + /** + * The existing database connection is closed and connected again + */ + public static function reconnect() { + if(self::$connection) { + self::$connection->close(); + self::$connection->connect(); + } + } + /** * @return \OC\DB\Connection */ diff --git a/lib/private/db/mdb2schemamanager.php b/lib/private/db/mdb2schemamanager.php index a6d9e30cf80..d3e379c9417 100644 --- a/lib/private/db/mdb2schemamanager.php +++ b/lib/private/db/mdb2schemamanager.php @@ -24,8 +24,6 @@ class MDB2SchemaManager { */ public function __construct($conn) { $this->conn = $conn; - $this->conn->close(); - $this->conn->connect(); } /** @@ -150,6 +148,10 @@ class MDB2SchemaManager { $this->conn->query($sql); } $this->conn->commit(); + + if ($this->conn->getDatabasePlatform() instanceof SqlitePlatform) { + \OC_DB::reconnect(); + } return true; } } -- cgit v1.2.3