BUG : dblayer : don't raise an exception when re-inserting unique record

dblayer : add more unit tests


git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1850 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2014-09-24 09:13:18 +00:00
parent f05a5c0cda
commit b80f9ecdea
2 changed files with 56 additions and 2 deletions

View File

@@ -398,7 +398,7 @@ class dblayer extends PDO
}
// If there is only the primary key, there is no chance to have a
// conflict
if ($updatekey !== false && count ($select) >= 2)
if ($updatekey === false && count ($select) >= 2)
{
$rc = $this->read ($select, array ($this->primary));
if (count ($rc) > 0)
@@ -580,7 +580,15 @@ class dblayer extends PDO
throw new Exception ("TO BE DEVELOPPED : ".$this->fields[$key][0], 500);
}
$st->execute ();
try
{
$st->execute ();
}
catch (Exception $e)
{
echo "dblayer execute exception : ".$e->getMessage()."\n";
exit;
}
return $this->db->lastInsertId();
}