dblayeroo: PgSQL return the PK valeu added in INSERT if there is no AUTOINCREMENT primary field
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3918 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
@@ -2765,6 +2765,10 @@ class dblayeroo
|
||||
}
|
||||
$this->debugLog ("Entering createRequest ()");
|
||||
$sql = $this->createRequest ();
|
||||
if ($this->driver === "pgsql" && $this->command === "INSERT")
|
||||
{
|
||||
$sql .= " RETURNING ".$this->sep.$this->primary.$this->sep;
|
||||
}
|
||||
$this->debugLog ("Entering prepareRequest (XXX, ",false,")");
|
||||
$st = $this->prepareRequest ($sql, false);
|
||||
$this->debugLog ("'",$this->getDisplayQuery (),"'");
|
||||
@@ -2863,8 +2867,9 @@ class dblayeroo
|
||||
else
|
||||
{
|
||||
$this->debugLog ("INSERT: PgSQL INSERT without Autoincrement. ".
|
||||
"Return 1");
|
||||
return 1;
|
||||
"Return the PK value defined in RETURN part");
|
||||
$result = $st->fetch (PDO::FETCH_ASSOC);
|
||||
return $result[$this->primary];
|
||||
}
|
||||
}
|
||||
$this->debugLog ("INSERT: lastInsertId=",
|
||||
|
||||
Reference in New Issue
Block a user