Welcome Guest, Not a member yet? Register   Sign In
Transaction not completed but trans_status NOT false
#1

Hi there,
I'm currently facing a weird issue with an "old" CI (2.1.3).
Within the same method, I start a transaction, run some updates & inserts, commit the transaction and if everything is OK, I send an email.
It's been working for years, until today, without any code changes.
// Start the transaction
$this->db->trans_start();
                            

// Do my updates & inserts

// Complete the transaction
$this->db->trans_complete();

if ($this->db->trans_status() === FALSE) {

// Return an error
} else {
// Send an email
}
Today's event : The email has been sent but without any inserts & updates done. I could see the queries being run. So, I assume it has rollbacked.
Three questions : 
- Why can I have a trans_status to TRUE if it has rollbacked ? Am I missing something ?
- In Production, db_debug is at false, does it make any difference ? I was not able to see any logs, so I don't know where it has failed.
- How can I test a transaction failure ? I tried with using unknown table names. If db_debug is set to true, I get a 500. If db_debug is set to false, it goes all the way and returns a 200, BUT, the transaction is rollbacked and the trans_status is set to false. It works as expected
Reply
#2

I would check with your hosting provider and see if they have made any changes to the server

Like PHP, updated MySQL etc;
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

(09-02-2021, 04:50 AM)InsiteFX Wrote: I would check with your hosting provider and see if they have made any changes to the server

Like PHP, updated MySQL etc;

I host the code on private servers and nothing has changed since a hosting change two years ago. But still, is there a case or a scenario that would lead to a rollback AND a status set to TRUE ?
I've a single and unique transaction. Maybe if the same request is called  simultaneously...I'm giving up Smile
Reply




Theme © iAndrew 2016 - Forum software by © MyBB