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:
@@ -378,8 +378,14 @@ class dblayer extends PDO
|
|||||||
{
|
{
|
||||||
if ($this->debug) echo " verify NO updatekey\n";
|
if ($this->debug) echo " verify NO updatekey\n";
|
||||||
$after = $datasOK;
|
$after = $datasOK;
|
||||||
|
|
||||||
}
|
}
|
||||||
// Check if the unique constrain is valid before doing the insertion
|
// 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)
|
foreach ($this->unique as $k=>$columns)
|
||||||
{
|
{
|
||||||
if ($this->primary === null)
|
if ($this->primary === null)
|
||||||
|
|||||||
Reference in New Issue
Block a user