fix insert_bulk when not using bulk api inside a txn
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Manual / Intro.pod
index ce9d3c4..fa33614 100644 (file)
@@ -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<PK::Auto> is supported for many databases; see L<DBIx::Class::Storage::DBI>
-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<add_columns> a hash:
                               is_auto_increment => 0,
                               default_value => '',
                             },
-                          title  => 
+                          title  =>
                             { data_type => 'varchar',
                               size      => 256,
                               is_nullable => 0,
@@ -176,7 +173,8 @@ to describe a column which contains an ID of another Table, or C<has_many> to
 make a predefined accessor for fetching objects that contain this Table's
 foreign key:
 
-  __PACKAGE__->has_many('albums', 'My::Schema::Result::Artist', 'album_id');
+  # in My::Schema::Result::Artist
+  __PACKAGE__->has_many('albums', 'My::Schema::Result::Album', 'artist');
 
 See L<DBIx::Class::Relationship> for more information about the various types of
 available relationships and how you can design your own.
@@ -202,8 +200,12 @@ many options.
 
 =head2 Connecting
 
-To connect to your Schema, you need to provide the connection details.  The
-arguments are the same as for L<DBI/connect>:
+To connect to your Schema, you need to provide the connection details or a
+database handle.
+
+=head3 Via connection details
+
+The arguments are the same as for L<DBI/connect>:
 
   my $schema = My::Schema->connect('dbi:SQLite:/home/me/myapp/my.db');
 
@@ -229,6 +231,16 @@ a special fifth argument to connect:
 See L<DBIx::Class::Schema::Storage::DBI/connect_info> for more information about
 this and other special C<connect>-time options.
 
+=head3 Via a database handle
+
+The supplied coderef is expected to return a single connected database handle
+(e.g. a L<DBI> C<$dbh>)
+
+  my $schema = My::Schema->connect (
+    sub { Some::DBH::Factory->connect },
+    \%extra_attrs,
+  );
+
 =head2 Basic usage
 
 Once you've defined the basic classes, either manually or using
@@ -255,8 +267,8 @@ instead:
   $album->set_column('title', 'Presence');
   $title = $album->get_column('title');
 
-Just like with L<Class::DBI>, you call C<update> to commit your changes to the
-database:
+Just like with L<Class::DBI>, you call C<update> to save your changes to the
+database (by executing the actual C<UPDATE> statement):
 
   $album->update;
 
@@ -273,7 +285,7 @@ To create a new record in the database, you can use the C<create> method.  It
 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'
   });
@@ -379,13 +391,9 @@ L<DBIx::Class::ResultSet/ATTRIBUTES>.
 
 =head2 Problems on RHEL5/CentOS5
 
-There is a problem with slow performance of certain DBIx::Class
-operations in perl-5.8.8-10 and later on RedHat and related systems, due
-to a bad backport of a "use overload" related bug. The problem is in the
-Perl binary itself, not in DBIx::Class. If your system might suffer this
-problem, you will see a warning on startup, with some options as to what
-to do about it. This problem was eliminated in the perl-5.8.8-15.el5_2.1
-package which was issued in September 2008.
+There used to be an issue with the system perl on Red Hat Enterprise
+Linux 5, some versions of Fedora and derived systems. Further
+information on this can be found in L<DBIx::Class::Manual::Troubleshooting>
 
 =head1 SEE ALSO