From: Nicolas Boisselier Date: Mon, 5 Sep 2016 16:15:47 +0000 (+0100) Subject: db=all X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=0bdc5d50dc1ae3e86edabd840686128ede792ae5;p=nb.git db=all --- diff --git a/etc/dbs.php b/etc/dbs.php index 7e60ac3c..82321a49 100644 --- a/etc/dbs.php +++ b/etc/dbs.php @@ -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 index 49c63ad8..00000000 --- a/etc/dbs/all.php +++ /dev/null @@ -1,62 +0,0 @@ - ':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']); -?>