From 0172aad420df300a949f4e8b54a92b5afba1ed02 Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Tue, 4 Apr 2017 17:31:05 +0000 Subject: [PATCH] dblayeroo : valid the select without the table name. Regression introduced last commit git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3496 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- dblayeroo.php | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/dblayeroo.php b/dblayeroo.php index b3860c2..7b1cf8e 100644 --- a/dblayeroo.php +++ b/dblayeroo.php @@ -1599,7 +1599,9 @@ class dblayeroo if (isset ($this->fieldsTmp)) $displayColumns = implode (",", array_keys ($this->fieldsTmp)); else - $displayColumns = "*"; + $displayColumns = $this->sep. + implode ($this->sep.",".$this->sep, array_keys ($this->fields)). + $this->sep; } $sql .= " $displayColumns FROM $this->sep$this->tableprefix". "$this->table$this->sep"; @@ -1957,7 +1959,7 @@ class dblayeroo // overwrite with the same value) // If it is not the same, produce an error $objTmp->whereAdd ($this->primary, "!=", - $resUpdate[0][$this->primary]); + $resUpdate[0][$this->table.".".$this->primary]); } if (count ($errors) == 0 && count ($objTmp->execute ())) $this->DBException (dgettext ("domframework", @@ -2043,6 +2045,8 @@ class dblayeroo // the filled value) if (isset ($this->fieldsTmp)) $columns = array_keys ($this->fieldsTmp); + elseif (count ($this->displayColumn)) + $columns = $this->displayColumn; else $columns = array_keys ($this->fields); foreach ($result as $rownb=>$row) @@ -2056,9 +2060,17 @@ class dblayeroo "integer") $val = intval ($val); } - elseif (isset ($this->fields)) + elseif (count ($this->displayColumn)) { - if (strtolower ($this->fields[$columns[$colNb]][0]) === "integer") + $fieldWithoutTable = substr ($columns[$colNb], + strlen ($this->sep.$this->table.$this->sep.".".$this->sep), -1); + if (strtolower ($this->fields[$fieldWithoutTable][0]) === "integer") + $val = intval ($val); + } + else + { + if (strtolower ($this->fields[$columns[$colNb]][0]) === + "integer") $val = intval ($val); } $colName = str_replace ($this->sep, "", $columns[$colNb]);