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
|
// 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 ($this->debug) echo " verify foreign $foreign\n";
|
if ($updatekey === false)
|
||||||
if (! isset ($datas[$foreign]))
|
|
||||||
{
|
{
|
||||||
$errors[] = array ("error", sprintf (dgettext("domframework",
|
// Before doing the insert, check the foreign keys. In update, they are
|
||||||
"The foreign column '%s' is not provided"),
|
// not mandatory and are not checked for existancy.
|
||||||
$foreign));
|
if ($this->debug) echo " verify foreign $foreign\n";
|
||||||
return $errors;
|
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",
|
if (! array_key_exists ($foreign, $data))
|
||||||
"The field type for column '%s' is not provided"),
|
continue;
|
||||||
$foreign));
|
|
||||||
return $errors;
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
$table = $data[0];
|
$table = $data[0];
|
||||||
$column = $data[1];
|
$column = $data[1];
|
||||||
|
|||||||
Reference in New Issue
Block a user