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() { function __construct() {
parent::__construct(":memory:"); parent::__construct(":memory:");
$this->query("PRAGMA foreign_keys = 1");
} }
function select_db($filename) { 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 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); parent::__construct($filename);
$this->query("PRAGMA foreign_keys = 1");
return true; return true;
} }
return false; return false;

View file

@ -1,6 +1,7 @@
Adminer 4.4.1-dev: Adminer 4.4.1-dev:
Adminer: Fix Search data in tables (regression from 4.4.0) Adminer: Fix Search data in tables (regression from 4.4.0)
CSP: Allow any images, media and fonts, disallow base-uri CSP: Allow any images, media and fonts, disallow base-uri
SQLite: Enable foreign key checks
Adminer 4.4.0 (released 2018-01-17): Adminer 4.4.0 (released 2018-01-17):
Add Content Security Policy Add Content Security Policy