dblayer : don't allow the foreign keys to be in the select : conflict
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2022 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
@@ -635,6 +635,12 @@ class dblayer extends PDO
|
|||||||
$display = array_keys ($this->fields);
|
$display = array_keys ($this->fields);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$foreignSelectCols = array ();
|
||||||
|
if ($foreignSelect !== null)
|
||||||
|
{
|
||||||
|
foreach ($foreignSelect as $s)
|
||||||
|
$foreignSelectCols[] = $s[0];
|
||||||
|
}
|
||||||
$req = "SELECT $this->sep";
|
$req = "SELECT $this->sep";
|
||||||
$req .= implode ("$this->sep,$this->sep", $display);
|
$req .= implode ("$this->sep,$this->sep", $display);
|
||||||
$req .= "$this->sep ";
|
$req .= "$this->sep ";
|
||||||
@@ -648,6 +654,9 @@ class dblayer extends PDO
|
|||||||
// TODO Allow a field=>value in plus of array("field","value")
|
// TODO Allow a field=>value in plus of array("field","value")
|
||||||
foreach ($select as $n=>$s)
|
foreach ($select as $n=>$s)
|
||||||
{
|
{
|
||||||
|
// The foreign keys can not be in the select too (conflict)
|
||||||
|
if (in_array ($s[0],$foreignSelectCols))
|
||||||
|
continue;
|
||||||
if ($n > 0)
|
if ($n > 0)
|
||||||
{
|
{
|
||||||
if ($whereOr === false)
|
if ($whereOr === false)
|
||||||
|
|||||||
Reference in New Issue
Block a user