[Bast-commits] r3693 - in DBIx-Class/0.08/branches/cdbicompat_integration: . lib/DBIx lib/DBIx/Class lib/DBIx/Class/InflateColumn lib/DBIx/Class/Manual lib/DBIx/Class/Schema lib/DBIx/Class/Storage lib/DBIx/Class/Storage/DBI t

matthewt at dev.catalyst.perl.org matthewt at dev.catalyst.perl.org
Tue Aug 21 19:09:22 GMT 2007


Author: matthewt
Date: 2007-08-21 19:09:21 +0100 (Tue, 21 Aug 2007)
New Revision: 3693

Modified:
   DBIx-Class/0.08/branches/cdbicompat_integration/
   DBIx-Class/0.08/branches/cdbicompat_integration/Changes
   DBIx-Class/0.08/branches/cdbicompat_integration/Makefile.PL
   DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class.pm
   DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/AccessorGroup.pm
   DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Componentised.pm
   DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/InflateColumn/DateTime.pm
   DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Manual/Cookbook.pod
   DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Manual/FAQ.pod
   DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Manual/Intro.pod
   DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/ResultSet.pm
   DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/ResultSource.pm
   DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Row.pm
   DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Schema.pm
   DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Schema/Versioned.pm
   DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Storage.pm
   DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Storage/DBI.pm
   DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Storage/DBI/Cursor.pm
   DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Storage/DBI/SQLite.pm
   DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Storage/Statistics.pm
   DBIx-Class/0.08/branches/cdbicompat_integration/t/03podcoverage.t
   DBIx-Class/0.08/branches/cdbicompat_integration/t/05components.t
   DBIx-Class/0.08/branches/cdbicompat_integration/t/33storage_reconnect.t
   DBIx-Class/0.08/branches/cdbicompat_integration/t/50fork.t
   DBIx-Class/0.08/branches/cdbicompat_integration/t/67pager.t
   DBIx-Class/0.08/branches/cdbicompat_integration/t/91debug.t
Log:
 r10454 at jules (orig r3634):  matthewt | 2007-07-29 22:01:45 +0100
 updated svn and list URLs
 r10462 at jules (orig r3642):  matthewt | 2007-08-03 19:52:16 +0100
 optimisation in cursor
 r10463 at jules (orig r3643):  matthewt | 2007-08-03 22:01:49 +0100
 add default_resultset_attributes entry to Schema
 r10464 at jules (orig r3644):  matthewt | 2007-08-04 17:44:46 +0100
 cleanup cursor class handling
 r10465 at jules (orig r3645):  ash | 2007-08-04 18:30:14 +0100
 Fix example code. Thanks bits
 r10466 at jules (orig r3646):  matthewt | 2007-08-05 15:41:51 +0100
 add cursor_class to storage opt list
 r10470 at jules (orig r3650):  matthewt | 2007-08-06 20:10:08 +0100
 typo pointed out by kangas
 r10471 at jules (orig r3651):  matthewt | 2007-08-06 20:36:27 +0100
 final changes for 08004 dist
 r10472 at jules (orig r3652):  gphat | 2007-08-07 14:07:06 +0100
 Refactor Statistics to clean up printing of debug info and to avoid crashing on
 a closed STDERR...
 
 r10473 at jules (orig r3653):  captainL | 2007-08-07 15:11:18 +0100
 fixed storage->connected fork bug
 r10474 at jules (orig r3654):  matthewt | 2007-08-07 15:45:46 +0100
 fix for AccessorGroup
 r10475 at jules (orig r3655):  aherzog | 2007-08-07 16:25:28 +0100
 Add myself to contributors list.
 
 r10476 at jules (orig r3656):  aherzog | 2007-08-07 16:26:32 +0100
 Fix reconnect tests to skip tests that won't pass (when run as root, or under windows).
 
 r10477 at jules (orig r3657):  aherzog | 2007-08-07 19:50:59 +0100
 Fix bind params debugging output; consolidate some related, duplicated code.
 
 r10478 at jules (orig r3658):  aherzog | 2007-08-07 21:07:43 +0100
 Autoflush debugging, to make sure statement is printed when we test for it.
 
 r10480 at jules (orig r3660):  matthewt | 2007-08-08 11:35:26 +0100
 rejig resultset construction for related_resultset
 r10481 at jules (orig r3661):  matthewt | 2007-08-08 11:38:39 +0100
 bump sqlite dep
 r10482 at jules (orig r3662):  matthewt | 2007-08-08 11:47:39 +0100
 timestamp+pg fix
 r10484 at jules (orig r3664):  tomboh | 2007-08-08 13:52:58 +0100
 Mention the SVN::Web Web interface to the repository
 
 r10485 at jules (orig r3665):  matthewt | 2007-08-08 14:32:58 +0100
 make pod cov not skip if author side, fix exception list
 r10486 at jules (orig r3666):  tomboh | 2007-08-10 12:06:35 +0100
 Fix package names in documentation
 
 r10487 at jules (orig r3667):  castaway | 2007-08-10 14:05:24 +0100
 Manual improvements from apeiron
 
 r10488 at jules (orig r3668):  ash | 2007-08-11 22:46:59 +0100
 Remove warn statement
 r10490 at jules (orig r3670):  ash | 2007-08-11 23:27:07 +0100
 Move to using Class::C3::Componentised
 r10491 at jules (orig r3671):  matthewt | 2007-08-12 15:04:27 +0100
 missed commit of version inc
 r10492 at jules (orig r3672):  castaway | 2007-08-12 15:27:38 +0100
 Documentation: cookbook, resultset/create and some other bits
 
 r10493 at jules (orig r3673):  ash | 2007-08-12 15:49:59 +0100
 Prepare for new dist
 r10495 at jules (orig r3674):  tomboh | 2007-08-13 10:42:16 +0100
 Fix a package name I corrected wrongly in revision 3666.
 
 r11158 at jules (orig r3684):  jnapiorkowski | 2007-08-16 16:23:18 +0100
 -- added some documentation to ->populate to warn people about the side effects of using wantarray versus void context.
 -- added some additional documentation to resultset->create
 



Property changes on: DBIx-Class/0.08/branches/cdbicompat_integration
___________________________________________________________________
Name: svk:merge
   - 168d5346-440b-0410-b799-f706be625ff1:/DBIx-Class-current:2207
462d4d0c-b505-0410-bf8e-ce8f877b3390:/local/bast/DBIx-Class:3159
9c88509d-e914-0410-b01c-b9530614cbfe:/local/DBIx-Class:32260
9c88509d-e914-0410-b01c-b9530614cbfe:/local/DBIx-Class-CDBICompat:32708
9c88509d-e914-0410-b01c-b9530614cbfe:/vendor/DBIx-Class:31122
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/trunk:3607
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-C3:318
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-current:2222
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-joins:173
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-resultset:570
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/datetime:1716
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/find_compat:1855
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/find_unique_query_fixes:2142
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/inflate:1988
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/many_to_many:2025
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/re_refactor_bugfix:1944
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/reorganize_tests:1827
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/resultset-new-refactor:1766
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/resultset_2_electric_boogaloo:2175
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/resultset_cleanup:2102
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/sqlt_tests_refactor:2043
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/trunk/DBIx-Class:3606
   + 168d5346-440b-0410-b799-f706be625ff1:/DBIx-Class-current:2207
462d4d0c-b505-0410-bf8e-ce8f877b3390:/local/bast/DBIx-Class:3159
9c88509d-e914-0410-b01c-b9530614cbfe:/local/DBIx-Class:32260
9c88509d-e914-0410-b01c-b9530614cbfe:/local/DBIx-Class-CDBICompat:32708
9c88509d-e914-0410-b01c-b9530614cbfe:/vendor/DBIx-Class:31122
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/trunk:3684
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-C3:318
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-current:2222
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-joins:173
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class-resultset:570
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/datetime:1716
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/find_compat:1855
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/find_unique_query_fixes:2142
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/inflate:1988
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/many_to_many:2025
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/re_refactor_bugfix:1944
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/reorganize_tests:1827
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/resultset-new-refactor:1766
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/resultset_2_electric_boogaloo:2175
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/resultset_cleanup:2102
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/branches/DBIx-Class/sqlt_tests_refactor:2043
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/trunk/DBIx-Class:3606

Modified: DBIx-Class/0.08/branches/cdbicompat_integration/Changes
===================================================================
--- DBIx-Class/0.08/branches/cdbicompat_integration/Changes	2007-08-21 16:58:17 UTC (rev 3692)
+++ DBIx-Class/0.08/branches/cdbicompat_integration/Changes	2007-08-21 18:09:21 UTC (rev 3693)
@@ -1,4 +1,30 @@
 Revision history for DBIx::Class
+
+0.08006 2007-08-12 15:12:00
+        - Move to using Class::C3::Componentised
+        - Remove warn statement from DBIx::Class::Row
+
+0.08005 2007-08-06 
+        - add timestamp fix re rt.cpan 26978 - no test yet but change
+          clearly should cause no regressions
+        - provide alias for related_resultset via local() so it's set
+          correctly at resultset construction time (fixes RestrictWithObject)
+        - fixes bind params in debug statements
+          (original test from abraxxa)
+        - fixed storage->connected fork bug
+          (test and fix from Radu Greab)
+        - add 1; to AccessorGroup.pm for stuff that still uses it
+        - refactor Statistics to create debugging filehandle to fix bug with
+          closed STDERR, update docs and modify Versioned to use Statistics
+          (original fix from diz)
+
+0.08004 2007-08-06 19:00:00
+        - fix storage connect code to not trigger bug via auto-viv 
+          (test from aherzog)
+        - fixup cursor_class to be an 'inherited' attr for per-package defaults
+        - add default_resultset_attributes entry to Schema
+        - optimisation in DBI::Cursor to check software_limit before falling
+          back to base Cursor->all
         - fix bug with create_multi not inserting non-storage objects
           (test and fix from davinchi)
         - DBIx::Class::AccessorGroup made empty subclass of

Modified: DBIx-Class/0.08/branches/cdbicompat_integration/Makefile.PL
===================================================================
--- DBIx-Class/0.08/branches/cdbicompat_integration/Makefile.PL	2007-08-21 16:58:17 UTC (rev 3692)
+++ DBIx-Class/0.08/branches/cdbicompat_integration/Makefile.PL	2007-08-21 18:09:21 UTC (rev 3693)
@@ -9,6 +9,7 @@
 requires 'SQL::Abstract'             => 1.20;
 requires 'SQL::Abstract::Limit'      => 0.101;
 requires 'Class::C3'                 => 0.13;
+requires 'Class::C3::Componentised'  => 0;
 requires 'Storable'                  => 0;
 requires 'Carp::Clan'                => 0;
 requires 'DBI'                       => 1.40;

Modified: DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/AccessorGroup.pm
===================================================================
--- DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/AccessorGroup.pm	2007-08-21 16:58:17 UTC (rev 3692)
+++ DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/AccessorGroup.pm	2007-08-21 18:09:21 UTC (rev 3693)
@@ -5,6 +5,8 @@
 
 use base qw/Class::Accessor::Grouped/;
 
+1;
+
 =head1 NAME
 
 DBIx::Class::AccessorGroup - See Class::Accessor::Grouped

Modified: DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Componentised.pm
===================================================================
--- DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Componentised.pm	2007-08-21 16:58:17 UTC (rev 3692)
+++ DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Componentised.pm	2007-08-21 18:09:21 UTC (rev 3693)
@@ -4,8 +4,7 @@
 use strict;
 use warnings;
 
-use Class::C3;
-use Class::Inspector;
+use base 'Class::C3::Componentised';
 use Carp::Clan qw/^DBIx::Class/;
 
 sub inject_base {
@@ -29,68 +28,9 @@
     }
   }
 
-  # Yes, this is hack. But it *does* work. Please don't submit tickets about
-  # it on the basis of the comments in Class::C3, the author was on #dbix-class
-  # while I was implementing this.
-
-  eval "package $target; import Class::C3;" unless exists $Class::C3::MRO{$target};
+  $class->next::method($target, @to_inject);
 }
 
-sub load_components {
-  my $class = shift;
-  my $base = $class->component_base_class;
-  my @comp = map { /^\+(.*)$/ ? $1 : "${base}::$_" } grep { $_ !~ /^#/ } @_;
-  $class->_load_components(@comp);
-  Class::C3::reinitialize();
-}
-
-sub load_own_components {
-  my $class = shift;
-  my @comp = map { "${class}::$_" } grep { $_ !~ /^#/ } @_;
-  $class->_load_components(@comp);
-}
-
-sub _load_components {
-  my ($class, @comp) = @_;
-  foreach my $comp (@comp) {
-    $class->ensure_class_loaded($comp);
-  }
-  $class->inject_base($class => @comp);
-}
-
-# Given a class name, tests to see if it is already loaded or otherwise
-# defined. If it is not yet loaded, the package is require'd, and an exception
-# is thrown if the class is still not loaded.
-#
-# TODO: handle ->has_many('rel', 'Class'...) instead of
-#              ->has_many('rel', 'Some::Schema::Class'...)
-#
-# BUG: For some reason, packages with syntax errors are added to %INC on
-#      require
-sub ensure_class_loaded {
-  my ($class, $f_class) = @_;
-
-  croak "Invalid class name $f_class"
-      if ($f_class=~m/(?:\b:\b|\:{3,})/);
-  return if Class::Inspector->loaded($f_class);
-  eval "require $f_class"; # require needs a bareword or filename
-  if ($@) {
-    if ($class->can('throw_exception')) {
-      $class->throw_exception($@);
-    } else {
-      croak $@;
-    }
-  }
-}
-
-# Returns true if the specified class is installed or already loaded, false
-# otherwise
-sub ensure_class_found {
-  my ($class, $f_class) = @_;
-  return Class::Inspector->loaded($f_class) ||
-         Class::Inspector->installed($f_class);
-}
-
 # Returns a true value if the specified class is installed and loaded
 # successfully, throws an exception if the class is found but not loaded
 # successfully, and false if the class is not installed

Modified: DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/InflateColumn/DateTime.pm
===================================================================
--- DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/InflateColumn/DateTime.pm	2007-08-21 16:58:17 UTC (rev 3692)
+++ DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/InflateColumn/DateTime.pm	2007-08-21 18:09:21 UTC (rev 3693)
@@ -54,7 +54,7 @@
   $self->next::method($column, $info, @rest);
   return unless defined($info->{data_type});
   my $type = lc($info->{data_type});
-  $type = 'datetime' if ($type eq 'timestamp');
+  $type = 'datetime' if ($type =~ /^timestamp/);
   if ($type eq 'datetime' || $type eq 'date') {
     my ($parse, $format) = ("parse_${type}", "format_${type}");
     $self->inflate_column(

Modified: DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Manual/Cookbook.pod
===================================================================
--- DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Manual/Cookbook.pod	2007-08-21 16:58:17 UTC (rev 3692)
+++ DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Manual/Cookbook.pod	2007-08-21 18:09:21 UTC (rev 3693)
@@ -9,7 +9,7 @@
 =head3 Paged results
 
 When you expect a large number of results, you can ask L<DBIx::Class> for a
-paged resultset, which will fetch only a small number of records at a time:
+paged resultset, which will fetch only a defined number of records at a time:
 
   my $rs = $schema->resultset('Artist')->search(
     undef,
@@ -32,7 +32,7 @@
 
   return $rs->page(1); # DBIx::Class::ResultSet containing first 10 records
 
-In either of the above cases, you can return a L<Data::Page> object for the
+In either of the above cases, you can get a L<Data::Page> object for the
 resultset (suitable for use in e.g. a template) using the C<pager> method:
 
   return $rs->pager();
@@ -294,7 +294,7 @@
       join     => [qw/ artist /],
       order_by => [qw/ artist.name /]
     }
-  };
+  );
 
   # Equivalent SQL:
   # SELECT cd.* FROM cd
@@ -668,26 +668,51 @@
 
 =head2 Schema import/export
 
-This functionality requires you to have L<SQL::Translator> (also known as
-"SQL Fairy") installed.
+To create a DBIx::Class schema from an existing database, use
+L<DBIx::Class::Schema::Loader>'s C<make_schema_at>:
 
-To create a DBIx::Class schema from an existing database:
+  perl -MDBIx::Class::Schema::Loader=make_schema_at,dump_to_dir:./lib -e 'make_schema_at("My::Schema", { debug => 1 }, [ "dbi:Pg:dbname=foo","postgres" ])'
 
- sqlt --from DBI
-      --to DBIx::Class::File
-      --prefix "MySchema" > MySchema.pm
+The following functionality requires you to have L<SQL::Translator>
+(also known as "SQL Fairy") installed.
 
-To create a MySQL database from an existing L<DBIx::Class> schema, convert the
-schema to MySQL's dialect of SQL:
+To create a set of database-specific .sql files for the above schema:
 
-  sqlt --from SQL::Translator::Parser::DBIx::Class 
-       --to MySQL 
-       --DBIx::Class "MySchema.pm" > Schema1.sql
-  
-And import using the mysql client:
+ my $schema = My::Schema->connect($dsn);
+ $schema->create_ddl_dir(['MySQL', 'SQLite', 'PostgreSQL'],
+                        '0.1',
+                        '/dbscriptdir/'
+                        );
 
-  mysql -h "host" -D "database" -u "user" -p < Schema1.sql
+By default this will create schema files in the current directory, for
+MySQL, SQLite and PostgreSQL, using the $VERSION from your Schema.pm.
 
+To create a new database using the schema:
+
+ my $schema = My::Schema->connect($dsn);
+ $schema->deploy({ add_drop_tables => 1});
+
+To import created .sql files using the mysql client:
+
+  mysql -h "host" -D "database" -u "user" -p < My_Schema_1.0_MySQL.sql
+
+To create C<ALTER TABLE> conversion scripts to update a database to a
+newer version of your schema at a later point, first set a new
+$VERSION in your Schema file, then:
+
+ my $schema = My::Schema->connect($dsn);
+ $schema->create_ddl_dir(['MySQL', 'SQLite', 'PostgreSQL'],
+                         '0.2',
+                         '/dbscriptdir/',
+                         '0.1'
+                         );
+
+This will produce new database-specific .sql files for the new version
+of the schema, plus scripts to convert from version 0.1 to 0.2. This
+requires that the files for 0.1 as created above are available in the
+given directory to diff against.
+
+
 =head2 Easy migration from class-based to schema-based setup
 
 You want to start using the schema-based approach to L<DBIx::Class>
@@ -762,20 +787,9 @@
 
 =head3 Save the schema
 
-Use C<sqlt> to transform your schema into an SQL script suitable for your
-customer's database. E.g. for MySQL:
+Call L<DBIx::Class::Schema/create_ddl_dir> as above under L<Schema
+import/export>.
 
-  sqlt --from SQL::Translator::Parser::DBIx::Class
-       --to MySQL
-       --DBIx::Class "MySchema.pm" > Schema1.mysql.sql
-
-If you need to target databases from multiple vendors, just generate an SQL
-script suitable for each. To support PostgreSQL too:
-
-  sqlt --from SQL::Translator::DBIx::Class
-       --to PostgreSQL
-       --DBIx::Class "MySchema.pm" > Schema1.pgsql.sql
-
 =head3 Deploy to customers
 
 There are several ways you could deploy your schema. These are probably
@@ -796,23 +810,22 @@
 
 =head3 Modify the schema to change functionality
 
-As your application evolves, it may be necessary to modify your schema to
-change functionality. Once the changes are made to your schema in DBIx::Class,
-export the modified schema as before, taking care not to overwrite the original:
+As your application evolves, it may be necessary to modify your schema
+to change functionality. Once the changes are made to your schema in
+DBIx::Class, export the modified schema and the conversion scripts as
+in L<Schema import/export>.
 
-  sqlt --from SQL::Translator::DBIx::Class
-       --to MySQL
-       --DBIx::Class "Anything.pm" > Schema2.mysql.sql
+=head3 Deploy update to customers
 
-Next, use sqlt-diff to create an SQL script that will update the customer's
-database schema:
+Add the L<DBIx::Class::Schema::Versioned> schema component to your
+Schema class. This will add a new table to your database called
+C<SchemaVersions> which will keep track of which version is installed
+and warn if the user trys to run a newer schema version than the
+database thinks it has.
 
-  sqlt-diff --to MySQL Schema1=MySQL Schema2=MySQL > SchemaUpdate.mysql.sql
+Alternatively, you can send the conversion sql scripts to your
+customers as above.
 
-=head3 Deploy update to customers
-
-The schema update can be deployed to customers using the same method as before.
-
 =head2 Setting limit dialect for SQL::Abstract::Limit
 
 In some cases, SQL::Abstract::Limit cannot determine the dialect of
@@ -964,7 +977,7 @@
     my $sql = shift();
     my $params = @_;
 
-    print "Executing $sql: ".join(', ', @params)."\n";
+    $self->print("Executing $sql: ".join(', ', @params)."\n");
     $start = time();
   }
 
@@ -973,7 +986,8 @@
     my $sql = shift();
     my @params = @_;
 
-    printf("Execution took %0.4f seconds.\n", time() - $start);
+    my $elapsed = sprintf("%0.4f", time() - $start);
+    $self->print("Execution took $elapsed seconds.\n");
     $start = undef;
   }
 
@@ -981,8 +995,8 @@
 
 You can then install that class as the debugging object:
 
-  __PACKAGE__->storage()->debugobj(new My::Profiler());
-  __PACKAGE__->storage()->debug(1);
+  __PACKAGE__->storage->debugobj(new My::Profiler());
+  __PACKAGE__->storage->debug(1);
 
 A more complicated example might involve storing each execution of SQL in an
 array:
@@ -1001,6 +1015,7 @@
 
 You could then create average, high and low execution times for an SQL
 statement and dig down to see if certain parameters cause aberrant behavior.
+You might want to check out L<DBIx::Class::QueryLog> as well.
 
 =head2 Getting the value of the primary key for the last database insert
 

Modified: DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Manual/FAQ.pod
===================================================================
--- DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Manual/FAQ.pod	2007-08-21 16:58:17 UTC (rev 3692)
+++ DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Manual/FAQ.pod	2007-08-21 18:09:21 UTC (rev 3693)
@@ -259,7 +259,7 @@
 
 In your table schema class, create a "private" column accessor with:
 
-  __PACKAGE__->add_columns(my_common => { accessor => '_hidden_my_column' });
+  __PACKAGE__->add_columns(my_column => { accessor => '_hidden_my_column' });
 
 Then, in the same class, implement a subroutine called "my_column" that
 fetches the real value and does the formatting you want.

Modified: DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Manual/Intro.pod
===================================================================
--- DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Manual/Intro.pod	2007-08-21 16:58:17 UTC (rev 3692)
+++ DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Manual/Intro.pod	2007-08-21 18:09:21 UTC (rev 3693)
@@ -4,75 +4,71 @@
 
 =head1 INTRODUCTION
 
-So, you are bored with SQL, and want a native Perl interface for your
-database?  Or you've been doing this for a while with L<Class::DBI>,
-and think there's a better way?  You've come to the right place.
+You're bored with SQL, and want a native Perl interface for your database?  Or
+you've been doing this for a while with L<Class::DBI>, and think there's a
+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.  
+Here are a few simple tips that will help you get your bearings with
+DBIx::Class.  
 
 =head2 Tables become ResultSources
 
-DBIx::Class needs to know what your Table structure looks like.  You do that
-by defining L<DBIx::Class::ResultSource>s.  Each table get's a ResultSource,
-which defines the Columns it has, along with any Relationships it has to
-other tables.  (And oh, so much more besides)  The important thing to 
-understand:
-  
+DBIx::Class needs to know what your Table structure looks like.  You do that by
+defining L<DBIx::Class::ResultSource>s.  Each table gets a ResultSource, which
+defines the Columns it has, along with any Relationships it has to other tables.
+(And oh, so much more besides)  The important thing to understand:
+
   A ResultSource == Table
-  
+
 (most of the time, but just bear with my simplification)
 
 =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!  
+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!  
 
-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 be creating a L<DBIx::Class::ResultSet> from it's
-ResultSource.  For example, the results of:
+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
+be creating a L<DBIx::Class::ResultSet> from its ResultSource.  For example, the
+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.  
+  SELECT albumid, artist, title FROM album;
 
-DBIx::Class doesn't limit you to creating only simple ResultSets --
-if you wanted to do something like:
+Would be retrieved by creating a ResultSet object from the album table's
+ResultSource, likely by using the "search" method.  
 
-    SELECT title FROM album GROUP BY title;
-   
+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. 
 
 The important thing to understand: 
 
-   Any time you would reach for a SQL query in DBI, you are 
-   creating a DBIx::Class::ResultSet.
+  Any time you would reach for a SQL query in DBI, you are 
+  creating a DBIx::Class::ResultSet.
 
 =head2 Search is like "prepare"
 
-DBIx::Class tends to wait until it absolutely must fetch information
-from the database.  If you are returning a ResultSet, the query won't
-execute until you use a method that wants to access the data. (Such
-as "next", or "first")
+DBIx::Class tends to wait until it absolutely must fetch information from the
+database.  If you are returning a ResultSet, the query won't execute until you
+use a method that wants to access the data. (Such as "next", or "first")
 
 The important thing to understand:
 
-   Setting up a ResultSet does not execute the query; retrieving
-   the data does.
+  Setting up a ResultSet does not execute the query; retrieving
+  the data does.
 
 =head1 SETTING UP DBIx::Class
 
-Let's look at how you can set and use your first native L<DBIx::Class>
-tree.
+Let's look at how you can set and use your first native L<DBIx::Class> tree.
 
-First we'll see how you can set up your classes yourself.  If you want
-them to be auto-discovered, just skip to the next section, which shows
-you how to use L<DBIx::Class::Schema::Loader>.
+First we'll see how you can set up your classes yourself.  If you want them to
+be auto-discovered, just skip to the next section, which shows you how to use
+L<DBIx::Class::Schema::Loader>.
 
 =head2 Setting it up manually
 
@@ -82,8 +78,8 @@
   package My::Schema;
   use base qw/DBIx::Class::Schema/;
 
-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
+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: 
 
   # load My::Schema::Album and My::Schema::Artist
@@ -115,8 +111,8 @@
 
   __PACKAGE__->load_components(qw/ PK::Auto Core /);
 
-C<PK::Auto> is supported for many databases; see
-L<DBIx::Class::Storage::DBI> for more information.
+C<PK::Auto> is supported for many databases; see L<DBIx::Class::Storage::DBI>
+for more information.
 
 Set the table for your class:
 
@@ -126,9 +122,8 @@
 
   __PACKAGE__->add_columns(qw/ albumid artist title /);
 
-Each column can also be set up with its own accessor, data_type and other
-pieces of information that it may be useful to have, just pass C<add_columns>
-a hash such as:
+Each column can also be set up with its own accessor, data_type and other pieces
+of information that it may be useful to have -- just pass C<add_columns> a hash:
 
   __PACKAGE__->add_columns(albumid =>
                             { accessor  => 'album',
@@ -154,10 +149,10 @@
                             }
                          );
 
-Most of this data isn't yet used directly by DBIx::Class, but various related
-modules such as L<DBIx::Class::WebForm> make use of it. Also it allows you
-to create your database tables from your Schema, instead of the other way
-around. See L<SQL::Translator> for details.
+DBIx::Class doesn't directly use most of this data yet, but various related
+modules such as L<DBIx::Class::WebForm> make use of it. Also it allows you to
+create your database tables from your Schema, instead of the other way around.
+See L<SQL::Translator> for details.
 
 See L<DBIx::Class::ResultSource> for more details of the possible column
 attributes.
@@ -174,22 +169,21 @@
 
   __PACKAGE__->set_primary_key( qw/ albumid artistid / );
 
-Define relationships that the class has with any other classes by using
-either C<belongs_to> 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 tables foreign key in one of their columns:
+Define this class' relationships with other classes using either C<belongs_to>
+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::Artist', 'album_id');
 
-More information about the various types of relationships available, and
-how you can design your own, can be found in L<DBIx::Class::Relationship>.
+See L<DBIx::Class::Relationship> for more information about the various types of
+available relationships and how you can design your own.
 
 =head2 Using L<DBIx::Class::Schema::Loader>
 
-This is an external module, and not part of the L<DBIx::Class>
-distribution.  Like L<Class::DBI::Loader>, it inspects your database,
-and automatically creates classes for all the tables in your database.
-Here's a simple setup:
+This is an external module, and not part of the L<DBIx::Class> distribution.
+Like L<Class::DBI::Loader>, it inspects your database, and automatically creates
+classes for all the tables in your database.  Here's a simple setup:
 
   package My::Schema;
   use base qw/DBIx::Class::Schema::Loader/;
@@ -198,29 +192,29 @@
 
   1;
 
-The actual autoloading process will occur when you create a connected
-instance of your schema below.
+The actual autoloading process will occur when you create a connected instance
+of your schema below.
 
-L<DBIx::Class::Schema::Loader> takes lots of other options.  For more
-information, consult its documentation.
+See the L<DBIx::Class::Schema::Loader> documentation for more information on its
+many options.
 
 =head2 Connecting
 
-To connect to your Schema, you also need to provide the connection details.
-The arguments are the same as you would use for L<DBI/connect>:
+To connect to your Schema, you need to provide the connection details.  The
+arguments are the same as for L<DBI/connect>:
 
   my $schema = My::Schema->connect('dbi:SQLite:/home/me/myapp/my.db');
 
-You can create as many different schema instances as you need. So if you have
-a second database you want to access:
+You can create as many different schema instances as you need. So if you have a
+second database you want to access:
 
   my $other_schema = My::Schema->connect( $dsn, $user, $password, $attrs );
 
-Note that L<DBIx::Class::Schema> does not cache connections for you. If you
-use multiple connections, you need to do this manually.
+Note that L<DBIx::Class::Schema> does not cache connections for you. If you use
+multiple connections, you need to do this manually.
 
-To execute some sql statements on every connect you can add them as an option
-in a special fifth argument to connect, like so:
+To execute some sql statements on every connect you can add them as an option in
+a special fifth argument to connect:
 
   my $another_schema = My::Schema->connect(
       $dsn,
@@ -230,51 +224,52 @@
       { on_connect_do => \@on_connect_sql_statments }
   );
 
-For more information about this and other special C<connect()>-time options,
-see L<DBIx::Class::Schema::Storage::DBI/connect_info>.
+See L<DBIx::Class::Schema::Storage::DBI/connect_info> for more information about
+this and other special C<connect>-time options.
 
 =head2 Basic usage
 
 Once you've defined the basic classes, either manually or using
 L<DBIx::Class::Schema::Loader>, you can start interacting with your database.
 
-To access your database using your $schema object, you can fetch a L<DBIx::Class::Manual::Glossary/"ResultSet">
-representing each of your tables by calling the ->resultset method.
+To access your database using your $schema object, you can fetch a
+L<DBIx::Class::Manual::Glossary/"ResultSet"> representing each of your tables by
+calling the C<resultset> method.
 
 The simplest way to get a record is by primary key:
 
   my $album = $schema->resultset('Album')->find(14);
 
-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:
+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->title('Physical Graffiti');
   my $title = $album->title; # $title holds 'Physical Graffiti'
 
-If you prefer, you can use the C<set_column> and C<get_column>
-accessors instead:
+If you prefer, you can use the C<set_column> and C<get_column> accessors
+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 commit your changes to the
+database:
 
   $album->update;
 
-If needed, you can throw away your local changes like this:
+If needed, you can throw away your local changes:
 
   $album->discard_changes if $album->is_changed;
 
-As you can see, C<is_changed> allows you to check if there are local
-changes to your object.
+As you can see, C<is_changed> allows you to check if there are local changes to
+your object.
 
 =head2 Adding and removing rows
 
-To create a new record in the database, you can use the C<create>
-method.  It returns an instance of C<My::Schema::Album> that can be
-used to access the data in the new record:
+To create a new record in the database, you can use the C<create> method.  It
+returns an instance of C<My::Schema::Album> that can be used to access the data
+in the new record:
 
   my $new_album = $schema->resultset('Album')->create({ 
     title  => 'Wish You Were Here',
@@ -287,27 +282,26 @@
   $new_album->year('1975');
   $new_album->update;
 
-Likewise, you can remove it from the database like this:
+Likewise, you can remove it from the database:
 
   $new_album->delete;
 
-You can also remove records without retrieving them first, by calling
-delete directly on a ResultSet object.
+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')->search({ artist => 'Falco' })->delete;
 
 =head2 Finding your objects
 
-L<DBIx::Class> provides a few different ways to retrieve data from
-your database.  Here's one example:
+L<DBIx::Class> provides a few different ways to retrieve data from your
+database.  Here's one example:
 
   # Find all of Santana's albums
   my $rs = $schema->resultset('Album')->search({ artist => 'Santana' });
 
-In scalar context, as above, C<search> returns a
-L<DBIx::Class::ResultSet> object.  It can be used to peek at the first
-album returned by the database:
+In scalar context, as above, C<search> returns a L<DBIx::Class::ResultSet>
+object.  It can be used to peek at the first album returned by the database:
 
   my $album = $rs->first;
   print $album->title;
@@ -324,12 +318,8 @@
 
   $rs->update({ year => 2001 });
 
-For more information on what you can do with a
-L<DBIx::Class::ResultSet>, see L<DBIx::Class::ResultSet/METHODS>.
+In list context, the C<search> method returns all of the matching rows:
 
-In list context, the C<search> method returns all of the matching
-rows:
-
   # Fetch immediately all of Carlos Santana's albums
   my @albums = $schema->resultset('Album')->search(
     { artist => 'Carlos Santana' }
@@ -343,15 +333,15 @@
   # Find albums whose artist starts with 'Jimi'
   my $rs = $schema->resultset('Album')->search_like({ artist => 'Jimi%' });
 
-Or you can provide your own C<WHERE> clause, like:
+Or you can provide your own C<WHERE> clause:
 
   # Find Peter Frampton albums from the year 1986
   my $where = 'artist = ? AND year = ?';
   my @bind  = ( 'Peter Frampton', 1986 );
   my $rs    = $schema->resultset('Album')->search_literal( $where, @bind );
 
-The preferred way to generate complex queries is to provide a
-L<SQL::Abstract> construct to C<search>:
+The preferred way to generate complex queries is to provide a L<SQL::Abstract>
+construct to C<search>:
 
   my $rs = $schema->resultset('Album')->search({
     artist  => { '!=', 'Janis Joplin' },
@@ -365,8 +355,7 @@
     AND year < 1980
     AND albumid IN (1, 14, 15, 65, 43)
 
-For more examples of complex queries, see
-L<DBIx::Class::Manual::Cookbook>.
+For more examples of complex queries, see L<DBIx::Class::Manual::Cookbook>.
 
 The search can also be modified by passing another hash with
 attributes:
@@ -378,6 +367,9 @@
 
 C<@albums> then holds the two most recent Bob Marley albums.
 
+For more information on what you can do with a L<DBIx::Class::ResultSet>, see
+L<DBIx::Class::ResultSet/METHODS>.
+
 For a complete overview of the available attributes, see
 L<DBIx::Class::ResultSet/ATTRIBUTES>.
 

Modified: DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/ResultSet.pm
===================================================================
--- DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/ResultSet.pm	2007-08-21 16:58:17 UTC (rev 3692)
+++ DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/ResultSet.pm	2007-08-21 18:09:21 UTC (rev 3693)
@@ -975,7 +975,7 @@
   # offset, order by and page are not needed to count. record_filter is cdbi
   delete $attrs->{$_} for qw/rows offset order_by page pager record_filter/;
 
-  my $tmp_rs = (ref $self)->new($self->_source_handle, $attrs);
+  my $tmp_rs = (ref $self)->new($self->result_source, $attrs);
   my ($count) = $tmp_rs->cursor->next;
   return $count;
 }
@@ -1259,7 +1259,7 @@
 submitting to a $resultset->create(...) method.
 
 In void context, C<insert_bulk> in L<DBIx::Class::Storage::DBI> is used
-to insert the data, as this is a faster method.
+to insert the data, as this is a faster method.  
 
 Otherwise, each set of data is inserted into the database using
 L<DBIx::Class::ResultSet/create>, and a arrayref of the resulting row
@@ -1296,6 +1296,14 @@
   
   print $ArtistOne->name; ## response is 'Artist One'
   print $ArtistThree->cds->count ## reponse is '2'
+  
+Please note an important effect on your data when choosing between void and
+wantarray context. Since void context goes straight to C<insert_bulk> in 
+L<DBIx::Class::Storage::DBI> this will skip any component that is overriding
+c<insert>.  So if you are using something like L<DBIx-Class-UUIDColumns> to 
+create primary keys for you, you will find that your PKs are empty.  In this 
+case you will have to use the wantarray context in order to create those 
+values.
 
 =cut
 
@@ -1417,7 +1425,7 @@
 
 sub page {
   my ($self, $page) = @_;
-  return (ref $self)->new($self->_source_handle, { %{$self->{attrs}}, page => $page });
+  return (ref $self)->new($self->result_source, { %{$self->{attrs}}, page => $page });
 }
 
 =head2 new_result
@@ -1430,8 +1438,13 @@
 
 =back
 
-Creates an object in the resultset's result class and returns it.
+Creates a new row object in the resultset's result class and returns
+it. The row is not inserted into the database at this point, call
+L<DBIx::Class::Row/insert> to do that. Calling L<DBIx::Class::Row/in_storage>
+will tell you whether the row object has been inserted or not.
 
+Passes the hashref of input on to L<DBIx::Class::Row/new>.
+
 =cut
 
 sub new_result {
@@ -1548,10 +1561,59 @@
 
 =back
 
-Inserts a record into the resultset and returns the object representing it.
+Attempt to create a single new row or a row with multiple related rows
+in the table represented by the resultset (and related tables). This
+will not check for duplicate rows before inserting, use
+L</find_or_create> to do that.
 
+To create one row for this resultset, pass a hashref of key/value
+pairs representing the columns of the table and the values you wish to
+store. If the appropriate relationships are set up, foreign key fields
+can also be passed an object representing the foreign row, and the
+value will be set to it's primary key.
+
+To create related objects, pass a hashref for the value if the related
+item is a foreign key relationship (L<DBIx::Class::Relationship/belongs_to>),
+and use the name of the relationship as the key. (NOT the name of the field,
+necessarily). For C<has_many> and C<has_one> relationships, pass an arrayref
+of hashrefs containing the data for each of the rows to create in the foreign
+tables, again using the relationship name as the key.
+
+Instead of hashrefs of plain related data (key/value pairs), you may
+also pass new or inserted objects. New objects (not inserted yet, see
+L</new>), will be inserted into their appropriate tables.
+
 Effectively a shortcut for C<< ->new_result(\%vals)->insert >>.
 
+Example of creating a new row.
+
+  $person_rs->create({
+    name=>"Some Person",
+	email=>"somebody at someplace.com"
+  });
+  
+Example of creating a new row and also creating rows in a related C<has_many>
+or C<has_one> resultset.  Note Arrayref.
+
+  $artist_rs->create(
+     { artistid => 4, name => 'Manufactured Crap', cds => [ 
+        { title => 'My First CD', year => 2006 },
+        { title => 'Yet More Tweeny-Pop crap', year => 2007 },
+      ],
+     },
+  );
+
+Example of creating a new row and also creating a row in a related
+C<belongs_to>resultset. Note Hashref.
+
+  $cd_rs->create({
+    title=>"Music for Silly Walks",
+	year=>2000,
+	artist => {
+	  name=>"Silly Musician",
+	}
+  });
+
 =cut
 
 sub create {
@@ -1745,7 +1807,7 @@
     my $rel_obj = $self->result_source->relationship_info($rel);
 
     $self->throw_exception(
-      "search_related: result source '" . $self->_source_handle->source_moniker .
+      "search_related: result source '" . $self->result_source->source_name .
         "' has no such relationship $rel")
       unless $rel_obj;
     
@@ -1756,7 +1818,7 @@
 
     #XXX - temp fix for result_class bug. There likely is a more elegant fix -groditi
     my %attrs = %{$self->{attrs}||{}};
-    delete $attrs{result_class};
+    delete @attrs{qw(result_class alias)};
 
     my $new_cache;
 
@@ -1767,21 +1829,32 @@
       }
     }
 
-    my $new = $self->_source_handle
-                   ->schema
-                   ->resultset($rel_obj->{class})
-                   ->search_rs(
-                       undef, {
-                         %attrs,
-                         join => undef,
-                         prefetch => undef,
-                         select => undef,
-                         as => undef,
-                         alias => $alias,
-                         where => $self->{cond},
-                         seen_join => $seen,
-                         from => $from,
-                     });
+    my $rel_source = $self->result_source->related_source($rel);
+
+    my $new = do {
+
+      # The reason we do this now instead of passing the alias to the
+      # search_rs below is that if you wrap/overload resultset on the
+      # source you need to know what alias it's -going- to have for things
+      # to work sanely (e.g. RestrictWithObject wants to be able to add
+      # extra query restrictions, and these may need to be $alias.)
+
+      my $attrs = $rel_source->resultset_attributes;
+      local $attrs->{alias} = $alias;
+
+      $rel_source->resultset
+                 ->search_rs(
+                     undef, {
+                       %attrs,
+                       join => undef,
+                       prefetch => undef,
+                       select => undef,
+                       as => undef,
+                       where => $self->{cond},
+                       seen_join => $seen,
+                       from => $from,
+                   });
+    };
     $new->set_cache($new_cache) if $new_cache;
     $new;
   };
@@ -2150,7 +2223,7 @@
 exists>).  It has nothing to do with the SQL code C< SELECT foo AS bar
 >.
 
-The C< as > attribute is used in conjunction with C<select>,
+The C<as> attribute is used in conjunction with C<select>,
 usually when C<select> contains one or more function or stored
 procedure names:
 
@@ -2262,10 +2335,11 @@
 
 =back
 
-Contains one or more relationships that should be fetched along with the main
-query (when they are accessed afterwards they will have already been
-"prefetched").  This is useful for when you know you will need the related
-objects, because it saves at least one query:
+Contains one or more relationships that should be fetched along with
+the main query (when they are accessed afterwards the data will
+already be available, without extra queries to the database).  This is
+useful for when you know you will need the related objects, because it
+saves at least one query:
 
   my $rs = $schema->resultset('Tag')->search(
     undef,

Modified: DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/ResultSource.pm
===================================================================
--- DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/ResultSource.pm	2007-08-21 16:58:17 UTC (rev 3692)
+++ DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/ResultSource.pm	2007-08-21 18:09:21 UTC (rev 3693)
@@ -988,7 +988,11 @@
   ) if scalar @_;
 
   return $self->resultset_class->new(
-    $self, $self->{resultset_attributes}
+    $self,
+    {
+      %{$self->{resultset_attributes}},
+      %{$self->schema->default_resultset_attributes}
+    },
   );
 }
 

Modified: DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Row.pm
===================================================================
--- DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Row.pm	2007-08-21 16:58:17 UTC (rev 3692)
+++ DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Row.pm	2007-08-21 18:09:21 UTC (rev 3693)
@@ -35,6 +35,8 @@
 be turned into objects via new_related, and treated as if you had
 passed objects.
 
+For a more involved explanation, see L<DBIx::Class::ResultSet/create>.
+
 =cut
 
 ## It needs to store the new objects somewhere, and call insert on that list later when insert is called on this object. We may need an accessor for these so the user can retrieve them, if just doing ->new().
@@ -139,6 +141,9 @@
 an entirely new object into the database, use C<create> (see
 L<DBIx::Class::ResultSet/create>).
 
+This will also insert any uninserted, related objects held inside this
+one, see L<DBIx::Class::ResultSet/create> for more details.
+
 =cut
 
 sub insert {
@@ -190,7 +195,6 @@
 
       foreach my $p (@pri) {
         if (exists $keyhash->{$p}) {
-          warn $keyhash->{$p};
           unless (defined($rel_obj->get_column($keyhash->{$p}))
                   || $rel_obj->column_info($keyhash->{$p})
                              ->{is_auto_increment}) {
@@ -261,7 +265,7 @@
   $obj->in_storage; # Get value
   $obj->in_storage(1); # Set value
 
-Indicated whether the object exists as a row in the database or not
+Indicates whether the object exists as a row in the database or not
 
 =cut
 

Modified: DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Schema/Versioned.pm
===================================================================
--- DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Schema/Versioned.pm	2007-08-21 16:58:17 UTC (rev 3692)
+++ DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Schema/Versioned.pm	2007-08-21 18:09:21 UTC (rev 3693)
@@ -205,9 +205,9 @@
 
     for (@statements)
     {
-        $self->storage->debugfh->print("$_\n") if $self->storage->debug;
-#        print "Running \n>>$_<<\n";
+        $self->storage->debugobj->query_start($_) if $self->storage->debug;
         $self->storage->dbh->do($_) or warn "SQL was:\n $_";
+        $self->storage->debugobj->query_end($_) if $self->storage->debug;
     }
 
     return 1;
@@ -217,7 +217,7 @@
 
 =head1 NAME
 
-DBIx::Class::Versioning - DBIx::Class::Schema plugin for Schema upgrades
+DBIx::Class::Schema::Versioned - DBIx::Class::Schema plugin for Schema upgrades
 
 =head1 SYNOPSIS
 

Modified: DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Schema.pm
===================================================================
--- DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Schema.pm	2007-08-21 16:58:17 UTC (rev 3692)
+++ DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Schema.pm	2007-08-21 18:09:21 UTC (rev 3693)
@@ -17,6 +17,7 @@
 __PACKAGE__->mk_classdata('storage');
 __PACKAGE__->mk_classdata('exception_action');
 __PACKAGE__->mk_classdata('stacktrace' => $ENV{DBIC_TRACE} || 0);
+__PACKAGE__->mk_classdata('default_resultset_attributes' => {});
 
 =head1 NAME
 
@@ -835,7 +836,19 @@
     [ 2, 'Indie Band' ],
     ...
   ]);
+  
+Since wantarray context is basically the same as looping over $rs->create(...) 
+you won't see any performance benefits and in this case the method is more for
+convenience. Void context sends the column information directly to storage
+using <DBI>s bulk insert method. So the performance will be much better for 
+storages that support this method.
 
+Because of this difference in the way void context inserts rows into your 
+database you need to note how this will effect any loaded components that
+override or augment insert.  For example if you are using a component such 
+as L<DBIx::Class::UUIDColumns> to populate your primary keys you MUST use 
+wantarray context if you want the PKs automatically created.
+
 =cut
 
 sub populate {

Modified: DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Storage/DBI/Cursor.pm
===================================================================
--- DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Storage/DBI/Cursor.pm	2007-08-21 16:58:17 UTC (rev 3692)
+++ DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Storage/DBI/Cursor.pm	2007-08-21 18:09:21 UTC (rev 3693)
@@ -124,7 +124,10 @@
 
 sub all {
   my ($self) = @_;
-  return $self->SUPER::all if $self->{attrs}{rows};
+  if ($self->{attrs}{software_limit}
+        && ($self->{attrs}{offset} || $self->{attrs}{rows})) {
+    return $self->SUPER::all;
+  }
   $self->{storage}->dbh_do($self->can('_dbh_all'), $self);
 }
 

Modified: DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Storage/DBI/SQLite.pm
===================================================================
--- DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Storage/DBI/SQLite.pm	2007-08-21 16:58:17 UTC (rev 3692)
+++ DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Storage/DBI/SQLite.pm	2007-08-21 18:09:21 UTC (rev 3693)
@@ -50,7 +50,7 @@
 
 =head1 NAME
 
-DBIx::Class::PK::Auto::SQLite - Automatic primary key class for SQLite
+DBIx::Class::Storage::DBI::SQLite - Automatic primary key class for SQLite
 
 =head1 SYNOPSIS
 

Modified: DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Storage/DBI.pm
===================================================================
--- DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Storage/DBI.pm	2007-08-21 16:58:17 UTC (rev 3692)
+++ DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Storage/DBI.pm	2007-08-21 18:09:21 UTC (rev 3693)
@@ -13,10 +13,12 @@
 
 __PACKAGE__->mk_group_accessors('simple' =>
     qw/_connect_info _dbi_connect_info _dbh _sql_maker _sql_maker_opts
-       _conn_pid _conn_tid disable_sth_caching cursor on_connect_do
+       _conn_pid _conn_tid disable_sth_caching on_connect_do
        transaction_depth unsafe _dbh_autocommit/
 );
 
+__PACKAGE__->cursor_class('DBIx::Class::Storage::DBI::Cursor');
+
 BEGIN {
 
 package DBIC::SQL::Abstract; # Would merge upstream, but nate doesn't reply :(
@@ -311,7 +313,6 @@
 sub new {
   my $new = shift->next::method(@_);
 
-  $new->cursor("DBIx::Class::Storage::DBI::Cursor");
   $new->transaction_depth(0);
   $new->_sql_maker_opts({});
   $new->{_in_dbh_do} = 0;
@@ -480,7 +481,9 @@
   my $last_info = $dbi_info->[-1];
   if(ref $last_info eq 'HASH') {
     $last_info = { %$last_info }; # so delete is non-destructive
-    for my $storage_opt (qw/on_connect_do disable_sth_caching unsafe/) {
+    for my $storage_opt (
+        qw/on_connect_do disable_sth_caching unsafe cursor_class/
+      ) {
       if(my $value = delete $last_info->{$storage_opt}) {
         $self->$storage_opt($value);
       }
@@ -665,6 +668,7 @@
       }
       else {
           $self->_verify_pid;
+          return 0 if !$self->_dbh;
       }
       return ($dbh->FETCH('Active') && $dbh->ping);
   }
@@ -740,9 +744,9 @@
 
   # if on-connect sql statements are given execute them
   foreach my $sql_statement (@{$self->on_connect_do || []}) {
-    $self->debugobj->query_start($sql_statement) if $self->debug();
+    $self->_query_start($sql_statement);
     $self->_dbh->do($sql_statement);
-    $self->debugobj->query_end($sql_statement) if $self->debug();
+    $self->_query_end($sql_statement);
   }
 
   $self->_conn_pid($$);
@@ -770,7 +774,7 @@
        $dbh = DBI->connect(@info);
     }
 
-    if(!$self->unsafe) {
+    if($dbh && !$self->unsafe) {
       my $weak_self = $self;
       weaken($weak_self);
       $dbh->{HandleError} = sub {
@@ -864,6 +868,40 @@
   return ($sql, \@bind);
 }
 
+sub _fix_bind_params {
+    my ($self, @bind) = @_;
+
+    ### Turn @bind from something like this:
+    ###   ( [ "artist", 1 ], [ "cdid", 1, 3 ] )
+    ### to this:
+    ###   ( "'1'", "'1'", "'3'" )
+    return
+        map {
+            if ( defined( $_ && $_->[1] ) ) {
+                map { qq{'$_'}; } @{$_}[ 1 .. $#$_ ];
+            }
+            else { q{'NULL'}; }
+        } @bind;
+}
+
+sub _query_start {
+    my ( $self, $sql, @bind ) = @_;
+
+    if ( $self->debug ) {
+        @bind = $self->_fix_bind_params(@bind);
+        $self->debugobj->query_start( $sql, @bind );
+    }
+}
+
+sub _query_end {
+    my ( $self, $sql, @bind ) = @_;
+
+    if ( $self->debug ) {
+        @bind = $self->_fix_bind_params(@bind);
+        $self->debugobj->query_end( $sql, @bind );
+    }
+}
+
 sub _dbh_execute {
   my ($self, $dbh, $op, $extra_bind, $ident, $bind_attributes, @args) = @_;
   
@@ -873,11 +911,7 @@
 
   my ($sql, $bind) = $self->_prep_for_execute($op, $extra_bind, $ident, \@args);
 
-  if ($self->debug) {
-      my @debug_bind =
-        map { defined ($_ && $_->[1]) ? qq{'$_->[1]'} : q{'NULL'} } @$bind;
-      $self->debugobj->query_start($sql, @debug_bind);
-  }
+  $self->_query_start( $sql, @$bind );
 
   my $sth = $self->sth($sql,$op);
 
@@ -904,11 +938,7 @@
   my $rv = $sth->execute();
   $self->throw_exception($sth->errstr) if !$rv;
 
-  if ($self->debug) {
-     my @debug_bind =
-       map { defined ($_ && $_->[1]) ? qq{'$_->[1]'} : q{'NULL'} } @$bind; 
-     $self->debugobj->query_end($sql, @debug_bind);
-  }
+  $self->_query_end( $sql, @$bind );
 
   return (wantarray ? ($rv, $sth, @$bind) : $rv);
 }
@@ -940,10 +970,7 @@
   @colvalues{@$cols} = (0..$#$cols);
   my ($sql, @bind) = $self->sql_maker->insert($table, \%colvalues);
   
-  if ($self->debug) {
-      my @debug_bind = map { defined $_->[1] ? qq{$_->[1]} : q{'NULL'} } @bind;
-      $self->debugobj->query_start($sql, @debug_bind);
-  }
+  $self->_query_start( $sql, @bind );
   my $sth = $self->sth($sql);
 
 #  @bind = map { ref $_ ? ''.$_ : $_ } @bind; # stringify args
@@ -981,10 +1008,7 @@
   my $rv = $sth->execute_array({ArrayTupleStatus => $tuple_status});
   $self->throw_exception($sth->errstr) if !$rv;
 
-  if ($self->debug) {
-      my @debug_bind = map { defined $_ ? qq{`$_'} : q{`NULL'} } @bind;
-      $self->debugobj->query_end($sql, @debug_bind);
-  }
+  $self->_query_end( $sql, @bind );
   return (wantarray ? ($rv, $sth, @bind) : $rv);
 }
 
@@ -1064,7 +1088,7 @@
 sub select {
   my $self = shift;
   my ($ident, $select, $condition, $attrs) = @_;
-  return $self->cursor->new($self, \@_, $attrs);
+  return $self->cursor_class->new($self, \@_, $attrs);
 }
 
 sub select_single {
@@ -1417,14 +1441,14 @@
       next if($line =~ /^BEGIN TRANSACTION/m);
       next if($line =~ /^COMMIT/m);
       next if $line =~ /^\s+$/; # skip whitespace only
-      $self->debugobj->query_start($line) if $self->debug;
+      $self->_query_start($line);
       eval {
         $self->dbh->do($line); # shouldn't be using ->dbh ?
       };
       if ($@) {
         warn qq{$@ (running "${line}")};
       }
-      $self->debugobj->query_end($line) if $self->debug;
+      $self->_query_end($line);
     }
   }
 }

Modified: DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Storage/Statistics.pm
===================================================================
--- DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Storage/Statistics.pm	2007-08-21 16:58:17 UTC (rev 3692)
+++ DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Storage/Statistics.pm	2007-08-21 18:09:21 UTC (rev 3693)
@@ -45,6 +45,35 @@
 should be set to STDERR - although see information on the
 L<DBIC_TRACE> environment variable.
 
+=head2 print
+
+Prints the specified string to our debugging filehandle, which we will attempt
+to open if we haven't yet.  Provided to save our methods the worry of how
+to display the message.
+
+=cut
+sub print {
+  my ($self, $msg) = @_;
+
+  if(!defined($self->debugfh())) {
+    my $fh;
+    my $debug_env = $ENV{DBIX_CLASS_STORAGE_DBI_DEBUG}
+                  || $ENV{DBIC_TRACE};
+    if (defined($debug_env) && ($debug_env =~ /=(.+)$/)) {
+      $fh = IO::File->new($1, 'w')
+        or die("Cannot open trace file $1");
+    } else {
+      $fh = IO::File->new('>&STDERR')
+        or die('Duplication of STDERR for debug output failed (perhaps your STDERR is closed?)');
+    }
+
+    $fh->autoflush();
+    $self->debugfh($fh);
+  }
+
+  $self->debugfh->print($msg);
+}
+
 =head2 txn_begin
 
 Called when a transaction begins.
@@ -53,7 +82,7 @@
 sub txn_begin {
   my $self = shift;
 
-  $self->debugfh->print("BEGIN WORK\n");
+  $self->print("BEGIN WORK\n");
 }
 
 =head2 txn_rollback
@@ -64,7 +93,7 @@
 sub txn_rollback {
   my $self = shift;
 
-  $self->debugfh->print("ROLLBACK\n");
+  $self->print("ROLLBACK\n");
 }
 
 =head2 txn_commit
@@ -75,7 +104,7 @@
 sub txn_commit {
   my $self = shift;
 
-  $self->debugfh->print("COMMIT\n");
+  $self->print("COMMIT\n");
 }
 
 =head2 query_start
@@ -95,7 +124,7 @@
     return;
   }
 
-  $self->debugfh->print($message);
+  $self->print($message);
 }
 
 =head2 query_end

Modified: DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Storage.pm
===================================================================
--- DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Storage.pm	2007-08-21 16:58:17 UTC (rev 3692)
+++ DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class/Storage.pm	2007-08-21 18:09:21 UTC (rev 3693)
@@ -10,7 +10,12 @@
 use IO::File;
 
 __PACKAGE__->mk_group_accessors('simple' => qw/debug debugobj schema/);
+__PACKAGE__->mk_group_accessors('inherited' => 'cursor_class');
 
+__PACKAGE__->cursor_class('DBIx::Class::Cursor');
+
+sub cursor { shift->cursor_class(@_); }
+
 package # Hide from PAUSE
     DBIx::Class::Storage::NESTED_ROLLBACK_EXCEPTION;
 
@@ -56,20 +61,11 @@
   $new->set_schema($schema);
   $new->debugobj(new DBIx::Class::Storage::Statistics());
 
-  my $fh;
+  #my $fh;
 
   my $debug_env = $ENV{DBIX_CLASS_STORAGE_DBI_DEBUG}
                   || $ENV{DBIC_TRACE};
 
-  if (defined($debug_env) && ($debug_env =~ /=(.+)$/)) {
-    $fh = IO::File->new($1, 'w')
-      or $new->throw_exception("Cannot open trace file $1");
-  } else {
-    $fh = IO::File->new('>&STDERR');
-  }
-
-  $fh->autoflush(1);
-  $new->debugfh($fh);
   $new->debug(1) if $debug_env;
 
   $new;
@@ -324,14 +320,12 @@
     }
 }
 
-=head2 cursor
+=head2 cursor_class
 
 The cursor class for this Storage object.
 
 =cut
 
-sub cursor { die "Virtual method!" }
-
 =head2 deploy
 
 Deploy the tables to storage (CREATE TABLE and friends in a SQL-based

Modified: DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class.pm
===================================================================
--- DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class.pm	2007-08-21 16:58:17 UTC (rev 3692)
+++ DBIx-Class/0.08/branches/cdbicompat_integration/lib/DBIx/Class.pm	2007-08-21 18:09:21 UTC (rev 3693)
@@ -23,7 +23,7 @@
 # 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.08003';
+$VERSION = '0.08006';
 
 sub MODIFY_CODE_ATTRIBUTES {
   my ($class,$code, at attrs) = @_;
@@ -123,6 +123,8 @@
   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
 
+  # new() makes a DBIx::Class::Row object but doesnt insert it into the DB.
+  # create() is the same as new() then insert().
   my $new_cd = $schema->resultset('CD')->new({ title => 'Spoon' });
   $new_cd->artist($cd->artist);
   $new_cd->insert; # Auto-increment primary key filled in after INSERT
@@ -161,16 +163,18 @@
 and even backwards incompatible changes to non-published APIs will be fixed
 if they're reported and doing so doesn't cost the codebase anything.
 
-The test suite is quite substantial, and several developer releases are
-generally made to CPAN before the -current branch is merged back to trunk for
-a major release.
+The test suite is quite substantial, and several developer releases
+are generally made to CPAN before the branch for the next release is
+merged back to trunk for a major release.
 
 The community can be found via:
 
-  Mailing list: http://lists.rawmode.org/mailman/listinfo/dbix-class/
+  Mailing list: http://lists.scsys.co.uk/mailman/listinfo/dbix-class/
 
-  SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
+  SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
 
+  SVNWeb: http://dev.catalyst.perl.org/svnweb/bast/browse/DBIx-Class/
+
   IRC: irc.perl.org#dbix-class
 
 =head1 WHERE TO GO NEXT
@@ -189,6 +193,8 @@
 
 abraxxa: Alexander Hartmaier <alex_hartmaier at hotmail.com>
 
+aherzog: Adam Herzog <adam at herzogdesigns.com>
+
 andyg: Andy Grundman <andy at hybridized.org>
 
 ank: Andres Kievsky

Modified: DBIx-Class/0.08/branches/cdbicompat_integration/t/03podcoverage.t
===================================================================
--- DBIx-Class/0.08/branches/cdbicompat_integration/t/03podcoverage.t	2007-08-21 16:58:17 UTC (rev 3692)
+++ DBIx-Class/0.08/branches/cdbicompat_integration/t/03podcoverage.t	2007-08-21 18:09:21 UTC (rev 3693)
@@ -2,7 +2,8 @@
 
 eval "use Test::Pod::Coverage 1.04";
 plan skip_all => 'Test::Pod::Coverage 1.04 required' if $@;
-plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD};
+plan skip_all => 'set TEST_POD to enable this test'
+  unless ($ENV{TEST_POD} || -e 'MANIFEST.SKIP');
 
 my @modules = sort { $a cmp $b } (Test::Pod::Coverage::all_modules());
 plan tests => scalar(@modules);
@@ -21,9 +22,15 @@
         ignore => [
             qw/MODIFY_CODE_ATTRIBUTES
               component_base_class
-              mk_classdata/
+              mk_classdata
+              mk_classaccessor/
         ]
     },
+    'DBIx::Class::Storage' => {
+        ignore => [
+            qw(cursor)
+        ]
+    },
     'DBIx::Class::CDBICompat::AccessorMapping'          => { skip => 1 },
     'DBIx::Class::CDBICompat::AttributeAPI'             => { skip => 1 },
     'DBIx::Class::CDBICompat::AutoUpdate'               => { skip => 1 },

Modified: DBIx-Class/0.08/branches/cdbicompat_integration/t/05components.t
===================================================================
--- DBIx-Class/0.08/branches/cdbicompat_integration/t/05components.t	2007-08-21 16:58:17 UTC (rev 3692)
+++ DBIx-Class/0.08/branches/cdbicompat_integration/t/05components.t	2007-08-21 18:09:21 UTC (rev 3693)
@@ -7,7 +7,7 @@
 use lib qw(t/lib);
 use DBICTest::ForeignComponent;
 
-plan tests => 5;
+plan tests => 6;
 
 #   Tests if foreign component was loaded by calling foreign's method
 ok( DBICTest::ForeignComponent->foreign_test_method, 'foreign component' );
@@ -62,3 +62,5 @@
 }
 is( scalar @warnings, 0,
     'warning not issued for correct order in load_components()' );
+
+use_ok('DBIx::Class::AccessorGroup');

Modified: DBIx-Class/0.08/branches/cdbicompat_integration/t/33storage_reconnect.t
===================================================================
--- DBIx-Class/0.08/branches/cdbicompat_integration/t/33storage_reconnect.t	2007-08-21 16:58:17 UTC (rev 3692)
+++ DBIx-Class/0.08/branches/cdbicompat_integration/t/33storage_reconnect.t	2007-08-21 18:09:21 UTC (rev 3693)
@@ -1,12 +1,17 @@
 use strict;
 use warnings;  
 
+use FindBin;
+use File::Copy;
 use Test::More;
 use lib qw(t/lib);
 use DBICTest;
 
-plan tests => 2;
+plan tests => 5;
 
+my $db_orig = "$FindBin::Bin/var/DBIxClass.db";
+my $db_tmp  = "$db_orig.tmp";
+
 # Set up the "usual" sqlite for DBICTest
 my $schema = DBICTest->init_schema;
 
@@ -24,3 +29,35 @@
 #   4. Success!
 my @art_two = $schema->resultset("Artist")->search({ }, { order_by => 'name DESC'});
 cmp_ok(@art_two, '==', 3, "Three artists returned");
+
+### Now, disconnect the dbh, and move the db file;
+# create a new one and chmod 000 to prevent SQLite from connecting.
+$schema->storage->_dbh->disconnect;
+move( $db_orig, $db_tmp );
+open DBFILE, '>', $db_orig;
+print DBFILE 'THIS IS NOT A REAL DATABASE';
+close DBFILE;
+chmod 0000, $db_orig;
+
+### Try the operation again... it should fail, since there's no db
+eval {
+    my @art_three = $schema->resultset("Artist")->search( {}, { order_by => 'name DESC' } );
+};
+ok( $@, 'The operation failed' );
+
+### Now, move the db file back to the correct name
+unlink($db_orig);
+move( $db_tmp, $db_orig );
+
+SKIP: {
+    skip "Cannot reconnect if original connection didn't fail", 2
+        if ( $@ =~ /encrypted or is not a database/ );
+
+    ### Try the operation again... this time, it should succeed
+    my @art_four;
+    eval {
+        @art_four = $schema->resultset("Artist")->search( {}, { order_by => 'name DESC' } );
+    };
+    ok( !$@, 'The operation succeeded' );
+    cmp_ok( @art_four, '==', 3, "Three artists returned" );
+}

Modified: DBIx-Class/0.08/branches/cdbicompat_integration/t/50fork.t
===================================================================
--- DBIx-Class/0.08/branches/cdbicompat_integration/t/50fork.t	2007-08-21 16:58:17 UTC (rev 3692)
+++ DBIx-Class/0.08/branches/cdbicompat_integration/t/50fork.t	2007-08-21 18:09:21 UTC (rev 3693)
@@ -18,7 +18,7 @@
    $num_children = 10;
 }
 
-plan tests => $num_children + 5;
+plan tests => $num_children + 6;
 
 use lib qw(t/lib);
 
@@ -45,6 +45,23 @@
 };
 ok(!$@) or diag "Creation eval failed: $@";
 
+{
+    my $pid = fork;
+    if(!defined $pid) {
+        die "fork failed: $!";
+    }
+
+    if (!$pid) {
+        exit $schema->storage->connected ? 1 : 0;
+    }
+
+    if (waitpid($pid, 0) == $pid) {
+        my $ex = $? >> 8;
+        ok($ex == 0, "storage->connected() returns false in child");
+        exit $ex if $ex; # skip remaining tests
+    }
+}
+
 my @pids;
 while(@pids < $num_children) {
 

Modified: DBIx-Class/0.08/branches/cdbicompat_integration/t/67pager.t
===================================================================
--- DBIx-Class/0.08/branches/cdbicompat_integration/t/67pager.t	2007-08-21 16:58:17 UTC (rev 3692)
+++ DBIx-Class/0.08/branches/cdbicompat_integration/t/67pager.t	2007-08-21 18:09:21 UTC (rev 3693)
@@ -1,14 +1,12 @@
 use strict;
 use warnings;  
 
-use Test::More;
+use Test::More qw(no_plan);
 use lib qw(t/lib);
 use DBICTest;
 
 my $schema = DBICTest->init_schema();
 
-plan tests => 13;
-
 # first page
 my $it = $schema->resultset("CD")->search(
     {},
@@ -76,3 +74,11 @@
 )->search( undef, { order_by => 'title' } );
 
 is( $it->count, 2, "chained searches paging ok" );
+
+my $p = sub { $schema->resultset("CD")->page(1)->pager->entries_per_page; };
+
+is($p->(), 10, 'default rows is 10');
+
+$schema->default_resultset_attributes({ rows => 5 });
+
+is($p->(), 5, 'default rows is 5');

Modified: DBIx-Class/0.08/branches/cdbicompat_integration/t/91debug.t
===================================================================
--- DBIx-Class/0.08/branches/cdbicompat_integration/t/91debug.t	2007-08-21 16:58:17 UTC (rev 3692)
+++ DBIx-Class/0.08/branches/cdbicompat_integration/t/91debug.t	2007-08-21 18:09:21 UTC (rev 3693)
@@ -7,7 +7,7 @@
 
 my $schema = DBICTest->init_schema();
 
-plan tests => 2;
+plan tests => 6;
 
 ok ( $schema->storage->debug(1), 'debug' );
 ok ( defined(
@@ -18,4 +18,46 @@
      'debugfh'
    );
 
+$schema->storage->debugfh->autoflush(1);
+my $rs = $schema->resultset('CD')->search({});
+$rs->count();
+
+my $log = new IO::File('t/var/sql.log', 'r') or die($!);
+my $line = <$log>;
+$log->close();
+ok($line =~ /^SELECT COUNT/, 'Log success');
+
+$schema->storage->debugfh(undef);
+$ENV{'DBIC_TRACE'} = '=t/var/foo.log';
+$rs = $schema->resultset('CD')->search({});
+$rs->count();
+$log = new IO::File('t/var/foo.log', 'r') or die($!);
+$line = <$log>;
+$log->close();
+ok($line =~ /^SELECT COUNT/, 'Log success');
+$schema->storage->debugobj->debugfh(undef);
+delete($ENV{'DBIC_TRACE'});
+open(STDERRCOPY, '>&STDERR');
+stat(STDERRCOPY); # nop to get warnings quiet
+close(STDERR);
+eval {
+    $rs = $schema->resultset('CD')->search({});
+    $rs->count();
+};
+ok($@, 'Died on closed FH');
+open(STDERR, '>&STDERRCOPY');
+
+# test trace output correctness for bind params
+{
+    my $sql = '';
+    $schema->storage->debugcb( sub { $sql = $_[1] } );
+
+    my @cds = $schema->resultset('CD')->search( { artist => 1, cdid => { -between => [ 1, 3 ] }, } );
+    like(
+        $sql,
+        qr/\QSELECT me.cdid, me.artist, me.title, me.year FROM cd me WHERE ( artist = ? AND cdid BETWEEN ? AND ? ): '1', '1', '3'\E/,
+        'got correct SQL with all bind parameters'
+    );
+}
+
 1;




More information about the Bast-commits mailing list