]> git.nbdom.net Git - nb.git/commitdiff
fix bug with type
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Tue, 30 Aug 2016 11:21:26 +0000 (13:21 +0200)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Tue, 30 Aug 2016 11:21:26 +0000 (13:21 +0200)
etc/dbs.yaml
etc/dbs/nb.php
lib/php/db.php
lib/php/db/table.php

index c7b26110546d1466b23bc7bb9560aa92f086f0a3..55d64148f6e0c375ca4061678cdf117db3c490de 100644 (file)
@@ -42,16 +42,8 @@ izi-dev:
   _import:
     - izi
 
-media:
-  host: ks358898.izideal.vpn
-  name: mysql
-  type: mysql
-  _import:
-    - _nico
-
 postfix:
-  #pdo: 'mysql:host=media.izideal.vpn;port=3306;dbname=postfix'
   title: Postfix on Izideal
-  host: media.izideal.vpn
+  host: mail.izideal.vpn
   user: postfix
   type: mysql
index 733aa334fd628a679e4d7167ff1e47bf0371fe27..c1f06de7358cc20d68d28e7e7f37a0665d4305e1 100644 (file)
@@ -12,6 +12,7 @@ $CONF['nb'] = array(
 
 $CONF['nb-sqlite'] = array (
   'pdo' => 'sqlite:'.nb::untilde('~nico/ownCloud/var/lib/sqlite/nb.db'),
+  'type' => 'sqlite',
   '_import' => '_rent',
 );
 
index 094c45e84bb342a4396f6cf05dfbd301145b0a94..2bf972f24b7a5d84fabaa79e0bfb4c75a6337ef8 100644 (file)
@@ -894,14 +894,18 @@ class Db extends nb {
       $attr['_no_connect'] = true;
       $attr['id'] = $id;
       $d = new Db($attr);
-      if (!empty($name) and !$this->str_match($d->name,$name)) continue;
-      if (!empty($type) and !$this->str_match($d->type,$type)) continue;
+      #debug([$d->id,$d::$type]);
       $db = [];
 
       foreach ($fields as $k) {
-        if (!isset($d->$k)) continue; $db[$k] = $d->$k;
+        #if (isset($d::$k)) $db[$k] = $d::$k;
+        if ($k=='type' and isset($d::$type)) $db[$k] = $d::$type;
+        elseif (isset($d->$k)) $db[$k] = $d->$k;
       }
 
+      if (!empty($name) and !$this->str_match($db['name'],$name)) continue;
+      if (!empty($type) and !$this->str_match($db['type'],$type)) continue;
+
       $dbs[] = $db;
     }
 
index 723654a0fb8cfb1caf849c5b7687c2a799fef31d..79fde1c6e0c072f3aad7788cd9b57ff59191f09d 100644 (file)
@@ -633,7 +633,9 @@ Class Table extends nb {
     #return false;
 
     # Test if type exists because of a bug from shell.php
-    if ($this->db()->type) $this->fields();
+# NB 30.08.16     if ($this->db()->type) $this->fields();
+    #$db = $this->db();
+    #if ($db::$type) $this->fields();
 
     foreach ($extras as $k => $v) {