dblayeroo: allow the primary key to be the unique key (and the unique is not defined)

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3564 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2017-05-03 08:02:06 +00:00
parent 790fe6b703
commit 0df7e1bded

View File

@@ -2184,10 +2184,11 @@ class dblayeroo
// - Check the unique entries (if defined) // - Check the unique entries (if defined)
// The primary key is always unique : add it if not set by the user // The primary key is always unique : add it if not set by the user
$this->debugLog (" verify the unique constraint"); $this->debugLog (" verify the unique constraint");
if (! in_array ($this->primary, $this->unique)) $uniques = $this->unique;
$uniques = array_merge (array ($this->primary), $this->unique); if (! is_array ($uniques))
else $uniques = array ();
$uniques = $this->unique; if (! in_array ($this->primary, $uniques))
$uniques = array_merge (array ($this->primary), $uniques);
$setValues = $values; $setValues = $values;
if (! array_key_exists ($this->primary, $setValues)) if (! array_key_exists ($this->primary, $setValues))
$setValues[$this->primary] = null; $setValues[$this->primary] = null;