[Dbix-class] ->search oddity with superfluous parameters

Aaron Crane dbix-class at aaroncrane.co.uk
Thu May 15 21:54:45 BST 2008


This works:

    my $rs = $schema->resultset('CD')->search(
        { artist => 1 },
        { order_by => 'id' },
    );

Oddly, so does this:

    my $rs = $schema->resultset('CD')->search(
        { artist => 1 },
        undef,
        { order_by => 'id' },
    );

I'm finding it hard to imagine that's deliberate.  Attached is a
patch (against 0.08/trunk) which (a) tests that this code throws an
exception, and (b) throws such an exception.  All other tests seem to
pass.

If the consensus is that the current behaviour is correct, I'll
happily concoct an alternative patch with appropriate documentation
and tests.

(Or if you'd like me to regenerate this patch against an different
branch, that's also fine.)

I've also attached a second patch which refactors some surrounding
code in a way that I find much easier to understand.  It should apply
to 0.08/trunk either before or after the behaviour-changing patch.
Again, all tests still pass.

-- 
Aaron Crane ** http://aaroncrane.co.uk/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ignore_extra_args.diff
Type: text/x-diff
Size: 1097 bytes
Desc: not available
Url : http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20080515/5ecfa348/ignore_extra_args.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: resultset_refactor.diff
Type: text/x-diff
Size: 1587 bytes
Desc: not available
Url : http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20080515/5ecfa348/resultset_refactor.bin


More information about the DBIx-Class mailing list