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) {
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;
}
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]);
}
# NB 08.12.16 $this->out($e);
# NB 08.12.16 return true;
+ } else {
+ $this->not_implemented();
+
}
return false;