Welcome Guest, Not a member yet? Register   Sign In
[solved] Alternative for $this->db->insert_id() on Oracle
#1

[eluser]fszostak[/eluser]
Hi All,
I am making migration of my CI application on Oracle, the method $this->db->insert_id() is used in many points, somebody did have this problem?
Any idea?
Thanks!
#2

[eluser]fszostak[/eluser]
Hi All!

I solved this issue and AUTOINCREMENT field together.

Code:
private function insert() {
  $this->ID = $this->getNextId();
  $this->db->insert($this->getTableName(), $this);
  $this->log($this->ID);
}
private function getNextId() {
  $this->db->select($this->getTableName()."_SEQUENCE.NEXTVAL AS NEXTID", FALSE);
  $this->db->from("dual");
  $query = $this->db->get();
  $row = $query->row();
  return $row->NEXTID;
}
#3

[eluser]konradinho[/eluser]
How do I download it last added id? I tried this way but it does not work:

Code:
$last_insert_id = $this->data_model->insert();




Theme © iAndrew 2016 - Forum software by © MyBB