[eluser]Fábio[/eluser]
Hi,
How do I force a transaction to rollback, using the automatic method.
( The manual method supports nested transactions in MySQL? As far as I know it does not support. )
Code:
try
{
// Begin first transaction
$this->db->trans_start();
$this->db->query('<anything>');
// Begin nested transaction
$this->db->trans_start();
$this->db->query('<anything>');
// Some 'assertion' code
if( true )
throw new Exception('Force everything to rollback');
$this->db->trans_complete();
// Finishing outermost trans
$this->db->trans_complete();
}
catch(Exception $ex)
{
// How do I rollback both transactions?
// $this->db->rollback(); ??
}
Thanks for your attention.