lithium\data\source\database\adapter\MySql::_insertId()
Implements
lithium\data\source\Database::_insertId()
Gets the last auto-generated ID from the query that inserted a new record.
Parameters
-
object
$query
The
Query
object associated with the query which generated
Returns
mixedReturns the last inserted ID key for an auto-increment column or a column bound to a sequence.
Source
protected function _insertId($query) {
$row = $this->_execute('SELECT LAST_INSERT_ID() AS insertID')->current();
return ($row[0] && $row[0] !== '0') ? $row[0] : null;
}