[Dbix-class] find redux

Matt S Trout dbix-class at trout.me.uk
Sun Feb 17 15:58:34 GMT 2008


On Sun, Feb 17, 2008 at 02:14:16PM +0100, Zbigniew Lukasiak wrote:
> On Feb 14, 2008 10:47 PM, Zbigniew Lukasiak <zzbbyy at gmail.com> wrote:
> > On Thu, Feb 14, 2008 at 3:04 PM, Matt S Trout <dbix-class at trout.me.uk> wrote:
> > >
> > > On Wed, Feb 13, 2008 at 08:31:42PM +0100, Zbigniew Lukasiak wrote:
> > >  > On Feb 13, 2008 5:51 PM, Guillermo Roditi <groditi at gmail.com> wrote:
> > >  > > > I attach a patch (against
> > >  > > > http://dev.catalyst.perl.org/repos/bast/DBIx-Class/0.08/trunk) that
> > >  > > > does more or less that - when you specify the unique key it ignores
> > >  > > > all columns from the query that don't belong to it (
> > >  > >
> > >  > > I find this to be desired behavior Zbigniew Lukasiak++
> > >  >
> > >  > Thanks.  Frankly I don't think that warning is necessary - I like to
> > >  > use find directly from the query parameters without removing all the
> > >  > unneeded columns.  Without it that patch is even more trivial
> > >  > (attached here).
> > >
> > >  Looks good. Fancy doing the warn-if-more-than-one-result bit while you're
> > >  in there as well?
> >
> > Attached.  I think it could even croak in that case.
> 
> Now, waiting for this to be committed, here is the problem with the
> *_or_* methods: Pg will not accept an INSERT with the primary key set
> to NULL and on the other hand the "find" method will not accept a
> query without the primary key.

I don't understand why you'd want to find() when you don't have a key to
find by?

What's your use case for passing undef to find_or_create at all? Surely
in this case you should just be calling create?
> Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.rawmode.org

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