dblayeroo: manage correctely the PGSQL string_agg (instead of GROUP_CONCAT)
dblayeroo: Manage correctely the Aliases (do not emit Notice in execute) git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3899 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
@@ -1595,7 +1595,7 @@ class dblayeroo
|
||||
elseif ($this->driver === "mysql")
|
||||
$separator = " SEPARATOR '$separator'";
|
||||
}
|
||||
if ($func === "GROUP_CONCAT" && $this->driver === "psql")
|
||||
if ($func === "GROUP_CONCAT" && $this->driver === "pgsql")
|
||||
$func = "string_agg";
|
||||
}
|
||||
}
|
||||
@@ -1655,7 +1655,7 @@ class dblayeroo
|
||||
$pos = strpos ($name, "(");
|
||||
if ($pos !== false)
|
||||
{
|
||||
$func = strtoupper (trim (substr ($name, 0, $pos)));
|
||||
$func = trim (substr ($name, 0, $pos));
|
||||
$name = trim (substr ($name, $pos+1, -1));
|
||||
}
|
||||
$distinct = "";
|
||||
@@ -2778,6 +2778,7 @@ class dblayeroo
|
||||
if ($this->joinObject === null && count ($this->displayGet (false)))
|
||||
{
|
||||
// Remove the table name as there is no collisions risk
|
||||
// In case of Alias, remove the $this->sep too
|
||||
$columns = array ();
|
||||
foreach ($this->displayGet (false) as $col)
|
||||
{
|
||||
@@ -2790,6 +2791,12 @@ class dblayeroo
|
||||
{
|
||||
$col = substr ($col, 0, -1);
|
||||
}
|
||||
if (strpos ($col, " AS ".$this->sep))
|
||||
{
|
||||
// remove the separator before the AS
|
||||
$col = substr ($col, 0, strpos ($col, " AS ".$this->sep) -1).
|
||||
substr ($col, strpos ($col, " AS ".$this->sep));
|
||||
}
|
||||
$columns[] = $col;
|
||||
}
|
||||
}
|
||||
@@ -2812,9 +2819,16 @@ class dblayeroo
|
||||
if (in_array ($func, array ("AVG", "COUNT", "MAX", "MIN", "SUM")))
|
||||
$val = intval ($val);
|
||||
}
|
||||
elseif (strtolower ($fieldsAll[$columns[$colNb]][0]) ===
|
||||
"integer")
|
||||
$val = intval ($val);
|
||||
else
|
||||
{
|
||||
$name = $columns[$colNb];
|
||||
$pos = strpos ($columns[$colNb], " AS ");
|
||||
if ($pos)
|
||||
$name = substr ($columns[$colNb], 0, $pos);
|
||||
if (strtolower ($fieldsAll[$name][0]) ===
|
||||
"integer")
|
||||
$val = intval ($val);
|
||||
}
|
||||
if (($pos = strpos ($columns[$colNb], " AS ".$this->sep)) !== false)
|
||||
{
|
||||
$pos += strlen (" AS ".$this->sep);
|
||||
|
||||
Reference in New Issue
Block a user