From: Nicolas Boisselier Date: Mon, 17 Oct 2016 13:30:44 +0000 (+0100) Subject: fix bug in select_extras X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=6fa955bd1253fea188f4a2f95e8437d8d4b019a9;p=nb.git fix bug in select_extras --- diff --git a/lib/php/db/table.php b/lib/php/db/table.php index ed5b32ba..6e4663ee 100644 --- a/lib/php/db/table.php +++ b/lib/php/db/table.php @@ -37,7 +37,7 @@ Class Table extends nb { , 'page', 'paged' # wordpress ]; - public $fields; + public $fields = []; public $indexes; function __construct($name,$opt=[]) { @@ -266,9 +266,9 @@ Class Table extends nb { $this->create_temporary(); - if (!isset($this->fields)) { + if (!isset($this->_fields)) { + $this->_fields = true; - $this->fields = array(); $conf = $this->unvar($this->db()->conf_type('table.fields',true)); if (is_scalar($conf)) $conf = array('sql'=>$conf); $rows = $this->db()->conn->query($conf['sql']); @@ -665,6 +665,7 @@ Class Table extends nb { $select[] = $field->extras." AS ".$field->sql_name(); } + if (!$select) return ''; return ','.join(',',$select); }