On 08/05/07, RA Jones <[EMAIL PROTECTED]> wrote:
Hi folks,
I have a large application with many db tables (nothing unusual there).
One of the requirements is to retrieve data across multiple tables. As
there is no obvious 'main' table to base the query on, I tried to create
a new schema (GetAll) not based on any table, along the lines described
in a patch to the DBIC Manual Cookbook (Arbitrary SQL through a custom
ResultSource - http://dev.catalyst.perl.org/trac/bast/changeset/3263).
It failed: Couldn't instantiate component "MyApp::Model::Schema",
"Cannot load schema class 'Schema': DBIx::Class::Schema::load_classes():
Can't locate object method "result_source_instance" via package
"Schema::GetAll" at line .... etc.
I haven't shown my code as I don't think this is the right way to go
about it. Basically I want the DBIC equivalent of:
select var1, var2, var3, var101, etc
from table1 a
left join table2 b on a.id = b.id
left join table3 c on a.id = c.id
etc
where a.var1 = 'foo' and c.var10 = 'bar'
It's probably easier than I imagine....
Should be as easy as this:
http://search.cpan.org/dist/DBIx-Class/lib/DBIx/Class/Manual/Cookbook.pod#Using_joins_and_prefetch
_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/