return $this->getAttribute(IPF_ORM::ATTR_QUERY_CACHE);
}
- public function lastInsertId($table = null, $field = null)
+ public function lastInsertId()
{
return $this->getDbh()->lastInsertId();
}
$this->conn->insert($table, $fields);
- if (empty($seq) && count($identifier) == 1 && $identifier[0] == $table->getIdentifier() &&
- $table->getIdentifierType() != IPF_ORM::IDENTIFIER_NATURAL) {
- if (strtolower($this->conn->getDriverName()) == 'Pgsql') {
- $seq = $table->getTableName() . '_' . $identifier[0];
- }
-
- $id = $this->conn->lastInsertId($seq);
-
- if ( ! $id) {
+ if (count($identifier) == 1 && $table->getIdentifierType() !== IPF_ORM::IDENTIFIER_NATURAL) {
+ $id = $this->conn->lastInsertId();
+ if (!$id)
throw new IPF_ORM_Exception("Couldn't get last insert identifier.");
- }
+
$record->assignIdentifier($id);
} else {
$record->assignIdentifier(true);