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