]> git.nbdom.net Git - nb.git/commitdiff
db=all
authorNicolas Boisselier <nicolas.boisselier@semantico.com>
Mon, 5 Sep 2016 16:15:47 +0000 (17:15 +0100)
committerNicolas Boisselier <nicolas.boisselier@semantico.com>
Mon, 5 Sep 2016 16:15:47 +0000 (17:15 +0100)
etc/dbs.php
etc/dbs/all.php [deleted file]

index 7e60ac3c843d9b4b6247a9242ac12607222ac26f..82321a49bdb409af93566d0c2b93cdc81c54d0d5 100644 (file)
@@ -38,9 +38,15 @@ $CONF['all'] = [
   'options' => [
     PDO::ATTR_PERSISTENT => true,
   ],
+  'tables' => [],
+  'types' => [
+    'exec' => [
+      'PRAGMA busy_timeout = 1000',
+      'PRAGMA synchronous=NORMAL',
+      'PRAGMA journal_mode=MEMORY',
+    ],
+  ],
 ];
-$CONF['all']['tables'] = [];
-$CONF['all']['types']['exec'] = [];
 foreach ($CONF as $id => $db) {
   if (0
     or empty($db['type'] )
diff --git a/etc/dbs/all.php b/etc/dbs/all.php
deleted file mode 100644 (file)
index 49c63ad..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-<?php
-return;
-###############################################################################
-#
-# - NB 03.09.16
-# Create a big sqlite memory database with attach
-#
-###############################################################################
-require_once dirname(__FILE__).'/../../lib/php/config.php';
-require_once dirname(__FILE__).'/../dbs.php';
-
-$CONF['all'] = array(
-  'host' => ':memory:',
-  'type' => 'sqlite',
-  #'order' => '0',
-  'options' => [
-    PDO::ATTR_PERSISTENT => true,
-  ],
-  'types' => [
-    'exec' => [
-      'PRAGMA synchronous=NORMAL',
-      'PRAGMA journal_mode=MEMORY',
-    ]
-  ],
-);
-$attach = [];
-foreach ([
-  '/opt/www/sem_ui/var/db/semantico.db',
-  '/dev/shm/crypt.db',
-] as $file) {
-  if (file_exists($file)) $attach[] = $file;
-}
-
-foreach (nb::ls_dir($DIR_SQLITE,'\.db$') as $file) {
-  $attach[] = "$DIR_SQLITE/$file";
-}
-
-# nb last to win the merge
-usort($attach,function($a,$b){
-  if ( strpos($a,'/nb.db') !== false ) return 1;
-  if ( strpos($b,'/nb.db') !== false ) return -1;
-  return strcmp($a,$b);
-  return 0;
-});
-if (!$attach) return;
-
-$CONF['all']['_import'] = [];
-if (nb::p('debug')=='all') debug($attach);
-
-foreach ($attach as $file) {
-  if (!is_readable($file)) continue;
-
-  $name = basename($file,'.db');
-  $CONF['all']['types']['exec'][] = "ATTACH DATABASE '$file' as $name";
-  #$CONF['all']['_import'][] = $name;
-}
-$CONF['all']['_import'][] = 'rent';
-#bye($CONF['all']['default_table']);
-
-#$CONF['all']['default_table'] = 'rent';
-#debug($CONF['all']);
-?>