1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-12 17:44:07 +02:00

SQLite: Enable foreign key checks

This commit is contained in:
Jakub Vrana
2018-01-19 14:57:58 +01:00
parent 329b7de9cc
commit 34b03ef835
2 changed files with 3 additions and 0 deletions

View File

@@ -184,11 +184,13 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
function __construct() {
parent::__construct(":memory:");
$this->query("PRAGMA foreign_keys = 1");
}
function select_db($filename) {
if (is_readable($filename) && $this->query("ATTACH " . $this->quote(preg_match("~(^[/\\\\]|:)~", $filename) ? $filename : dirname($_SERVER["SCRIPT_FILENAME"]) . "/$filename") . " AS a")) { // is_readable - SQLite 3
parent::__construct($filename);
$this->query("PRAGMA foreign_keys = 1");
return true;
}
return false;