mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-02-07 12:36:25 +00:00
Adding enhancement suggestion from #1565 to all Dbo classes
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5166 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
4e92b97468
commit
232b109bef
5 changed files with 21 additions and 21 deletions
|
@ -413,7 +413,7 @@ class DboDb2 extends DboSource {
|
|||
* @return in
|
||||
*/
|
||||
function lastInsertId($source = null) {
|
||||
$data = $this->fetchAll(sprintf('SELECT SYSIBM.IDENTITY_VAL_LOCAL() AS ID FROM %s FETCH FIRST ROW ONLY', $source));
|
||||
$data = $this->fetchRow(sprintf('SELECT SYSIBM.IDENTITY_VAL_LOCAL() AS ID FROM %s FETCH FIRST ROW ONLY', $source));
|
||||
|
||||
if ($data && isset($data[0]['id'])) {
|
||||
return $data[0]['id'];
|
||||
|
|
|
@ -391,8 +391,8 @@ class DboMssql extends DboSource {
|
|||
* @return in
|
||||
*/
|
||||
function lastInsertId($source = null) {
|
||||
$id = $this->fetchAll('SELECT SCOPE_IDENTITY() AS insertID', false);
|
||||
return $id[0][0]['insertID'];
|
||||
$id = $this->fetchRow('SELECT SCOPE_IDENTITY() AS insertID', false);
|
||||
return $id[0]['insertID'];
|
||||
}
|
||||
/**
|
||||
* Returns a limit statement in the correct format for the particular database.
|
||||
|
|
|
@ -318,9 +318,9 @@ class DboMysql extends DboSource {
|
|||
* @return in
|
||||
*/
|
||||
function lastInsertId($source = null) {
|
||||
$id = $this->fetchAll('SELECT LAST_INSERT_ID() AS insertID', false);
|
||||
if ($id !== false && !empty($id) && !empty($id[0]) && isset($id[0][0]['insertID'])) {
|
||||
return $id[0][0]['insertID'];
|
||||
$id = $this->fetchRow('SELECT LAST_INSERT_ID() AS insertID', false);
|
||||
if ($id !== false && !empty($id) && !empty($id[0]) && isset($id[0]['insertID'])) {
|
||||
return $id[0]['insertID'];
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -307,9 +307,9 @@ class DboMysqli extends DboSource {
|
|||
* @return in
|
||||
*/
|
||||
function lastInsertId($source = null) {
|
||||
$id = $this->fetchAll('SELECT LAST_INSERT_ID() AS insertID', false);
|
||||
if ($id !== false && !empty($id) && !empty($id[0]) && isset($id[0][0]['insertID'])) {
|
||||
return $id[0][0]['insertID'];
|
||||
$id = $this->fetchRow('SELECT LAST_INSERT_ID() AS insertID', false);
|
||||
if ($id !== false && !empty($id) && !empty($id[0]) && isset($id[0]['insertID'])) {
|
||||
return $id[0]['insertID'];
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -367,7 +367,7 @@ class DboOdbc extends DboSource{
|
|||
* @return int
|
||||
*/
|
||||
function lastInsertId($source = null) {
|
||||
$result=$this->fetchAll('SELECT @@IDENTITY');
|
||||
$result=$this->fetchRow('SELECT @@IDENTITY');
|
||||
return $result[0];
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue