[CDBI] Re: Transaction over parent and children has_a objects

Peter Speltz peterspeltz at gmail.com
Tue Apr 4 20:58:26 BST 2006


I'm having trouble with transactions in CDBI 3.14  with mysql 4.1 .
All tables are InnoDB.
Here is my test sub:

 sub test_trans {

    my ($class) = @_;
    my $cdata = { cstmr_type => 'Residential', old_id => -1 };
    my $contact_data = { first_name => 'TEST_TRANS', 'last_name' =>
"WORK I HOPE", label => 'Testtrans'};
    my $obj;

    { # start
        local $class->db_Main->{ AutoCommit };
        $obj = $class->insert($cdata);
        $obj->add_to_contacts($contact_data);

        $class->dbi_rollback;
        #$class->dbi_commit;  # same type error
    } # end
}

When i call this i get this error:
DBD::mysql::db rollback failed: Rollback ineffective while AutoCommit is on

How can AutoCommit be on there?  Same thing happens if i call commit.
The rows are inserted without problem.

thanks for any help.




More information about the ClassDBI mailing list