mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Adding fix for Ticket #2363
Removed use of: mysql_insert_id($this->connection); mysqli_insert_id($this->connection); git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4810 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
8b2e2e6a7a
commit
784ee985b5
2 changed files with 9 additions and 16 deletions
|
@ -330,15 +330,11 @@ class DboMysql extends DboSource {
|
|||
* @return in
|
||||
*/
|
||||
function lastInsertId($source = null) {
|
||||
$id = mysql_insert_id($this->connection);
|
||||
if ($id) {
|
||||
return $id;
|
||||
$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'];
|
||||
}
|
||||
|
||||
$data = $this->fetchAll('SELECT LAST_INSERT_ID() as id From '.$source);
|
||||
if ($data && isset($data[0]['id'])) {
|
||||
return $data[0]['id'];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
|
|
|
@ -322,15 +322,12 @@ class DboMysqli extends DboSource {
|
|||
* @return in
|
||||
*/
|
||||
function lastInsertId($source = null) {
|
||||
$id = mysqli_insert_id($this->connection);
|
||||
if ($id) {
|
||||
return $id;
|
||||
$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'];
|
||||
}
|
||||
|
||||
$data = $this->fetchAll('SELECT LAST_INSERT_ID() as id From '.$source);
|
||||
if ($data && isset($data[0]['id'])) {
|
||||
return $data[0]['id'];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* Converts database-layer column types to basic types
|
||||
|
|
Loading…
Add table
Reference in a new issue