On 8/17/07, Michael Lackhoff <[EMAIL PROTECTED]> wrote: > On 17.08.2007 16:20 John Siracusa wrote: > > On 8/15/07, Michael Lackhoff <[EMAIL PROTECTED]> wrote: > >> my $db = My::DB->new(); > >> > >> $db->do_transaction( > >> sub { > >> my $o = My::Thing->new(); > >> $o->foo(123); > >> $o->bar(456); > >> $o->save; > >> die "Does it rollback?"; > >> } > >> ); > >> > >> This code does _not_ do a rollback. > > > > When running under Apache::DBI, this line issues a rollback: > > > > warn $o->db->dbh(); > > So, if I understand it right, there are really two problems: > - no rollback when it should be (my do_transaction above) > - a rollback when there should be none (your warn)
Once the database handle is reset to auto-commit, any subsequent rollback will have no effect anyway, so one thing at a time :) > even if I comment the call to reset_startup_state out in Apache::DBI (as > suggested before) the above do_transaction code still doesn't roll back. That's because DBI does the same thing as reset_startup_state() in its connect() method (around line 683 in DBI.pm version 1.58) and you didn't comment that out :) >> Finally, I suppose I could change the default implementation of >> init_db() to be more like this instead: >> >> sub init_db { $DB ||= Rose::DB->new } >> >> But that'd be quite a behavior change, and it'd have its own set of problems. > > What are the problems here? Since I adopted this for the time being it > would be nice to know what I have to expect... I just meant that it'd be a change in historic behavior that could break some people's code when they upgrade (not that RDBO is 1.0 yet, but it's still nice to avoid this kind of thing, if possible). -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