Unable to check transaction status if a transaction fails |
I have a model method that does various inserts into various tables, and so I have wrapped it in a transaction.
However, I am struggling to log my own errors if the transaction fails, due to never being able to check $this->db->trans_status() when a legitimate DB error occurs. After completing the transaction, I am checking for the status, as outlined here: https://ellislab.com/codeigniter/user-gu...tions.html But when a DB error occurs, for what ever reason (one that would cause the transaction to fail), my line where I check the status is never reached. My code (simplified): PHP Code: $this->db->query('SIGNAL SQLSTATE \'45000\' SET MESSAGE_TEXT = \'Custom error\''); // this is to cause a DB error intentionally! |
Messages In This Thread |
Unable to check transaction status if a transaction fails - by mr_pablo - 12-16-2015, 09:43 AM
RE: Unable to check transaction status if a transaction fails - by skunkbad - 12-16-2015, 11:41 PM
RE: Unable to check transaction status if a transaction fails - by mr_pablo - 12-17-2015, 04:03 AM
RE: Unable to check transaction status if a transaction fails - by mr_pablo - 12-17-2015, 04:24 AM
RE: Unable to check transaction status if a transaction fails - by Narf - 12-17-2015, 05:29 AM
RE: Unable to check transaction status if a transaction fails - by mr_pablo - 12-17-2015, 07:55 AM
|