]> git.nbdom.net Git - nb.git/commitdiff
dbq
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Fri, 9 Dec 2016 16:31:43 +0000 (16:31 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Fri, 9 Dec 2016 16:31:43 +0000 (16:31 +0000)
lib/php/db.php
www/dbq/dbq.php

index c0c40ac7a762e57cfb44e453071e4c2219ce0f8f..75ef755324f026545cb585b34fce43571104cad6 100644 (file)
@@ -389,6 +389,7 @@ class Db extends nb {
     if (!$name) bye('table name is empty');
 
     if (empty($params) or empty($params['db'])) $params['db'] = $this;
+
     if (empty($this->tables[$name])) {
       $this->tables[$name] = new Table($name,$params);
     } elseif ($params) {
index 1cecac58d0892f634a7caffc1ce984cf7212fca6..2dc7aeee2e886b2d3f2fa191d4c71da06297366f 100644 (file)
@@ -126,7 +126,13 @@ if (empty($this->_nopage)) {
 
     if (!empty($connect)) {
       if (!isset($this->db)) $this->db = $this->db();
-      if (!is_array($connect) and $connect === true) $connect = $this->db->conf[$this->params['db']];
+
+      if (!is_array($connect) and $connect === true and isset($this->db->conf[$this->params['db']]))
+        $connect = $this->db->conf[$this->params['db']]
+      ;
+
+      if (empty($connect['name'])) $this->not_implemented();
+
       $this->db->__construct($connect);
       $this->db->connect();
       return $this->db;
@@ -140,6 +146,7 @@ if (empty($this->_nopage)) {
   }
 
   public function table() {
+    if (!in_array($this->params['table'],array_keys($this->db->tables()))) $this->not_implemented();
     $this->table = $this->db->table($this->params['table'],['db'=>$this->db]);
   }
 
@@ -321,6 +328,9 @@ if (empty($this->_nopage)) {
 # NB 08.12.16       $this->out($e);
 # NB 08.12.16       return true;
 
+    } else {
+      $this->not_implemented();
+
     }
 
     return false;