From 6fa955bd1253fea188f4a2f95e8437d8d4b019a9 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Mon, 17 Oct 2016 14:30:44 +0100 Subject: [PATCH] fix bug in select_extras --- lib/php/db/table.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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); } -- 2.47.3