dblayer : force the autoincrement fields to null in insert to have a value
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1840 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
@@ -208,6 +208,9 @@ class dblayer extends PDO
|
|||||||
if ($updatekey === false)
|
if ($updatekey === false)
|
||||||
{
|
{
|
||||||
// Don't check if there is an update : the database is already filled
|
// Don't check if there is an update : the database is already filled
|
||||||
|
// For autoincrement, in INSERT mode, force the value to null
|
||||||
|
if (in_array ("autoincrement", $params))
|
||||||
|
$datas[$key] = null;
|
||||||
if (in_array ("not null", $params) && !array_key_exists ($key, $datas))
|
if (in_array ("not null", $params) && !array_key_exists ($key, $datas))
|
||||||
{
|
{
|
||||||
$errors[$key] = array ("error", sprintf (dgettext("domframework",
|
$errors[$key] = array ("error", sprintf (dgettext("domframework",
|
||||||
@@ -459,11 +462,6 @@ class dblayer extends PDO
|
|||||||
throw new Exception (dgettext("domframework",
|
throw new Exception (dgettext("domframework",
|
||||||
"The datas provided to create are not array"),
|
"The datas provided to create are not array"),
|
||||||
405);
|
405);
|
||||||
foreach ($this->fields as $key=>$params)
|
|
||||||
{
|
|
||||||
if (in_array ("autoincrement", $params))
|
|
||||||
$datas[$key] = null;
|
|
||||||
}
|
|
||||||
if (!in_array ($this->primary, $this->unique))
|
if (!in_array ($this->primary, $this->unique))
|
||||||
$this->unique[] = $this->primary;
|
$this->unique[] = $this->primary;
|
||||||
$datasOK = array ();
|
$datasOK = array ();
|
||||||
|
|||||||
Reference in New Issue
Block a user