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:
2015-03-13 10:44:24 +00:00
parent d590337cf5
commit 211dbfcefb

View File

@@ -635,6 +635,12 @@ class dblayer extends PDO
$display = array_keys ($this->fields);
}
$foreignSelectCols = array ();
if ($foreignSelect !== null)
{
foreach ($foreignSelect as $s)
$foreignSelectCols[] = $s[0];
}
$req = "SELECT $this->sep";
$req .= implode ("$this->sep,$this->sep", $display);
$req .= "$this->sep ";
@@ -648,6 +654,9 @@ class dblayer extends PDO
// TODO Allow a field=>value in plus of array("field","value")
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 ($whereOr === false)