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:
34
dblayer.php
34
dblayer.php
@@ -437,21 +437,31 @@ class dblayer extends PDO
|
||||
// Check if the foreign keys constrains are valid before doing the insertion
|
||||
foreach ($this->foreign as $foreign=>$data)
|
||||
{
|
||||
if ($this->debug) echo " verify foreign $foreign\n";
|
||||
if (! isset ($datas[$foreign]))
|
||||
if ($updatekey === false)
|
||||
{
|
||||
$errors[] = array ("error", sprintf (dgettext("domframework",
|
||||
"The foreign column '%s' is not provided"),
|
||||
$foreign));
|
||||
return $errors;
|
||||
// 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 (! isset ($datas[$foreign]))
|
||||
{
|
||||
$errors[] = array ("error", sprintf (dgettext("domframework",
|
||||
"The foreign column '%s' is not provided"),
|
||||
$foreign));
|
||||
return $errors;
|
||||
}
|
||||
if (! isset ($datas[$foreign][0]))
|
||||
{
|
||||
$errors[] = array ("error", sprintf (dgettext("domframework",
|
||||
"The field type for column '%s' is not provided"),
|
||||
$foreign));
|
||||
return $errors;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (! isset ($datas[$foreign][0]))
|
||||
else
|
||||
{
|
||||
$errors[] = array ("error", sprintf (dgettext("domframework",
|
||||
"The field type for column '%s' is not provided"),
|
||||
$foreign));
|
||||
return $errors;
|
||||
continue;
|
||||
if (! array_key_exists ($foreign, $data))
|
||||
continue;
|
||||
}
|
||||
$table = $data[0];
|
||||
$column = $data[1];
|
||||
|
||||
Reference in New Issue
Block a user