[Bast-commits] r7037 - DBIx-Class/0.08/trunk/lib/DBIx/Class/Manual
dandv at dev.catalyst.perl.org
dandv at dev.catalyst.perl.org
Mon Jul 13 12:06:09 GMT 2009
Author: dandv
Date: 2009-07-13 12:06:08 +0000 (Mon, 13 Jul 2009)
New Revision: 7037
Modified:
DBIx-Class/0.08/trunk/lib/DBIx/Class/Manual/Intro.pod
Log:
PK::Auto has moved into Core since 2007
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Manual/Intro.pod
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Manual/Intro.pod 2009-07-11 15:34:56 UTC (rev 7036)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Manual/Intro.pod 2009-07-13 12:06:08 UTC (rev 7037)
@@ -11,7 +11,7 @@
=head1 THE DBIx::Class WAY
Here are a few simple tips that will help you get your bearings with
-DBIx::Class.
+DBIx::Class.
=head2 Tables become Result classes
@@ -29,7 +29,7 @@
=head2 It's all about the ResultSet
So, we've got some ResultSources defined. Now, we want to actually use those
-definitions to help us translate the queries we need into handy perl objects!
+definitions to help us translate the queries we need into handy perl objects!
Let's say we defined a ResultSource for an "album" table with three columns:
"albumid", "artist", and "title". Any time we want to query this table, we'll
@@ -39,18 +39,18 @@
SELECT albumid, artist, title FROM album;
Would be retrieved by creating a ResultSet object from the album table's
-ResultSource, likely by using the "search" method.
+ResultSource, likely by using the "search" method.
DBIx::Class doesn't limit you to creating only simple ResultSets -- if you
wanted to do something like:
SELECT title FROM album GROUP BY title;
-You could easily achieve it.
+You could easily achieve it.
-The important thing to understand:
+The important thing to understand:
- Any time you would reach for a SQL query in DBI, you are
+ Any time you would reach for a SQL query in DBI, you are
creating a DBIx::Class::ResultSet.
=head2 Search is like "prepare"
@@ -109,13 +109,10 @@
Load any components required by each class with the load_components() method.
This should consist of "Core" plus any additional components you want to use.
-For example, if you want serial/auto-incrementing primary keys:
+For example, if you want to force columns to use UTF-8 encoding:
- __PACKAGE__->load_components(qw/ PK::Auto Core /);
+ __PACKAGE__->load_components(qw/ ForceUTF8 Core /);
-C<PK::Auto> is supported for many databases; see L<DBIx::Class::Storage::DBI>
-for more information.
-
Set the table for your class:
__PACKAGE__->table('album');
@@ -142,7 +139,7 @@
is_auto_increment => 0,
default_value => '',
},
- title =>
+ title =>
{ data_type => 'varchar',
size => 256,
is_nullable => 0,
@@ -273,7 +270,7 @@
returns an instance of C<My::Schema::Result::Album> that can be used to access the data
in the new record:
- my $new_album = $schema->resultset('Album')->create({
+ my $new_album = $schema->resultset('Album')->create({
title => 'Wish You Were Here',
artist => 'Pink Floyd'
});
More information about the Bast-commits
mailing list