Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

design flaw in DB transaction class of CodeIgniter framework #1308

Closed
cfc4n opened this Issue May 1, 2012 · 2 comments

Comments

Projects
None yet
3 participants
@cfc4n
Copy link

cfc4n commented May 1, 2012

I encountered a problem in our production environment,In the use codeigniter transaction processing class library, because a transaction outside of the SQL execution error causes the transaction to be rolled back.The specific situation here http://www.cnxct.com/design-flaws-of-codeigniter-framework/ .In Chinese. We can use google translate to see.Sorry, my English is poor.

http://translate.google.com.hk/translate?act=url&hl=zh-CN&ie=UTF8&prev=_t&sl=zh-CN&tl=en&u=http://www.cnxct.com/design-flaws-of-codeigniter-framework/

@cfc4n

This comment has been minimized.

Copy link
Author

cfc4n commented May 1, 2012

Dear all:
If there is a lot of fails when sql run bad begin of the transaction . The attribute $_trans_status of DB class while be FALSE.
after this ,A transaction, all SQL statements run correctly.When the transaction commits, function trans_complete() will Function trans_complete () aaaa is false, the transaction rollback.However, a transaction outside of the SQL execution error, but then the transaction has brought impact.SO I think this is a design defect.What about you ?

in system\database\DB_driver.php ,function trans_start() add some code to repair the bugs.

function trans_start($test_mode = FALSE)
{
    if ($this->trans_strict === FALSE)
    {
        $this->_trans_status = TRUE; //在开始事务处理时,设置_trans_status值为TRUE,放置事务之前的SQL语句执行错误,将这个值赋值false,带来事物回滚的影响。
    }

    if ( ! $this->trans_enabled)
    {
        return FALSE;
    }

    // When transactions are nested we only begin/commit/rollback the outermost ones
    if ($this->_trans_depth > 0)
    {
        $this->_trans_depth += 1;
        return;
    }

    $this->trans_begin($test_mode);
}

Is that right?

@ckdarby

This comment has been minimized.

Copy link
Contributor

ckdarby commented Apr 7, 2013

Did you test this on the develop branch? I believe this got fixed

@narfbg narfbg closed this Oct 29, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.