Welcome Guest, Not a member yet? Register   Sign In
Re Enable Transactions after using trans_off()
#1

To disable database transactions at run-time you can call

PHP Code:
$this->db->trans_off(); 

Maybe I am missing something but I don't see any way to reverse this call to allow transaction processing.

The abstract class DB_driver defines trans_off() with this code.

PHP Code:
public function trans_off()
{
 
   $this->trans_enabled FALSE;


The property $trans_enabled is used throughout the class to allow (or not) class methods to proceed. For instance

PHP Code:
public function trans_start($test_mode FALSE)
{
 if ( ! 
$this->trans_enabled)
 {
 return 
FALSE;
 }

 return 
$this->trans_begin($test_mode);


The "issue", if there is one, is that the documentation at Enabling Transactions implies that calling $this->db->trans_start(); will re-start transaction processing after a call to $this->db->trans_off(); But that is not the case as the code snippet above clearly illustrates.
Reply


Messages In This Thread
Re Enable Transactions after using trans_off() - by dave friend - 10-22-2016, 06:36 AM



Theme © iAndrew 2016 - Forum software by © MyBB