/** * The existing database connection is closed and connected again */ public static function reconnect() { if (self::$connection) { self::$connection->close(); self::$connection->connect(); } }
/** * @param \Doctrine\DBAL\Schema\Schema|\Doctrine\DBAL\Schema\SchemaDiff $schema * @return bool */ private function executeSchemaChange($schema) { $this->conn->beginTransaction(); foreach ($schema->toSql($this->conn->getDatabasePlatform()) as $sql) { $this->conn->query($sql); } $this->conn->commit(); if ($this->conn->getDatabasePlatform() instanceof SqlitePlatform) { $this->conn->close(); $this->conn->connect(); } return true; }
/** * @param \OC\DB\Connection $conn */ public function __construct($conn) { $this->conn = $conn; $this->conn->close(); $this->conn->connect(); }