• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
2 databases, 1 transaction?

#1
Hi all!

My question is simple may be- Can I do the following:

$this->db->trans_start()
add(edit, delete) a record in database#1,
load database#2,
change $active_group,
add(edit, delete) a record in database#2,
close connection to #2,
change $active_group back,
and, at last, finish with $this->db->trans_complete()
?

Is the $this->db->trans_status() result reliable in this case or not?

Thank you
Reply

#2
Found the answer myself: " Transactions are isolated within a single "database"" http://stackoverflow.com/questions/22398...ansactions

Bad news Sad

Is there a method to synchronize 2 databases on the fly?
Reply

#3
You can do the below though:

Code:
$db1 = $this->load->database('db1', TRUE);
$db2 = $this->load->database('db2', TRUE);

$db1->trans_start();
$db2->trans_start();

$db1->insert('table';$data_array);
$db2->insert('table';$data_array);

$db1->trans_complete();
$db2->trans_complete();
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.