dblayeroo : update for GROUP BY

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3634 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2017-05-10 13:39:21 +00:00
parent 6461fbd63c
commit d294809cba

View File

@@ -1268,7 +1268,7 @@ class dblayeroo
private $whereValues = array ();
/** The columns in GROUP BY condition
*/
private $groupByExpression = array ();
private $groupByExpression = null;
/** The ORDER expression
*/
private $orderExpression = array ();
@@ -1930,6 +1930,8 @@ class dblayeroo
$groupBy = array ();
if ($this->joinObject)
$full = true;
if ($this->groupByExpression === null)
return null;
foreach ($this->groupByExpression as $pos=>$o)
{
if ($full !== false)
@@ -1941,7 +1943,11 @@ class dblayeroo
if ($this->joinObject)
{
foreach ($this->joinObject as $obj)
$groupBy = array_merge ($groupBy, $obj->groupByGet (true));
{
$ext = $obj->groupByGet (true);
if ($ext !== null)
$groupBy = array_merge ($groupBy, $obj->groupByGet (true));
}
}
ksort ($groupBy, SORT_NATURAL);
return $groupBy;
@@ -2064,7 +2070,7 @@ class dblayeroo
$sql .= "\n WHERE ". implode (" ", $whereGetExpression);
$groupByExpression = $this->groupByGet ();
if (! empty ($groupByExpression))
$sql .= "\n GROUP BY ". implode (" ", $groupByExpression);
$sql .= "\n GROUP BY ". implode (",", $groupByExpression);
if (count ($order))
$sql .= "\n ORDER BY ". implode (",", $order);
if (! empty ($this->limitExpression))