Junnel Gallemaso
Junnel Gallemaso

Reputation: 881

CodeIgniter - Database Transaction

Is $this->db->trans_start(); is only applicable for $this->db->query(); ?

I just want to know since all CI examples in the user guide uses $this->db->query();

does it applicable for this one? Example:

  $this->db->select('an_baby.parent_number');
  $this->db->from('an_parent');
  $this->db->join('an_baby', 'an_baby.parent_number = an_parent.id', 'inner');
  $this->db->where('date_born <=', date('Y-m-d'));
  $this->db->where('type', 'NewBorn');

Any response is much appreciated. Thanks!

Upvotes: 1

Views: 786

Answers (2)

ghostika
ghostika

Reputation: 1503

Every CI database function between $this->db->trans_start() and $this->db->trans_complete() is good.

Upvotes: 2

Tjkoopa
Tjkoopa

Reputation: 2378

Yes transactions will work fine with the active record style methods.

Upvotes: 2

Related Questions