Welcome Guest, Not a member yet? Register   Sign In
Cancelling current transaction started with $this->db->trans_start()
#2

[eluser]letsgolee[/eluser]
if I'm right, you can rollback all, I think though I have not tested yet.

Transactions are started when $this->db->trans_start() is calling, and it can be called as many as you want.
if something is wrong and you want rollback all then we must know what depth of transaction and the depth is recorded using $this->db->_trans_depth. So the rollback function must be called as many as the nested transactions.

Code:
$this->db->trans_start();
...
$this->db->trans_start();
...

if (/* something is wrong and you want roll back all */) {
while ($this->db->_trans_depth) {
  $this->db->trans_rollback();
  $this->db->_trans_depth--;
}
}


Messages In This Thread
Cancelling current transaction started with $this->db->trans_start() - by El Forum - 03-15-2014, 05:01 AM



Theme © iAndrew 2016 - Forum software by © MyBB