[Bast-commits] r7166 - DBIx-Class/0.08/trunk/lib/DBIx
castaway at dev.catalyst.perl.org
castaway at dev.catalyst.perl.org
Sun Aug 2 10:41:26 GMT 2009
Author: castaway
Date: 2009-08-02 10:41:25 +0000 (Sun, 02 Aug 2009)
New Revision: 7166
Modified:
DBIx-Class/0.08/trunk/lib/DBIx/Class.pm
Log:
Mention ResultSet, ResultSource and Row in synopsis
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class.pm 2009-08-01 16:35:34 UTC (rev 7165)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class.pm 2009-08-02 10:41:25 UTC (rev 7166)
@@ -73,9 +73,11 @@
1;
-Create a table class to represent artists, who have many CDs, in
+Create a result class to represent artists, who have many CDs, in
MyDB/Schema/Result/Artist.pm:
+See L<DBIx::Class::ResultSource> for docs on defining result classes.
+
package MyDB::Schema::Result::Artist;
use base qw/DBIx::Class/;
@@ -87,7 +89,7 @@
1;
-A table class to represent a CD, which belongs to an artist, in
+A result class to represent a CD, which belongs to an artist, in
MyDB/Schema/Result/CD.pm:
package MyDB::Schema::Result::CD;
@@ -109,9 +111,17 @@
# Query for all artists and put them in an array,
# or retrieve them as a result set object.
+ # $schema->resultset returns a DBIx::Class::ResultSet
my @all_artists = $schema->resultset('Artist')->all;
my $all_artists_rs = $schema->resultset('Artist');
+ # Output all artists names
+ # $artist here is a DBIx::Class::Row, which has accessors
+ # for all its columns.
+ foreach $artist (@artists) {
+ print $artist->name, "\n";
+ }
+
# Create a result set to search for artists.
# This does not query the DB.
my $johns_rs = $schema->resultset('Artist')->search(
More information about the Bast-commits
mailing list