]> git.nbdom.net Git - nb.git/commitdiff
detach sqlite
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 21 Nov 2016 12:12:08 +0000 (12:12 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 21 Nov 2016 12:12:08 +0000 (12:12 +0000)
etc/dbq/000-local.php [new file with mode: 0644]
etc/dbq/shell.php [deleted file]
lib/php/db.php
lib/php/db/types/sqlite.php

diff --git a/etc/dbq/000-local.php b/etc/dbq/000-local.php
new file mode 100644 (file)
index 0000000..00c3b45
--- /dev/null
@@ -0,0 +1,13 @@
+<?php
+#
+# !!! MANDATORY !!!
+#
+if (true or !nb::is_vm()) $DBQ = [
+  'shell' => [
+    '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 (file)
index 00c3b45..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-#
-# !!! MANDATORY !!!
-#
-if (true or !nb::is_vm()) $DBQ = [
-  'shell' => [
-    'type' => 'sqlite',
-    'name' => 'shell',
-    'default_table' => 'shell_function',
-    'host' => nb::ROOT_DIR.'/share/db/shell.db',
-  ],
-];
-?>
index 527f2e6bcc72b3d22c4f2bd4143c9db9a25776d0..f30373c9b0a269b819652b4ca5c1f31d8b435a9e 100644 (file)
@@ -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();
   }
index 5edb1b943d9556900f8ef5de9245d6875919f87d..65c7b6efac7ea036c2e7ba51940fdbbfe64a37be 100644 (file)
@@ -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); }
+},
 );?>