|
NAMEDBIx::Class::CustomPrefetch - Custom prefetches for DBIx::ClassDESCRIPTIONDBIx::Class onle allows joins for prefetches. But sometimes you can't use JOIN for prefetch. E.g. for prefetching many related objects to resultset with paging.Also you can use this module to create cross-database prefetches. This module provides other logic for prefetching data to resultsets. VERSIONVersion 0.09SYNOPSISpackage MyApp::Schema::Foo; __PACKAGE__->load_components( qw(Core CustomPrefetch) ); __PACKAGE__->add_column( qw(id artist_id) ); __PACKAGE__->resultset_class( 'DBIx::Class::ResultSet::CustomPrefetch' ); __PACKAGE__->custom_relation( artist => sub { MyOtherResultSetClass->new } => { 'foreign.id' => 'self.artist_id' }); And your code: my $resultset = $schema->resultset('Foo')->search( undef, { rows => 10 } ); foreach ($resultset->all) { say $_->artist->name; } will make only two SQL requests: SELECT id, artist_id FROM foo LIMIT 10; SELECT * FROM artists WHERE id IN (1, 2, 3, 5, 8, 13, 21, 34, 55, 89); METHODScustom_relationMakes IN relation. In can be has_one, might_have or many_to_manyArgs: $relation_name, $resultset_callback, $condition AUTHORAndrey Kostenko, "<andrey at kostenko.name>"BUGSPlease report any bugs or feature requests to "bug-dbix-class-customprefetch at rt.cpan.org", or through the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=DBIx-Class-CustomPrefetch>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.SUPPORTYou can find documentation for this module with the perldoc command.perldoc DBIx::Class::CustomPrefetch You can also look for information at:
ACKNOWLEDGEMENTSCOPYRIGHT & LICENSECopyright 2009 Andrey Kostenko, all rights reserved.This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Visit the GSP FreeBSD Man Page Interface. |