Re: the case of construct() and the missing database row

[prev] [thread] [next] [Date index for 2004/07/15]

From: Patrick Michael Kane
Subject: Re: the case of construct() and the missing database row
Date: 11:08 on 15 Jul 2004
* Tony Bowden (tony-cdbitalk@xxxxx.xxx) [040715 03:42]:
> > The context is occasionally we'll construct() a few hundred CDBI
> > objects and someone will have removed a row out from under us between
> > the time that the list of primary keys was generated and the time that
> > we called construct().  The app doesn't blow up until it tries to call
> > one of the has_a() methods on the bogus object.
> 
> Surely you'd have the same problem even if you called construct()
> instantly?

Fair enough, the data could still disappear after the objects are
constructed, although this would bite fairly infrequently in this
particular environment.

The bad thing, for me at least, is that I don't find out that this has
happened until I actually start calling methods on the object in
question and the error that is returned.  I'd like to just skip the
missing object and move on to the next one, without blowing up.

Wrapping every attempt to use an object in a try() seems
ugly/expensive, but maybe that's the way to do it?

Would also welcome a rethink, if I'm barking up the wrong tree
entirely.

Best,
        -- 
        Patrick Michael Kane
<modus@xx.xx.xx>

(message missing)

the case of construct() and the missing database row
Patrick Michael Kane 10:39 on 15 Jul 2004

Re: the case of construct() and the missing database row
Patrick Michael Kane 11:08 on 15 Jul 2004

Generated at 11:34 on 01 Dec 2004 by mariachi v0.52