[Dbix-class] find redux

Matt S Trout dbix-class at trout.me.uk
Sat Feb 2 06:31:51 GMT 2008


On Fri, Feb 01, 2008 at 05:11:19PM -0500, Daniel Westermann-Clark wrote:
> On 2008-02-01 10:23:33 +0100, Zbigniew Lukasiak wrote:
> > Yes - just ignore any column that is not part of the key in any case
> > and then return the first row returned by the query.
> 
> This does mean we'll break some small amount of back compat, though
> the people specifying a 'key' attr probably aren't relying on that
> particular piece of compat.
> 
> Nonetheless, we should add a warning initially in cases where we've
> outright ignored the query.

I think that's probably a good idea.

But.

The *_or_* methods should ensure that when -they- get a key they only
pass through the appropriate keys so they don't trip the warning.

In the case of those it's almost certainly a bug.

What we're really doing here is "if we get 'key' to *_or_* assume that
any missing cols from it are in the $rs, if we get it to find assume that
any missing cols are in the rs and warn weird shit is about to happen if
there are extra cols as well".

I think that can go out as a bugfix.

> > You can also check if it exhausted the cursor (as you proposed in
> > one of the emails).
> 
> I do like this idea... should we add it in 0.08100?

I think probably in $storage->single so it catches all cases.

We'll probably also need one in find() itself though for the case when it uses
a full cursor to handle prefetch.

See also my original redux for a few other proposed bits and pieces I'd like
your input on.

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director                    http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/            http://www.shadowcat.co.uk/servers/



More information about the DBIx-Class mailing list