Beispiel #1
0
 /**
  * The existing database connection is closed and connected again
  */
 public static function reconnect()
 {
     if (self::$connection) {
         self::$connection->close();
         self::$connection->connect();
     }
 }
Beispiel #2
0
 /**
  * @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;
 }
Beispiel #3
0
 /**
  * @param \OC\DB\Connection $conn
  */
 public function __construct($conn)
 {
     $this->conn = $conn;
     $this->conn->close();
     $this->conn->connect();
 }