DBIx::Class::Manual::Cookbook 0.08001
Sponsored Links
DBIx::Class::Manual::Cookbook 0.08001 Ranking & Summary
File size:
0.28 MB
Platform:
Any Platform
License:
Perl Artistic License
Price:
Downloads:
860
Date added:
2007-06-19
Publisher:
Matt S. Trout
DBIx::Class::Manual::Cookbook 0.08001 description
DBIx::Class::Manual::Cookbook is a Perl module that contains miscellaneous recipes.
Paged results
When you expect a large number of results, you can ask DBIx::Class for a paged resultset, which will fetch only a small number of records at a time:
my $rs = $schema->resultset(Artist)->search(
undef,
{
page => 1, # page to return (defaults to 1)
rows => 10, # number of results per page
},
);
return $rs->all(); # all records for page 1
The page attribute does not have to be specified in your search:
my $rs = $schema->resultset(Artist)->search(
undef,
{
rows => 10,
}
);
return $rs->page(1); # DBIx::Class::ResultSet containing first 10 records
In either of the above cases, you can return a Data::Page object for the resultset (suitable for use in e.g. a template) using the pager method:
return $rs->pager();
Complex WHERE clauses
Sometimes you need to formulate a query using specific operators:
my @albums = $schema->resultset(Album)->search({
artist => { like, %Lamb% },
title => { like, %Fear of Fours% },
});
This results in something like the following WHERE clause:
WHERE artist LIKE %Lamb% AND title LIKE %Fear of Fours%
Other queries might require slightly more complex logic:
my @albums = $schema->resultset(Album)->search({
-or => [
-and => [
artist => { like, %Smashing Pumpkins% },
title => Siamese Dream,
],
artist => Starchildren,
],
});
This results in the following WHERE clause:
WHERE ( artist LIKE %Smashing Pumpkins% AND title = Siamese Dream )
OR artist = Starchildren
For more information on generating complex queries, see "WHERE CLAUSES" in SQL::Abstract.
Paged results
When you expect a large number of results, you can ask DBIx::Class for a paged resultset, which will fetch only a small number of records at a time:
my $rs = $schema->resultset(Artist)->search(
undef,
{
page => 1, # page to return (defaults to 1)
rows => 10, # number of results per page
},
);
return $rs->all(); # all records for page 1
The page attribute does not have to be specified in your search:
my $rs = $schema->resultset(Artist)->search(
undef,
{
rows => 10,
}
);
return $rs->page(1); # DBIx::Class::ResultSet containing first 10 records
In either of the above cases, you can return a Data::Page object for the resultset (suitable for use in e.g. a template) using the pager method:
return $rs->pager();
Complex WHERE clauses
Sometimes you need to formulate a query using specific operators:
my @albums = $schema->resultset(Album)->search({
artist => { like, %Lamb% },
title => { like, %Fear of Fours% },
});
This results in something like the following WHERE clause:
WHERE artist LIKE %Lamb% AND title LIKE %Fear of Fours%
Other queries might require slightly more complex logic:
my @albums = $schema->resultset(Album)->search({
-or => [
-and => [
artist => { like, %Smashing Pumpkins% },
title => Siamese Dream,
],
artist => Starchildren,
],
});
This results in the following WHERE clause:
WHERE ( artist LIKE %Smashing Pumpkins% AND title = Siamese Dream )
OR artist = Starchildren
For more information on generating complex queries, see "WHERE CLAUSES" in SQL::Abstract.
DBIx::Class::Manual::Cookbook 0.08001 Screenshot
Advertisements
DBIx::Class::Manual::Cookbook 0.08001 Keywords
DBIx
Cookbook 0.08001
Perl module
artist
page
resultset
return
results
search
DBIx::Class::Manual::Cookbook
DBIxClassManualCookbook
DBIx::Class::Manual::Cookbook 0.08001
Libraries
Programming
Bookmark DBIx::Class::Manual::Cookbook 0.08001
DBIx::Class::Manual::Cookbook 0.08001 Copyright
WareSeeker periodically updates pricing and software information of DBIx::Class::Manual::Cookbook 0.08001 full version from the publisher, so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of DBIx::Class::Manual::Cookbook 0.08001 Edition. Download links are directly from our publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed
Featured Software
Want to place your software product here?
Please contact us for consideration.
Contact WareSeeker.com
Related Information
Related Software
Catalyst::Manual::Cookbook is a Perl module for cooking with Catalyst. Free Download
DBIx::DBStag::Cookbook is a Perl module for building and querying databases from XML. Free Download
Maypole::Manual::Cookbook is a Perl module for Maypole Cookbook. Free Download
DBIx::Class::FormTools is a utility module for building forms with multiple related DBIx::Class objects. Free Download
DBIx::Class::CDBICompat is a Class::DBI Compatibility layer. Free Download
DBIx::Class::LibXMLdoc is a Perl module to create an adjunct "Doc" accessor of a columns data. Free Download
DBIx:DataLookup 0.03 is designed as a useful tool which can help you easily both cache records pulled by an SQL statement from a database in the memory as well as look them up later at any time during execution of your script. Free Download
DBIx::Class::Schema::Loader::RelBuilder is a Perl module that builds relationships for DBIx::Class::Schema::Loader. Free Download
Latest Software
Popular Software
Favourite Software