From: Dan Dascalescu Date: Mon, 13 Jul 2009 12:06:08 +0000 (+0000) Subject: PK::Auto has moved into Core since 2007 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d56c319181b46e4f80d301d27d2f80e49751b460;hp=8bf37b16729d6f5e2bf5f583a91d6f032a27a1f4;p=dbsrgits%2FDBIx-Class-Historic.git PK::Auto has moved into Core since 2007 --- diff --git a/lib/DBIx/Class/Manual/Intro.pod b/lib/DBIx/Class/Manual/Intro.pod index 11911e7..928a565 100644 --- a/lib/DBIx/Class/Manual/Intro.pod +++ b/lib/DBIx/Class/Manual/Intro.pod @@ -11,7 +11,7 @@ better way? You've come to the right place. =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 @@ besides) The important thing to understand: =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 @@ results of: 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,12 +109,9 @@ Next, create each of the classes you want to load as specified above: 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: - - __PACKAGE__->load_components(qw/ PK::Auto Core /); +For example, if you want to force columns to use UTF-8 encoding: -C is supported for many databases; see L -for more information. + __PACKAGE__->load_components(qw/ ForceUTF8 Core /); Set the table for your class: @@ -142,7 +139,7 @@ of information that it may be useful to have -- just pass C a hash: is_auto_increment => 0, default_value => '', }, - title => + title => { data_type => 'varchar', size => 256, is_nullable => 0, @@ -273,7 +270,7 @@ To create a new record in the database, you can use the C method. It returns an instance of C 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' });