Welcome Guest, Not a member yet? Register   Sign In
Db_manager and Transactions
#1

Hi All!

Someone can demonstrate the correct way to use the DB_manager library with CI3?

Thanks!
SZMX
Reply
#2

(12-30-2015, 02:50 AM)SZMX Wrote: Hi All!

Someone can demonstrate the correct way to use the DB_manager library with CI3?

Thanks!
SZMX

I'm made a test... in CI2 works fine... but... CI3, dont works,
I try with $this->current_db and with $this->db


PHP Code:
    public function trans() 
    {
        
$this->db->trans_start(false);

        
$this->main_model->ID_MODULE '9';
        
$this->main_model->NAME 'T99';
        
$this->current_db->insert("TB_SYS_PROFILE"$this->main_model);

        
$this->main_model->NAMES 'T99'; <= HERE I FORCE ERROR TO ROLLBACK.... 
                                                     
IN CI2 ROLLBACK OCCURSCI3 DONT WORK

        $this
->current_db->insert("TB_SYS_PROFILE"$this->main_model);

        
$this->current_db->trans_complete();

        if(
$this->db->trans_status() === FALSE) {
            
$this->db->trans_rollback();
            
$ret=-2;
        }
        else {
            
$this->db->trans_commit();
            
$ret 0;
        }

    }

Thanks for any help... I need keep with with CI2 :) 
Reply




Theme © iAndrew 2016 - Forum software by © MyBB