diff --git a/dblayer.php b/dblayer.php index 74279aa..f7f9073 100644 --- a/dblayer.php +++ b/dblayer.php @@ -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)