CodeIgniter Forums
Setting _trans_status - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Setting _trans_status (/showthread.php?tid=62609)



Setting _trans_status - Movak - 08-04-2015

Every failed query sets _trans_status to false. Therefore, any subsequent transaction (using trans_start() or trans_begin)) will also fail because _trans_status is not reset at the start. Shouldn't _trans_status be set to true in trans_begin() where 'START TRANSACTION' is done. Queries that fail outside a transaction should not effect a transaction.

The strange thing is that there is a _trans_failure flag set there and it is never accessed anywhere. 
$this->_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE;

Shouldn't that be 
$this->_trans_status = ($test_mode === TRUE) ? TRUE : FALSE;

If that change is made all transactions will start with a clean slate.