dblayeroo: manage correctely the GROUP BY when there is join objects
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3828 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
@@ -1557,8 +1557,6 @@ class dblayeroo
|
|||||||
if (count ($aliasNames) && count ($aliasNames) !== count ($columnNames))
|
if (count ($aliasNames) && count ($aliasNames) !== count ($columnNames))
|
||||||
$this->DBException (
|
$this->DBException (
|
||||||
"The number of aliasNames are not the same as the number of columns");
|
"The number of aliasNames are not the same as the number of columns");
|
||||||
if ($this->displayColumn === null)
|
|
||||||
$this->displayColumn = array ();
|
|
||||||
foreach ($columnNames as $nb => $display)
|
foreach ($columnNames as $nb => $display)
|
||||||
{
|
{
|
||||||
$display = $name = trim ($display);
|
$display = $name = trim ($display);
|
||||||
@@ -1576,7 +1574,10 @@ class dblayeroo
|
|||||||
// expression, if not already done
|
// expression, if not already done
|
||||||
if ($this->groupByExpression === null)
|
if ($this->groupByExpression === null)
|
||||||
{
|
{
|
||||||
$this->groupByExpression = $this->displayColumn;
|
if ($this->displayColumn === null)
|
||||||
|
$this->groupByExpression = array_keys ($this->fields);
|
||||||
|
else
|
||||||
|
$this->groupByExpression = $this->displayColumn;
|
||||||
}
|
}
|
||||||
if ($func === "GROUP_CONCAT" && ($pos = strpos ($name, ",'")))
|
if ($func === "GROUP_CONCAT" && ($pos = strpos ($name, ",'")))
|
||||||
{
|
{
|
||||||
@@ -2101,15 +2102,16 @@ class dblayeroo
|
|||||||
$groupBy = array ();
|
$groupBy = array ();
|
||||||
if ($this->joinObject)
|
if ($this->joinObject)
|
||||||
$full = true;
|
$full = true;
|
||||||
if ($this->groupByExpression === null)
|
if (is_array ($this->groupByExpression))
|
||||||
return null;
|
|
||||||
foreach ($this->groupByExpression as $pos=>$o)
|
|
||||||
{
|
{
|
||||||
if ($full !== false)
|
foreach ($this->groupByExpression as $pos=>$o)
|
||||||
$groupBy[$pos] = $this->sep.$this->tableprefix.$this->table.$this->sep.
|
{
|
||||||
".".$o;
|
if ($full !== false)
|
||||||
else
|
$groupBy[$pos] = $this->sep.$this->tableprefix.$this->table.$this->sep
|
||||||
$groupBy[$pos] = $o;
|
.".".$o;
|
||||||
|
else
|
||||||
|
$groupBy[$pos] = $o;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ($this->joinObject)
|
if ($this->joinObject)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user