On Fri, Apr 13, 2007 at 02:28:59PM -0400, Perrin Harkins wrote:
> On 4/13/07, Bill Moseley <[EMAIL PROTECTED]> wrote:
> > So, for example, in Catalyst in an end() (or something at the end) you
> > would look for errors and then do a rollback, otherwise commit?  And
> > you look at AutoCommit to see if you need to do either of those, I
> > assume.
> 
> No, it's much simpler than that.  Maybe Catalyst complicates things
> with some extra eval wrapping.  In my CGI::Application app, I just
> turn on RaiseError.  If nothing goes wrong, the changes get committed
> when I exit the block with AutoCommit turned off.  There's no need for
> an explicit commit.  (And because I use local $sbh->{AutoCommit}, it
> won't commit until I leave the highest level block that initiated a
> transaction, so it amounts to fake nested transactions but with
> automatic scoping.)
> 
> If there's an exception, I believe DBI issues a rollback automatically,

Nope.

> and I have a rollback at the end of every request just
> in case, like Apache::DBI does.

Good :)

Tim.

> I don't currently have any cases
> where I try to rollback and continue the request, so I don't trap the
> exceptions.
> 
> > In general I like to get in, get the transaction done and get out
> > because I might have a longer task that follows and don't want the
> > transaction left open during that time.
> 
> My transactions are as small as possible, to avoid holding locks.  I
> only use longer ones in bulk loading situations where it makes a big
> difference.  I'm not really following why the fake nested transactions
> help with this.
> 
> > Perhaps a cleaner way (other than queuing up the task for an external
> > process) would be push a sub onto an array with the code to run after 
> > calling
> > commit.
> 
> Sorry, I'm not sure what problem you're trying to solve there.
> 
> - Perrin
> 
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Rose-db-object mailing list
> Rose-db-object@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rose-db-object

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to