picodb(mssql): fix implementation of getLastId() on MSSQL
This commit is contained in:
committed by
Frédéric Guillot
parent
37bc859df5
commit
66d55e5be0
@@ -136,7 +136,15 @@ class Mssql extends Base
|
|||||||
*/
|
*/
|
||||||
public function getLastId()
|
public function getLastId()
|
||||||
{
|
{
|
||||||
return $this->pdo->lastInsertId();
|
try {
|
||||||
|
$rq = $this->pdo->prepare('SELECT @@IDENTITY');
|
||||||
|
$rq->execute();
|
||||||
|
|
||||||
|
return $rq->fetchColumn();
|
||||||
|
}
|
||||||
|
catch (PDOException $e) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user