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

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

From: Tony Bowden
Subject: Re: the case of construct() and the missing database row
Date: 10:42 on 15 Jul 2004
On Thu, Jul 15, 2004 at 03:39:37AM -0700, Patrick Michael Kane wrote:
> I've noticed that construct() returns a CDBI object, even if you pass
> it a hashref that does not correspond to a row in the database.  Is
> this a feature?

It's not so much a feature or a bug as just what the method does. You
give it data, and it turns it into an object. It has no opinion on what
that data is.

> If so, is there an easy way to check the returned object to see if it
> actually came from the DB or not?

This sounds like the wrong question.

> 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?

Tony

(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
Tony Bowden 10:42 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