Part of the EllisLab Network

Bug Report

trans_status() bug or typo

Date: 05/02/2007 Severity: Trivial
Status: Resolved Reporter: ksheurs
Version: 1.5.3
Keywords: Libraries, Database Class

Description

As noted in the user_guide: http://codeigniter.com/user_guide/database/transactions.html under Managing Errors it says that you check for === FALSE for transaction errors. However it is the opposite of that. You have to check for === TRUE for transaction failure. In DB_driver.php Line 465 notes that it should return TRUE as well. But on line 491 it returns FALSE for failure. I personally think it should be FALSE as it says in the user_guide. It makes more sense to test for FALSE if theres an error (vs TRUE for an error?). But i do not know the original intent of this, so tuff for me to say which is correct since the user_guide and code/comments contradict each other.

Code Sample

DB_driver.php Line 491

function trans_status()
{
    
return $this->_trans_failure;
}

Expected Result

function trans_status()
{   return !$this->_trans_failure;
}

Actual Result

http://codeigniter.com/forums/viewthread/47425/
http://codeigniter.com/forums/viewthread/50644/
http://codeigniter.com/forums/viewthread/47065/

Comment on Bug Report

Name:

Email:

Location:

URL:

Remember my personal information

Notify me of follow-up comments?