Hi,
i'm testing the use of Zend Framework with Oracle and for what can i see, to get the inserted id i have to use one of the codes below:
PHP Code:
$oModel->getAdapter()->lastInsertId('TABLENAME');
// Or
$oModel->getAdapter()->lastSequenceId('SEQUENCENAME');
The code below, with Oracle adapter, don't return the ID, just NULL:
PHP Code:
$id = $oModel->insert(array('FIELDNAME' => 'my data'));
But, if in the model configurations i put the $_sequence like below:
PHP Code:
class MyModel extends Zend_Db_Table {
protected $_name = 'TABLENAME';
protected $_primary = array('COLLUM_PK');
public $_sequence = 'SEQUENCE_NAME';
}
The insert method insert the ID 45 for example, but the last is the 43, one is skipped, but the insert method return to me 44, and the lastInsertId and lastSequenceId methods keep returning the correct ID.
Is this correct?
I always will have to use the lastInsertId and lastSequenceId methods to get the last ID? Can't just use the insert method return like i'd use in others adapters like PDO_MSSQL?
Thanks!