X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass.pm;h=f78aac8dd681001bc490a9b7435b7725798f992f;hb=eaefb953638f736ee8988251bf8cfc8bedad2563;hp=c8d1d2e8b2b9d4faccae6eec37eafd35a0868336;hpb=a0638a7bb719844a0d5c264265a3a13b18d3318f;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/lib/DBIx/Class.pm b/lib/DBIx/Class.pm index c8d1d2e..f78aac8 100644 --- a/lib/DBIx/Class.pm +++ b/lib/DBIx/Class.pm @@ -13,11 +13,12 @@ sub component_base_class { 'DBIx::Class' } # i.e. first release of 0.XX *must* be 0.XX000. This avoids fBSD ports # brain damage and presumably various other packaging systems too -$VERSION = '0.05999_04'; +$VERSION = '0.06000'; sub MODIFY_CODE_ATTRIBUTES { my ($class,$code,@attrs) = @_; - $class->mk_classdata('__attr_cache' => {}) unless $class->can('__attr_cache'); + $class->mk_classdata('__attr_cache' => {}) + unless $class->can('__attr_cache'); $class->__attr_cache->{$code} = [@attrs]; return (); } @@ -46,8 +47,7 @@ Create a base schema class called DB/Main.pm: 1; -Create a class the represent artists, who have many -CDs, in DB/Main/Artist.pm: +Create a class to represent artists, who have many CDs, in DB/Main/Artist.pm: package DB::Main::Artist; use base qw/DBIx::Class/; @@ -60,8 +60,7 @@ CDs, in DB/Main/Artist.pm: 1; -A class to represent a CD, which belongs to an -artist, in DB/Main/CD.pm: +A class to represent a CD, which belongs to an artist, in DB/Main/CD.pm: package DB::Main::CD; use base qw/DBIx::Class/; @@ -85,13 +84,13 @@ Then you can use these classes in your application's code: my $all_artists_rs = $ds->resultset('Artist'); # Create a result set to search for artists. - # This does not query the DB, yet. + # This does not query the DB. my $johns_rs = $ds->resultset('Artist')->search( # Build your WHERE using an SQL::Abstract structure: { 'name' => { 'like', 'John%' } } ); - # Now the query is executed. + # This executes a joined query to get the cds my @all_john_cds = $johns_rs->search_related('cds')->all; # Queries but only fetches one row so far. @@ -102,12 +101,12 @@ Then you can use these classes in your application's code: { order_by => 'title' } ); - my $millenium_cds_rs = $ds->resultset('CD')->search( + my $millennium_cds_rs = $ds->resultset('CD')->search( { year => 2000 }, { prefetch => 'artist' } ); - my $cd = $millenium_cds_rs->next; # SELECT ... FROM cds JOIN artists ... + my $cd = $millennium_cds_rs->next; # SELECT ... FROM cds JOIN artists ... my $cd_artist_name = $cd->artist->name; # Already has the data so no query my $new_cd = $ds->resultset('CD')->new({ title => 'Spoon' }); @@ -117,7 +116,7 @@ Then you can use these classes in your application's code: $ds->txn_do(sub { $new_cd->update }); # Runs the update in a transaction - $millenium_cds_rs->update({ year => 2002 }); # Single-query bulk update + $millennium_cds_rs->update({ year => 2002 }); # Single-query bulk update =head1 DESCRIPTION @@ -131,7 +130,7 @@ JOIN, LEFT JOIN, COUNT, DISTINCT, GROUP BY and HAVING support. DBIx::Class can handle multi-column primary and foreign keys, complex queries and database-level paging, and does its best to only query the -database when it actually needs to in order to return something the user's +database when it actually needs to in order to return something you've directly asked for. If a resultset is used as an iterator it only fetches rows off the statement handle as requested in order to minimise memory usage. It has auto-increment support for SQLite, MySQL, PostgreSQL, Oracle, SQL @@ -145,10 +144,11 @@ into trouble, and beware of anything explicitly marked EXPERIMENTAL. Failing test cases are *always* welcome and point releases are put out rapidly as bugs are found and fixed. -Even so, we do your best to maintain full backwards compatibility for published +Even so, we do our best to maintain full backwards compatibility for published APIs since DBIx::Class is used in production in a number of organisations; the test suite is now fairly substantial and several developer releases are -generally made to CPAN before the -current branch is merged back to trunk. +generally made to CPAN before the -current branch is merged back to trunk for +a major release. The community can be found via - @@ -186,59 +186,59 @@ The community can be found via - =head1 AUTHOR -Matt S. Trout +mst: Matt S. Trout =head1 CONTRIBUTORS -Alexander Hartmaier +abraxxa: Alexander Hartmaier -Andy Grundman +andyg: Andy Grundman -Andres Kievsky +ank: Andres Kievsky -Brandon Black +blblack: Brandon Black -Brian Cassidy +LTJake: Brian Cassidy -Christopher H. Laco +claco: Christopher H. Laco -CL Kao +clkao: CL Kao -Daisuke Murase +typester: Daisuke Murase -Dan Kubb +dkubb: Dan Kubb -Dan Sully +Numa: Dan Sully -Daniel Westermann-Clark +dwc: Daniel Westermann-Clark -David Kamholz +ningu: David Kamholz -Jesper Krogh +jesper: Jesper Krogh -Jess Robinson +castaway: Jess Robinson -Jules Bean +quicksilver: Jules Bean -Justin Guenther +jguenther: Justin Guenther -Marcus Ramberg +draven: Marcus Ramberg -Nigel Metheringham +nigel: Nigel Metheringham -Paul Makepeace +paulm: Paul Makepeace -Robert Sedlacek +phaylon: Robert Sedlacek -sc_ of irc.perl.org#dbix-class +sc_: Just Another Perl Hacker -Scott McWhirter (konobi) +konobi: Scott McWhirter -Scotty Allen +scotty: Scotty Allen Todd Lipcon -Will Hawes +wdh: Will Hawes =head1 LICENSE