[DBIx-Class-Devel] UPDATE RETURNING

Peter Rabbitson rabbit+dbic at rabbit.us
Mon Jul 15 16:49:48 GMT 2013


On Mon, Jul 15, 2013 at 11:21:11AM -0500, fREW Schmidt wrote:
> On Mon, Jul 15, 2013 at 04:00:26PM +0000, Peter Rabbitson wrote:
> > This is a very contrived use-case (I would simply solve it with batches
> > wrapped in transactions), and I don't think it warrants a full blown
> > chunk of the scrace API. You kind-of agree further down.
> 
> It's hardly contrived, that's actually how our application works.
> Note that this code in our codebase is especially hot and deadlocks
> are srs.  I am actually using raw sql to do what I am proposing
> and skipping DBIC entirely because fewer DB interactions helps.

Contrived in the sense of "highly specialized". Since you are talking 
generic API design in this thread, I had to point out that while this is 
a problem you had to code around, this is not likely to be a problem 
that many others will need to code around.

In other words this seems like a case where you are already doing the 
right thing - circumventing your ORM and doing the hot part over the raw 
$dbh.

If constructing the SQL seems hard - there probably is something that 
can be done to make it simpler. But wrapping it in something $storage 
understands seems like thre wrong way to go.

My 2c



More information about the DBIx-Class-Devel mailing list