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

2009-04-21 Thread Peter Corlett
On Mon, Apr 20, 2009 at 10:54:48AM -0700, David Ihnen wrote: > Peter Corlett wrote: [...] >> It was more a prompt for somebody with better inside knowledge of >> DBIx::Class to take the idea and run with it or suggest a better >> implementation. No point writing tests for code that's not suitab

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

2009-04-21 Thread Peter Rabbitson
John Napiorkowski wrote: > > I also have some concerns related to any of the bits where reads and writes > are mixed (or potentially so) behind the scenes, since the replication code > has to allow the read source to potentially lag from the write source. For > me, I'd like to see more of this

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

2009-04-20 Thread David Ihnen
Peter Corlett wrote: On 19 Apr 2009, at 11:14, Matt S Trout wrote: [...] And the patch didn't come with tests, so I assumed he didn't *want* it to be applied ... It was more a prompt for somebody with better inside knowledge of DBIx::Class to take the idea and run with it or suggest a better

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

2009-04-20 Thread Zbigniew Lukasiak
On Mon, Apr 20, 2009 at 3:02 PM, Matt S Trout wrote: > On Sun, Apr 19, 2009 at 11:49:29AM +0100, Peter Corlett wrote: >> On 19 Apr 2009, at 11:14, Matt S Trout wrote: >> >Valid idea though, and something we should look at making a >> >capability in >> >storage for 09 - in the meantime I'd recommen

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

2009-04-20 Thread Matt S Trout
On Sun, Apr 19, 2009 at 11:49:29AM +0100, Peter Corlett wrote: > On 19 Apr 2009, at 11:14, Matt S Trout wrote: > >Valid idea though, and something we should look at making a > >capability in > >storage for 09 - in the meantime I'd recommend rewriting it as a > >reusltset > >component just as pe

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

2009-04-19 Thread Peter Corlett
On 19 Apr 2009, at 11:14, Matt S Trout wrote: [...] And the patch didn't come with tests, so I assumed he didn't *want* it to be applied ... It was more a prompt for somebody with better inside knowledge of DBIx::Class to take the idea and run with it or suggest a better implementation. N

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

2009-04-19 Thread Matt S Trout
On Sat, Apr 18, 2009 at 03:29:24PM -0700, John Napiorkowski wrote: > > > > --- On Sat, 4/18/09, Jess Robinson wrote: > > > From: Jess Robinson > > Subject: Re: [Dbix-class] Insert or Update (was ANNOUNCE: 0.08099_08) > > To: "DBIx::Class user and develop

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

2009-04-18 Thread John Napiorkowski
--- On Sat, 4/18/09, Jess Robinson wrote: > From: Jess Robinson > Subject: Re: [Dbix-class] Insert or Update (was ANNOUNCE: 0.08099_08) > To: "DBIx::Class user and developer list" > Date: Saturday, April 18, 2009, 6:38 AM > > On Sat, 18 Apr 2009, Jess Robinson

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

2009-04-18 Thread Jess Robinson
On Sat, 18 Apr 2009, Jess Robinson wrote: On Fri, 17 Apr 2009, Peter Corlett wrote: On Mon, Apr 13, 2009 at 02:46:54PM +0100, Peter Corlett wrote: [...] > diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm > index 816b374..a8d501b 100644 > --- a/lib/DBIx/Class/Result

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

2009-04-18 Thread Jess Robinson
On Wed, 15 Apr 2009, Peter Rabbitson wrote: Tim Bunce wrote: On Mon, Apr 13, 2009 at 11:20:41AM +0100, Peter Corlett wrote: On 13 Apr 2009, at 09:35, Tim Bunce wrote: [...] If you use SELECT FOR UPDATE then savepoints aren't required for a safe implementation, right? No. Critically thoug

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

2009-04-18 Thread Jess Robinson
On Fri, 17 Apr 2009, Peter Corlett wrote: On Mon, Apr 13, 2009 at 02:46:54PM +0100, Peter Corlett wrote: [...] diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm index 816b374..a8d501b 100644 --- a/lib/DBIx/Class/ResultSet.pm +++ b/lib/DBIx/Class/ResultSet.pm @@ -2103,13 +2

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

2009-04-17 Thread Peter Corlett
On Mon, Apr 13, 2009 at 02:46:54PM +0100, Peter Corlett wrote: [...] > diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm > index 816b374..a8d501b 100644 > --- a/lib/DBIx/Class/ResultSet.pm > +++ b/lib/DBIx/Class/ResultSet.pm > @@ -2103,13 +2103,43 @@ sub update_or_create { >Fr

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

2009-04-15 Thread Peter Rabbitson
Tim Bunce wrote: > On Mon, Apr 13, 2009 at 11:20:41AM +0100, Peter Corlett wrote: >> On 13 Apr 2009, at 09:35, Tim Bunce wrote: >> [...] >>> If you use SELECT FOR UPDATE then savepoints aren't required for a safe >>> implementation, right? >> No. > >> Critically though, if the SELECT does not retu

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

2009-04-13 Thread Tim Bunce
On Mon, Apr 13, 2009 at 11:20:41AM +0100, Peter Corlett wrote: > On 13 Apr 2009, at 09:35, Tim Bunce wrote: > [...] >> If you use SELECT FOR UPDATE then savepoints aren't required for a safe >> implementation, right? > > No. > Critically though, if the SELECT does not return any rows, nothing is

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

2009-04-13 Thread Peter Corlett
On 13 Apr 2009, at 11:20, Peter Corlett wrote: [...] So it looks like this still needs savepoints to do correctly. Of course, one could always instead do a heroically complex bodge job that looks really impressive but doesn't actually work. And in the interests of STFUAWSC: diff --git a/lib

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

2009-04-13 Thread Peter Corlett
On 13 Apr 2009, at 09:35, Tim Bunce wrote: [...] If you use SELECT FOR UPDATE then savepoints aren't required for a safe implementation, right? No. update_or_create() currently does the following: it does a SELECT to retrieve any extant row; if the row exists it then does an UPDATE if ne

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

2009-04-13 Thread Tim Bunce
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 i

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

2009-04-12 Thread Andreas Mock
> -Ursprüngliche Nachricht- > Von: "Peter Corlett" > Gesendet: 12.04.09 14:41:26 > An: "DBIx::Class user and developer list" > Betreff: Re: [Dbix-class] Insert or Update (was ANNOUNCE: 0.08099_08) Hi Peter, > Because I'm already using trans

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

2009-04-12 Thread Peter Corlett
On Fri, Apr 10, 2009 at 10:23:36PM +0200, Andreas Mock wrote: [...] >> The current implementation does a SELECT followed by an INSERT or UPDATE >> as appropriate. This introduces a race condition. The whole thing is a >> critical section and needs to be wrapped in a transaction or savepoint. > O.k.

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

2009-04-10 Thread Andreas Mock
> -Ursprüngliche Nachricht- > Von: "Peter Corlett" > Gesendet: 09.04.09 15:39:05 > An: "DBIx::Class user and developer list" > Betreff: Re: [Dbix-class] ANNOUNCE: 0.08099_08 (0.08100_RC2) > The current implementation does a SELECT followed by an INSERT or UPDATE as > appropriate. This in