dblayeroo: autoincrement fields must be primary too
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3706 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
@@ -352,7 +352,14 @@ class dblayeroo
|
|||||||
switch ($p)
|
switch ($p)
|
||||||
{
|
{
|
||||||
case "not null": $sql .= " NOT NULL"; break;
|
case "not null": $sql .= " NOT NULL"; break;
|
||||||
case "autoincrement": $sql .= " AUTOINCREMENT";break;
|
case "autoincrement":
|
||||||
|
if ($this->primary !== $field)
|
||||||
|
throw new \Exception (sprintf (
|
||||||
|
dgettext("domframework",
|
||||||
|
"Field '%s' is autoincrement but not primary"),
|
||||||
|
$field), 500);
|
||||||
|
$sql .= " AUTOINCREMENT";
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Exception (sprintf (dgettext("domframework",
|
throw new Exception (sprintf (dgettext("domframework",
|
||||||
"Unknown additionnal parameter '%s' for field '%s'"),
|
"Unknown additionnal parameter '%s' for field '%s'"),
|
||||||
@@ -439,7 +446,14 @@ class dblayeroo
|
|||||||
switch ($p)
|
switch ($p)
|
||||||
{
|
{
|
||||||
case "not null": $sql .= " NOT NULL"; break;
|
case "not null": $sql .= " NOT NULL"; break;
|
||||||
case "autoincrement": $sql .= " AUTO_INCREMENT";break;
|
case "autoincrement":
|
||||||
|
if ($this->primary !== $field)
|
||||||
|
throw new \Exception (sprintf (
|
||||||
|
dgettext("domframework",
|
||||||
|
"Field '%s' is autoincrement but not primary"),
|
||||||
|
$field), 500);
|
||||||
|
$sql .= " AUTO_INCREMENT";
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Exception (sprintf (
|
throw new Exception (sprintf (
|
||||||
dgettext("domframework",
|
dgettext("domframework",
|
||||||
@@ -488,7 +502,14 @@ class dblayeroo
|
|||||||
// Name of field
|
// Name of field
|
||||||
$sql .= "\"$field\" ";
|
$sql .= "\"$field\" ";
|
||||||
if (in_array ("autoincrement", $params))
|
if (in_array ("autoincrement", $params))
|
||||||
|
{
|
||||||
|
if ($this->primary !== $field)
|
||||||
|
throw new \Exception (sprintf (
|
||||||
|
dgettext("domframework",
|
||||||
|
"Field '%s' is autoincrement but not primary"),
|
||||||
|
$field), 500);
|
||||||
$sql .= "SERIAL";
|
$sql .= "SERIAL";
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch ($this->fieldTypeLight ($field))
|
switch ($this->fieldTypeLight ($field))
|
||||||
|
|||||||
Reference in New Issue
Block a user