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

Perrin Harkins perrin at elem.com
Tue Apr 4 21:51:57 BST 2006


On Tue, 2006-04-04 at 14:58 -0500, Peter Speltz wrote:
>     { # 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?

It can be on there if it isn't using the same database connection that
db_Main() is.

What happens if you replace your call to $class->dbi_rollback with this:
$class->db_Main->rollback()

- Perri





More information about the ClassDBI mailing list