public function load($sql) { $this->dbh->exec('PRAGMA writable_schema = 1;'); $this->dbh->exec('PRAGMA ignore_check_constraints = 1;'); parent::load($sql); $this->dbh->exec('PRAGMA ignore_check_constraints = 0;'); $this->dbh->exec('PRAGMA writable_schema = 0;'); }
public function load($sql) { if ($this->hasSnapshot) { $this->dbh = null; file_put_contents($this->filename, file_get_contents($this->filename . '_snapshot')); $this->dbh = new \PDO($this->dsn, $this->user, $this->password); } else { if (file_exists($this->filename . '_snapshot')) { unlink($this->filename . '_snapshot'); } parent::load($sql); copy($this->filename, $this->filename . '_snapshot'); $this->hasSnapshot = true; } }
protected function loadDump() { if (!$this->sql) { return; } try { $this->driver->load($this->sql); } catch (\PDOException $e) { throw new ModuleException(__CLASS__, $e->getMessage() . "\nSQL query being executed: " . $this->driver->sqlToRun); } }