Welcome Guest, Not a member yet? Register   Sign In
Active Record class and Transactions do not work together
#1

[eluser]Morty[/eluser]
Hi there!

I am currently studying transactions. Therefore I tried the TEST mode :

Code:
$magicdb->trans_start(true);
            foreach ($inserts as $insert)
            {
                $magicdb->insert('information', $insert);
            }
            $magicdb->trans_complete();

But my inserts are actually recorded to my DB without any rollback. Is CI ignoring my Active Record queries?

Thanks for any help you may provide.
#2

[eluser]Référencement Google[/eluser]
I've got the same issue, Morty, did you came to any solution about that?
This is my code:

Code:
function add($insert)
    {                
        $this->db->trans_start();
        $this->db->insert('nip_profile', $insert['profile']);
        $this->db->trans_complete();
        
        if ($this->db->trans_status())
        {
            return TRUE;
        }        
    }

Whatever I try to do, it never RollBack while it should. I use MySQL 5 and my tables are InnoDB, there should be no problem, can somebody help?
#3

[eluser]Morty[/eluser]
Hi elitemedia!

Have you tried passing your query without Active Record ?

Code:
$this->db->query('YOUR QUERY HERE');

In my case, I couldn't do that, because I had no time to. Could you try this and tell us whether that works ?
#4

[eluser]Référencement Google[/eluser]
This will be very embarrassing to do as I have a real lot of fields to make only a test that maybe won't work. I'd prefer before make 20 tests to have an answer from CI guru's about that problem.
#5

[eluser]gtech[/eluser]
see post 63661

seems to work ok for me, but I do a manual commit and rollback. If you follow the link I have written down a series of steps you need to follow to get rollback working.
#6

[eluser]Référencement Google[/eluser]
Ok thanks. I don't need at this time but I bookmarked your post and I will try that later.




Theme © iAndrew 2016 - Forum software by © MyBB