public function lastInsertID($m = null)
    {
        if ($m instanceof \atk4\data\Model) {
            // if we use sequence, then we can easily get current value
            if (isset($m->sequence)) {
                return $this->dsql()->mode('seq_currval')->sequence($m->sequence)->getOne();
            }

            // otherwise we have to select max(id_field) - this can be bad for performance !!!
            // Imants: Disabled for now because otherwise this will work even if database use triggers or
            // any other mechanism to automatically increment ID and we can't tell this line to not execute.
            //return $this->expr('SELECT max([field]) FROM [table]', ['field'=>$m->id_field, 'table'=>$m->table])->getOne();
        }

        // fallback
        return parent::lastInsertID($m);
    }
public function lastInsertID($m = null)
    {
        if ($m instanceof \atk4\data\Model) {
            // if we use sequence, then we can easily get current value
            if (isset($m->sequence)) {
                return $this->dsql()->mode('seq_currval')->sequence($m->sequence)->getOne();
            }

            // otherwise we have to select max(id_field) - this can be bad for performance !!!
            // Imants: Disabled for now because otherwise this will work even if database use triggers or
            // any other mechanism to automatically increment ID and we can't tell this line to not execute.
            //return $this->expr('SELECT max([field]) FROM [table]', ['field'=>$m->id_field, 'table'=>$m->table])->getOne();
        }

        // fallback
        return parent::lastInsertID($m);
    }
public function lastInsertID ( $ m = null ) { if ( $ m instanceof \ atk4 \ data \ Model ) { // if we use sequence, then we can easily get current value if ( isset ( $ m -> sequence ) ) { return $ this -> dsql ( ) -> mode ( 'seq_currval' ) -> sequence ( $ m -> sequence ) -> getOne ( ) ; } // otherwise we have to select max(id_field) - this can be bad for performance !!! // Imants: Disabled for now because otherwise this will work even if database use triggers or // any other mechanism to automatically increment ID and we can't tell this line to not execute. //return $this->expr('SELECT max([field]) FROM [table]', ['field'=>$m->id_field, 'table'=>$m->table])->getOne(); } // fallback return parent :: lastInsertID ( $ m ) ; }
Return last inserted ID value.

Few Connection drivers need to receive Model to get ID because PDO doesn't support this method.

@param \atk4\data\Model Optional data model from which to return last ID

@return mixed
Return last inserted ID value .