From 9518419f254b93a5a4cdaea2fc842ae92b1e573c Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Thu, 20 Jul 2017 14:17:15 +0000 Subject: [PATCH] dblayeroo: Update Alias support git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3822 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- dblayeroo.php | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/dblayeroo.php b/dblayeroo.php index e6915b1..8293140 100644 --- a/dblayeroo.php +++ b/dblayeroo.php @@ -2724,12 +2724,16 @@ class dblayeroo $columns = array (); foreach ($this->displayGet (false) as $col) { - $pos = strpos ($col, "("); - if ($pos !== false) - $columns[] = substr ($col, 0, $pos+1). - substr ($col, $pos+2, -2).")"; - else - $columns[] = substr ($col, 1 + strrpos ($col, $this->sep, -2), -1); + $col = str_replace ($this->sep.$this->tableprefix.$this->table. + $this->sep.".", "", $col); + if ($col[0] === $this->sep) + $col = substr ($col, 1); + if (substr ($col, -1) === $this->sep && + strpos ($col, " AS ".$this->sep) === false) + { + $col = substr ($col, 0, -1); + } + $columns[] = $col; } } else @@ -2754,7 +2758,13 @@ class dblayeroo elseif (strtolower ($fieldsAll[$columns[$colNb]][0]) === "integer") $val = intval ($val); - $colName = str_replace ($this->sep, "", $columns[$colNb]); + if (($pos = strpos ($columns[$colNb], " AS ".$this->sep)) !== false) + { + $pos += strlen (" AS ".$this->sep); + $colName = substr ($columns[$colNb], $pos, -1); + } + else + $colName = str_replace ($this->sep, "", $columns[$colNb]); $result[$rownb][$colName] = $val; unset ($result[$rownb][$colNb]); }