doc tweaks, failing test from jcs
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Manual / SchemaIntro.pod
index 8bd928f..1e6707e 100644 (file)
@@ -15,7 +15,7 @@ L<DBIx::Class::Schema>:
   package My::Schema;
   use base qw/DBIx::Class::Schema/;
 
-In this class you load your resultsource ("table", "model") classes, which
+In this class you load your result_source ("table", "model") classes, which
 we will define later, using the load_classes() method. You can specify which
 classes to load manually: 
 
@@ -27,8 +27,8 @@ Or load classes by namespace:
   # load My::Schema::Album, My::Schema::Artist and My::OtherSchema::LinerNotes
   __PACKAGE__->load_classes(
     {
-      'My::Schema' => qw/ Album Artist /,
-      'My::OtherSchema' => qw/ LinerNotes /
+      'My::Schema' => [qw/ Album Artist /],
+      'My::OtherSchema' => [qw/ LinerNotes /]
     }
   );
 
@@ -70,6 +70,8 @@ If you have a multi-column primary key, just pass a list instead:
 
   __PACKAGE__->set_primary_key( qw/ albumid artistid / );
 
+=begin hide
+
 You can define relationships for any of your classes. L<DBIx::Class> will
 automatically fill in the correct namespace, so if you want to say
 "a My::Schema::Album object belongs to a My::Schema::Artist object" you do not
@@ -77,6 +79,8 @@ need to include the namespace when declaring the relationship:
 
   __PACKAGE__->belongs_to('artist' => 'Artist');
 
+=end hide
+
 That's all you need in terms of setup.
 
 =head2 Usage
@@ -93,6 +97,10 @@ a second database you want to access:
 Note that L<DBIx::Class::Schema> does not cache connnections for you. If you
 use multiple connections, you need to do this manually.
 
+To execute some sql statements on every connect you can pass them to your schema after the connect:
+
+  $schema->storage->on_connect_do(\@on_connect_sql_statments);
+
 The simplest way to get a record is by primary key:
 
   my $schema = My::Schema->connect( ... );
@@ -102,7 +110,7 @@ This will run a C<SELECT> with C<albumid = 14> in the C<WHERE> clause,
 and return an instance of C<My::Schema::Album> that represents this
 row. Once you have that row, you can access and update columns:
 
-  $album->name('Physical Graffiti');
+  $album->title('Physical Graffiti');
   my $title = $album->title; # holds 'Physical Graffiti'
 
 If you prefer, you can use the C<set_column> and C<get_column>
@@ -143,11 +151,11 @@ Likewise, you can remove it from the database like this:
 
   $new_album->delete;
 
-You can also remove records without or retrieving first.  This
-operation takes the same kind of arguments as a search.
+You can also remove records without retrieving them first, by calling
+delete directly on a ResultSet object.
 
   # Delete all of Falco's albums
-  $schema->resultset('Album')->delete({ artist => 'Falco' });
+  $schema->resultset('Album')->search({ artist => 'Falco' })->delete;
 
 =head2 Finding your objects
 
@@ -189,7 +197,7 @@ rows:
 We also provide a handy shortcut for doing a C<LIKE> search:
 
   # Find albums whose artist starts with 'Jimi'
-  my $rs = MyApp::DB::Album->search_like({ artist => 'Jimi%' });
+  my $rs = $schema->resultset('Album')->search_like({ artist => 'Jimi%' });
 
 Or you can provide your own handmade C<WHERE> clause, like: