Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
DB Transactions ?
  • Hey, Been looking into using transactions with the DB class but since some things change to PDO, i'm not sure if I run a try/catch or Boolean test or how to rollback right. (I'm using InnoDB already)
    Also while looking thru the class I noticed this code (core/database/transaction.php), with no corresponding DB method in the DB class itself.
     public function complete()
     {
      if ($this->_db->trans_errors === FALSE)
      {
       static::commit();
      }
      else
      {
       static::rollback();
      }
     }
    
  • That looks like a bug, it should be
    public function complete()
    {
     if ($this->_db->trans_errors === FALSE)
     {
      $this->_db->commit_transaction();
     }
     else
     {
      $this->_db->rollback_transaction();
     }
    }
    

    Please report this at https://github.com/fuel/core/issues.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion