Am 25.08.2008 um 20:43 schrieb Matt S Trout:

On Sat, Aug 23, 2008 at 08:53:27AM +0200, Moritz Onken wrote:
Something like:

my $search = {  };
my $attr = { prefetch => [ qw/tracks tags/ ] };

my $cd = $schema->resultset("Artist")->first->cds->search($search,
$attr)->first;
$cd->tracks->all;
$cd->tags->all;

did work for me. If you say it breaks in many cases I might have not
tested it enough.
Is there an alternative to get the same data with one query but still
have all the relations working?

No, there isn't.

But the point we're trying to make is that all the cases -we- tried, it
was broken.

So what we need from you is to try and work out what cases you were hitting
that weren't broken, so we can make the exception only happen in cases
that are genuinely broken.

The exception was introduced to try and produce a sane error rather than
a random explosion further down. I'd be very happy to be able to -not-
throw an exception and have it work, but obviously we also still want to
throw an exception when we know it's not going to work.

Could you unpatch as Peter showed you and try some experiments, see if you can figure out what works and what doesn't - or at least provide a bunch of examples that do and don't and we'll try and figure out what the common
factor is?

--

Yes, I'm on it. What I found out is that calls like $cd->tags->all return some rows multiple times. Depending on the rows which are in $cd->tracks- >all and
the order of how you put the relations in the prefetch arrayref.
Therefore ->count doesn't work as well. But I think this could be fixed with
some kind of a implementation of distinct in perl (List::MoreUtils uniq)

As I said I'm on it and writing some examples and tests.

moritz



_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[EMAIL PROTECTED]

Reply via email to