Welcome Guest, Not a member yet? Register   Sign In
Transactions between models
#1

[eluser]Unknown[/eluser]
I'm starting to implement the Transactions Library, and would like to know if transactions can be 'transferred' between models. I know this works:
Code:
$this->db->trans_start();
$this->db->query('AN SQL QUERY...');
$this->db->query('ANOTHER QUERY...');
$this->db->query('AND YET ANOTHER QUERY...');
$this->db->trans_complete();

But would this work if I call trans_start() and trans_stop() in a controller, and then the actual queries run inside models?
Code:
$this->db->trans_start();
$this->model1->random_db_insert_function_A('data');
$this->model2->random_db_insert_function_B('data');
$this->db->trans_complete();

If not, could I somehow tag each of the database queries as part of a set that is defined in the controller? Thanks for your thoughts.


Messages In This Thread
Transactions between models - by El Forum - 02-24-2012, 10:35 AM
Transactions between models - by El Forum - 02-24-2012, 11:23 AM
Transactions between models - by El Forum - 02-27-2012, 12:25 AM



Theme © iAndrew 2016 - Forum software by © MyBB