From: Nicolas Boisselier Date: Mon, 21 Nov 2016 12:12:08 +0000 (+0000) Subject: detach sqlite X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=28cf3c383efee96087039d932cdb181aab0b19f6;p=nb.git detach sqlite --- diff --git a/etc/dbq/000-local.php b/etc/dbq/000-local.php new file mode 100644 index 00000000..00c3b453 --- /dev/null +++ b/etc/dbq/000-local.php @@ -0,0 +1,13 @@ + [ + 'type' => 'sqlite', + 'name' => 'shell', + 'default_table' => 'shell_function', + 'host' => nb::ROOT_DIR.'/share/db/shell.db', + ], +]; +?> diff --git a/etc/dbq/shell.php b/etc/dbq/shell.php deleted file mode 100644 index 00c3b453..00000000 --- a/etc/dbq/shell.php +++ /dev/null @@ -1,13 +0,0 @@ - [ - 'type' => 'sqlite', - 'name' => 'shell', - 'default_table' => 'shell_function', - 'host' => nb::ROOT_DIR.'/share/db/shell.db', - ], -]; -?> diff --git a/lib/php/db.php b/lib/php/db.php index 527f2e6b..f30373c9 100644 --- a/lib/php/db.php +++ b/lib/php/db.php @@ -299,7 +299,6 @@ class Db extends nb { public function disconnect() { if (empty($this->conn)) return null; - #$this->conn->exec('COMMIT'); $this->method('disconnect'); # NB 09.09.16 return $this->conn->close(); } diff --git a/lib/php/db/types/sqlite.php b/lib/php/db/types/sqlite.php index 5edb1b94..65c7b6ef 100644 --- a/lib/php/db/types/sqlite.php +++ b/lib/php/db/types/sqlite.php @@ -124,4 +124,7 @@ $DB_TYPES['sqlite'] = array ( #debug($sql); return $sql; }, +'disconnect' => function($Db) { + foreach ($Db->sql_pre() as $s) { if ($s = preg_replace('/^ATTACH DATABASE.*? as (.*?)$/','DETACH DATABASE $1',$s)) $Db->conn->exec($s); } +}, );?>