[Dbix-class] Insert or Update (was ANNOUNCE: 0.08099_08)

Tim Bunce Tim.Bunce at pobox.com
Mon Apr 13 08:35:39 GMT 2009


On Sun, Apr 12, 2009 at 01:37:00PM +0100, Peter Corlett wrote:
> On Fri, Apr 10, 2009 at 10:23:36PM +0200, Andreas Mock wrote:
> [...]
> 
> >> However, I'm not quite sure this trick completely retains the semantics
> >> of create_or_update, so it wouldn't be a drop-in replacement.
> > It would be interesting if you can make it really an atomic operation. I'm
> > asking because I'm not sure if transactions are enough.
> 
> It is if you also use SELECT FOR UPDATE.
> 
> >> I also suspect that while savepoints may be necessary, they're not
> >> sufficient, and one also needs SELECT FOR UPDATE. How might I express
> >> that in DBIC?
> > An interesting question. I would be also interested in that.
> 
> Somebody else has kindly answered that, which I think gives me the final
> piece to allow me to craft a patch.

If you use SELECT FOR UPDATE then savepoints aren't required for a safe
implementation, right?

(Which is handy, as SELECT FOR UPDATE is more widely supported than
savepoints.)

Tim.



More information about the DBIx-Class mailing list