dblayer : foreign keys are not mandatory in update (in verify)
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1844 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
10
dblayer.php
10
dblayer.php
@@ -437,6 +437,10 @@ class dblayer extends PDO
|
|||||||
// Check if the foreign keys constrains are valid before doing the insertion
|
// Check if the foreign keys constrains are valid before doing the insertion
|
||||||
foreach ($this->foreign as $foreign=>$data)
|
foreach ($this->foreign as $foreign=>$data)
|
||||||
{
|
{
|
||||||
|
if ($updatekey === false)
|
||||||
|
{
|
||||||
|
// Before doing the insert, check the foreign keys. In update, they are
|
||||||
|
// not mandatory and are not checked for existancy.
|
||||||
if ($this->debug) echo " verify foreign $foreign\n";
|
if ($this->debug) echo " verify foreign $foreign\n";
|
||||||
if (! isset ($datas[$foreign]))
|
if (! isset ($datas[$foreign]))
|
||||||
{
|
{
|
||||||
@@ -453,6 +457,12 @@ class dblayer extends PDO
|
|||||||
return $errors;
|
return $errors;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (! array_key_exists ($foreign, $data))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$table = $data[0];
|
$table = $data[0];
|
||||||
$column = $data[1];
|
$column = $data[1];
|
||||||
$req = "SELECT $this->sep$column$this->sep ".
|
$req = "SELECT $this->sep$column$this->sep ".
|
||||||
|
|||||||
Reference in New Issue
Block a user