GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
DBIx::Class::CustomPrefetch(3) User Contributed Perl Documentation DBIx::Class::CustomPrefetch(3)

DBIx::Class::CustomPrefetch - Custom prefetches for DBIx::Class

DBIx::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.

Version 0.09

    package 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);

Makes IN relation. In can be has_one, might_have or many_to_many

Args: $relation_name, $resultset_callback, $condition

Andrey Kostenko, "<andrey at kostenko.name>"

Please 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.

You can find documentation for this module with the perldoc command.

    perldoc DBIx::Class::CustomPrefetch

You can also look for information at:

  • RT: CPAN's request tracker

    <http://rt.cpan.org/NoAuth/Bugs.html?Dist=DBIx-Class-CustomPrefetch>

  • AnnoCPAN: Annotated CPAN documentation

    <http://annocpan.org/dist/DBIx-Class-CustomPrefetch>

  • CPAN Ratings

    <http://cpanratings.perl.org/d/DBIx-Class-CustomPrefetch>

  • Search CPAN

    <http://search.cpan.org/dist/DBIx-Class-CustomPrefetch/>

Copyright 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.

2009-11-24 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.