On 8/14/07, Michael Lackhoff <[EMAIL PROTECTED]> wrote:
> $db->begin_work;
> my $obj = Products->new(db => $db);
> ...
> $obj->save;
> some_helper_that_uses_db(); # rollback here
> my $obj2 = Customers->new(db => $db);
> ...
> $obj2->save;
> $db->commit;
>
> When I ran this code $obj2 was saved but $obj was rolled back.

Was there ever a commit after $obj->save but before the rollback in
some_helper_that_uses_db()?

> The helper isn't special but as it is it doesn't accept a 'db' argument,
> so my guess was that when the chain of requests with always the same db
> was broken, a rollback would occur.

Just to clarify, they're different "db"s (i.e., different My::DB
objects), but they all share a single DBI $dbh internally, and that's
what's important in terms of commit/rollback.

-John

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to