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