[CDBI] Re: has_many relationships and order_by

[prev] [thread] [next] [Date index for 2005/12/14]

From: Edward J. Sabol
Subject: [CDBI] Re: has_many relationships and order_by
Date: 21:43 on 14 Dec 2005
> I've encountered a problem with has_many relationships in Class::DBI, after
> upgrading from 0.96 to 3.0.12. Once upon a time, calling:-
>
>      my $iter = $object->children({order_by => "name"})
>
> where "children" is a "has_many" relationship would work nicely, and you
> would get a list/iterator back which would contain your data, all nicely
> sorted.
>
> Now, however, I get an error stating that:- "order_by is not a column of
> Person"
>
> I'm just wondering if this has been changed on purpose, or whether to
> report it as a bug. I can send a test case (using DBD::SQLite2) if
> needed.

I'm guessing it's probably an unintended side effect of this line of code in
_hm_run_search() in Class::DBI::Relationship::HasMany:

    @search_args = %{ $search_args[0] } if ref $search_args[0] eq "HASH";

It's not clear to my why that line was added.

I recommend that you submit a bug report for this issue on
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Class-DBI. You should attach a
failing test case (i.e., a patch to one of the t/*.t files in the
distribution) to your bug report if you want Tony to take quick action.

Hope this helps,
Ed

_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi

[CDBI] has_many relationships and order_by
Dan Rowles 19:49 on 14 Dec 2005

[CDBI] Re: has_many relationships and order_by
Edward J. Sabol 21:43 on 14 Dec 2005

Generated at 19:11 on 22 Dec 2005 by mariachi v0.52