diff --git a/www/libs/Class.DB.IO.inc b/www/libs/Class.DB.IO.inc
index 4833e09a..b7383048 100644
--- a/www/libs/Class.DB.IO.inc
+++ b/www/libs/Class.DB.IO.inc
@@ -663,12 +663,12 @@
}
$this->pk_name = $this->pk_name_table[$table] ? $this->pk_name_table[$table] : 'NULL';
}
- if (!preg_match("/ returning /i", $this->query) && $this->pk_name)
+ if (!preg_match("/ returning /i", $this->query) && $this->pk_name && $this->pk_name != 'NULL')
{
$this->query .= " RETURNING ".$this->pk_name;
$this->returning_id = true;
}
- elseif (preg_match("/ returning (.*)/i", $this->query, $matches) && $this->pk_name)
+ elseif (preg_match("/ returning (.*)/i", $this->query, $matches) && $this->pk_name && $this->pk_name != 'NULL')
{
// add the primary key if it is not in the returning set
if (!preg_match("/$this->pk_name/", $matches[1]))
@@ -763,7 +763,7 @@
$this->insert_id[] = $_insert_id;
}
// if we have only one, revert from array to single
- if (count($this->insert_id) == 1)
+ if (count($this->insert_id) >= 1)
{
// echo "* SINGLE DATA CONVERT: ".count($this->insert_id[0])." => ".array_key_exists($this->pk_name, $this->insert_id[0])."
";
// echo "* PK DIRECT: ".$this->insert_id[0][$this->pk_name]."
";