Eh, "custom result source" not "customer result set." On Wed, Jun 13, 2012 at 3:24 PM, Bill Moseley <mose...@hank.org> wrote:
> Say I have a table "task" in a Postgresql database that has an integer > column "total_seconds" which is a total number of seconds one or more > actors (people, worker processes, etc.) spent working on the task. So, > these various actors need to add some value to an existing column. > > What is the recommended way to to add to an existing integer column like > this and avoid race condition? > > I can see in the past I've used a customer result set: > > UPDATE task SET total_seconds = total_seconds + ? WHERE id = ? > > but, I also have used SELECT .. FOR UPDATE ( i.e. { for => 'update' } ) > in a transaction. > > Is there any advantage of one over the other? > > > -- > Bill Moseley > mose...@hank.org > -- Bill Moseley mose...@hank.org
_______________________________________________ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk