From eea451b1313bb502bc502b087896b8561842b9f4 Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Tue, 25 Jul 2017 08:57:29 +0000 Subject: [PATCH] dblayeroo : do not add the not needed GROUP BY git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3826 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- dblayeroo.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dblayeroo.php b/dblayeroo.php index c0b13ef..441bd64 100644 --- a/dblayeroo.php +++ b/dblayeroo.php @@ -1574,7 +1574,7 @@ class dblayeroo $aggregateFunction = true; // Aggregate function. Add the non aggregate fields to the GROUP BY // expression, if not already done - if ($this->groupByExpression === array ()) + if ($this->groupByExpression === null) { $this->groupByExpression = $this->displayColumn; } @@ -1609,7 +1609,7 @@ class dblayeroo else $this->displayColumn[$getSortOrder] = "$func($distinct$this->sep$fieldName$this->sep$separator)"; - if ($this->groupByExpression !== array () && ! isset ($aggregateFunction)) + if ($this->groupByExpression !== null && ! isset ($aggregateFunction)) { // Not a aggregate function, but groupBy is set : add the new field name $this->groupByExpression[$getSortOrder] = @@ -2539,7 +2539,7 @@ class dblayeroo if (! in_array ($this->primary, $uniques)) $uniques = array_merge (array ($this->primary), $uniques); $setValues = $values; - $foundImpactedColumns = 0; + $foundImpactedLines = 0; foreach ($uniques as $k=>$columns) { if ($update) @@ -2553,7 +2553,7 @@ class dblayeroo // One column to set is a unique column : check if the where clause // is filtering more than one entry. If there is more than one // entry, generate an exception - $this->debugLog ("CLONE because of update"); + $this->debugLog ("CLONE because of checking update unique fields"); $objTmp = clone $this; $objTmp->debugDepth++; $objTmp->clearRequest (); @@ -2570,9 +2570,9 @@ class dblayeroo "Can't update multiple rows with unique value on col '%s'"), $col)); elseif (count ($resUpdate) === 1) - $foundImpactedColumns++; + $foundImpactedLines++; } - if ($foundImpactedColumns === 0) + if ($foundImpactedLines === 0) { // There is no row available with the WHERE clause provided // Skip all the UNIQUE tests as there will not have any modification