Skip to content

Commit

Permalink
Implementing lastInsertId for postgres
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Oct 18, 2010
1 parent 5c87daf commit ab9c890
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions cake/libs/model/datasources/dbo/dbo_postgres.php
Expand Up @@ -294,8 +294,7 @@ function lastNumRows() {
*/
function lastInsertId($source, $field = 'id') {
$seq = $this->getSequence($source, $field);
$data = $this->fetchRow("SELECT currval('{$seq}') as max");
return $data[0]['max'];
return $this->_connection->lastInsertId($seq);
}

/**
Expand Down

0 comments on commit ab9c890

Please sign in to comment.