>>>>> "Dagfinn" == Dagfinn Ilmari Mannsåker <[email protected]> writes:
Dagfinn> "John Stoffel" <[email protected]> writes: >> Hi, Dagfinn> Hi John, >> I've been pounding my head trying to figure out what I'm doing wrong >> here. I've got a simple three table DB: >> >> Names: full_name, name_id >> has_many: >> Account: account_id, boxfolder_id, URL, comment >> has_one: >> Boxfolder: boxfolder_id, volume, folder, range Dagfinn> […] >> Now when I try to use DBIx::Class (inside a Dancer web app) I just >> can't make it work. My code looks like this: >> >> my $rs = $schema->resultset('Name')->search({ full_name => { like => $name >> }, }, >> { limit => 10, >> order_by => { -asc => 'full_name' }, >> prefetch => [ 'account', { 'account' => 'boxfolder'}], Dagfinn> This is not what you want, as that'll join twice to the account table, Dagfinn> and then from one of those instances to the boxfolder table. That's what I figured, esp when I got those errors. Looking at my system where I'm trying this, it's a Debian i686 running Wheezy, and the DBIx::Class::VERSION is > perl -e 'use DBIx::Class; print "$DBIx::Class::VERSION\n";' 0.08196 And the DBIx::Class stuff is: > dpkg-query -l | grep dbix ii libdbix-class-cursor-cached-perl 1.001002-1 all cursor object with built-in caching support ii libdbix-class-perl 0.08196-3 all extensible and flexible object <-> relational mapper ii libdbix-class-schema-loader-perl 0.07025-1 all module to automate definition of a DBIx::Class::Schema ii libdbix-contextualfetch-perl 1.03-3 all module to add context aware fetches to DBI Time to pull out CPAN and upgrade by hand. Should have tried this first. Let me go do that update, and then I'll see what happens when I have the prefetch set to just: prefetch => { 'account' => 'boxfolder' } Dagfinn> This is the correct one and should work. Can you run this with the Dagfinn> DBI_TRACE environment variable set to 1, and show us the full output? Thanks for the reminder, I'll send that info along too if version 0.082810 of DBIx::Class (and dependencies) doesn't work for me. Thanks! John _______________________________________________ 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]
