dblayer : check if the unique key is defined before using it in UPDATE. If not defined, use primary key

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2052 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2015-03-23 11:08:28 +00:00
parent 5f441df4b7
commit 1cfc21e5f0

View File

@@ -378,8 +378,14 @@ class dblayer extends PDO
{
if ($this->debug) echo " verify NO updatekey\n";
$after = $datasOK;
}
// Check if the unique constrain is valid before doing the insertion
if ($this->unique === null && $this->primary !== null)
$this->unique = array ($this->primary);
// TODO : If Unique is not defined nor primary
// FIXME : If unique is defined, could I test if the primary key is defined
// in a parameter of the unique and if it is not add it automatically
foreach ($this->unique as $k=>$columns)
{
if ($this->primary === null)