enableExceptions(true); } protected $conn; function __construct($filename="", ?int $flags=null, ?string $encryptionKey=null) { if (is_array($filename)) { if ($flags === null) $flags = A::get($filename, "flags"); if ($encryptionKey === null) $encryptionKey = A::get($filename, "encryption_key"); $filename = $filename["name"]; } $this->beforeInit($flags, $encryptionKey); $this->filename = $filename; $this->flags = $flags; $this->encryptionKey = $encryptionKey; try { $conn = new SQLite3($filename, $flags, $encryptionKey); } catch (Exception $e) { throw new QueryException("unable to open database '$filename'", $e); } $this->afterInit($conn); $this->conn = $conn; } function __destruct() { $this->close(); } function getInfos(): array { return [$this->filename, $this->flags, $this->encryptionKey]; } function beginTransaction(): void { } function commit(): void { } function rollback(): void { } function close(): void { if ($this->conn !== null) { $this->conn->close(); $this->conn = null; } } }