Welcome Guest, Not a member yet? Register   Sign In
Catching Duplicate entry exceptions while executing transactions
#2

[eluser]dioony[/eluser]
Hi!

Actually i was searching for a good workaround to catch such database errors... no matter what...

i hope I've gotten it right:

You're problem:
you have a lot of queries in a transaction e.g. q1,q2,q3,q4...
now, if an exception will be raised in q2, you want to catch this, send an alternative query only for q2 (or none) and after that carry on with q3 and q4.
is that right?

normally if a transaction failed the database runs itself a rollback to revert all queries before the error encountered. i never used transactions with CI before, but normally you don't have to rollback manually...

if I'm right with the example on the top: this would argue against the transaction-concept, because a transaction should be closed action. means: either all achieves success or one query failed and all failed. so, if it will failed you have do to a complete new transaction...


or is you're problem where to put the alternative query in case of an exception? (thus: the process in a try-catch-block if an exception will be raised)



sorry for my English Wink


Messages In This Thread
Catching Duplicate entry exceptions while executing transactions - by El Forum - 03-12-2008, 06:21 PM



Theme © iAndrew 2016 - Forum software by © MyBB