Welcome Guest, Not a member yet? Register   Sign In
Code Igniter database transactions
#15

[eluser]kirilisa[/eluser]
The table updating on reload happens when db_debug is set to TRUE. When it's FALSE, everything works as it should.

It happens with the code you posted (or with mine, which I tested changing the insert values on the fly)

1) set db_debug = TRUE
2) create test table: it is empty
3) load the method of the controller with your code in it
4) it crashes with an error (thus never finishing the txn)
5) query the test table, it is empty
6) reload the page (thus starting a new transaction)
7) it crashes as before
8) query the test table, it has been written from the previous transaction.

But it only happens when using trans_start/trans_complete, not with trans_begin/trans_commit/trans_rollback. And I put in a couple debug statements and I never see any indication that it gets to the trans_complete() method [or indeed trans_rollback() or trans-commit()] so why is it being committed?

You're right, that process does result in nested transactions due to the first one's not completing, but does mysql by default if having a nested transaction, automatically make the first (unfinished) one commit? That doesn't seem to make sense.

Yep I also saw the solution to bug 4299 and threw a $this->_trans_status = TRUE; in my trans_start (actually in my trans_begin too) to get around it.

I've been psyched about CI and I still am, it's great and it's making life a lot easier. It's only this txn thing that has made me a bit uneasy, so I hope something more definitive will be done or at least documented sometime in the next couple months.


Messages In This Thread
Code Igniter database transactions - by El Forum - 04-19-2008, 03:58 PM
Code Igniter database transactions - by El Forum - 04-19-2008, 07:48 PM
Code Igniter database transactions - by El Forum - 04-19-2008, 11:02 PM
Code Igniter database transactions - by El Forum - 04-20-2008, 03:15 PM
Code Igniter database transactions - by El Forum - 04-20-2008, 03:46 PM
Code Igniter database transactions - by El Forum - 04-20-2008, 04:07 PM
Code Igniter database transactions - by El Forum - 04-20-2008, 04:42 PM
Code Igniter database transactions - by El Forum - 04-20-2008, 06:07 PM
Code Igniter database transactions - by El Forum - 04-20-2008, 06:17 PM
Code Igniter database transactions - by El Forum - 04-20-2008, 07:20 PM
Code Igniter database transactions - by El Forum - 04-20-2008, 07:36 PM
Code Igniter database transactions - by El Forum - 04-20-2008, 08:27 PM
Code Igniter database transactions - by El Forum - 04-20-2008, 08:45 PM
Code Igniter database transactions - by El Forum - 04-20-2008, 09:00 PM
Code Igniter database transactions - by El Forum - 04-20-2008, 10:07 PM
Code Igniter database transactions - by El Forum - 04-20-2008, 10:12 PM
Code Igniter database transactions - by El Forum - 04-20-2008, 10:30 PM
Code Igniter database transactions - by El Forum - 04-21-2008, 12:36 PM
Code Igniter database transactions - by El Forum - 04-21-2008, 03:56 PM
Code Igniter database transactions - by El Forum - 04-21-2008, 03:59 PM



Theme © iAndrew 2016 - Forum software by © MyBB