[Bast-commits] r3784 - in DBIx-Class/0.08/branches/jdbicompat: . lib/DBIx lib/DBIx/Class lib/DBIx/Class/InflateColumn lib/DBIx/Class/Manual lib/DBIx/Class/ResultClass lib/DBIx/Class/ResultSourceProxy lib/DBIx/Class/Schema lib/DBIx/Class/Storage lib/DBIx/Class/Storage/DBI lib/DBIx/Class/Storage/DBI/ODBC lib/DBIx/Class/Storage/DBI/Oracle lib/SQL/Translator/Parser/DBIx t t/cdbi-t t/lib

matthewt at dev.catalyst.perl.org matthewt at dev.catalyst.perl.org
Wed Sep 26 03:08:38 GMT 2007


Author: matthewt
Date: 2007-09-26 03:08:37 +0100 (Wed, 26 Sep 2007)
New Revision: 3784

Added:
   DBIx-Class/0.08/branches/jdbicompat/t/73oracle_inflate.t
   DBIx-Class/0.08/branches/jdbicompat/t/92storage_on_connect_do.t
Modified:
   DBIx-Class/0.08/branches/jdbicompat/
   DBIx-Class/0.08/branches/jdbicompat/Changes
   DBIx-Class/0.08/branches/jdbicompat/Makefile.PL
   DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class.pm
   DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/AccessorGroup.pm
   DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Componentised.pm
   DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/InflateColumn/DateTime.pm
   DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Manual/Cookbook.pod
   DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Manual/FAQ.pod
   DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Manual/Intro.pod
   DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/PK.pm
   DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Relationship.pm
   DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/ResultClass/HashRefInflator.pm
   DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/ResultSet.pm
   DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/ResultSource.pm
   DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/ResultSourceProxy/Table.pm
   DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Row.pm
   DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Schema.pm
   DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Schema/Versioned.pm
   DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Storage.pm
   DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Storage/DBI.pm
   DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Storage/DBI/Cursor.pm
   DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Storage/DBI/ODBC.pm
   DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Storage/DBI/ODBC/DB2_400_SQL.pm
   DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm
   DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Storage/DBI/SQLite.pm
   DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Storage/Statistics.pm
   DBIx-Class/0.08/branches/jdbicompat/lib/SQL/Translator/Parser/DBIx/Class.pm
   DBIx-Class/0.08/branches/jdbicompat/t/03podcoverage.t
   DBIx-Class/0.08/branches/jdbicompat/t/05components.t
   DBIx-Class/0.08/branches/jdbicompat/t/33storage_reconnect.t
   DBIx-Class/0.08/branches/jdbicompat/t/50fork.t
   DBIx-Class/0.08/branches/jdbicompat/t/60core.t
   DBIx-Class/0.08/branches/jdbicompat/t/67pager.t
   DBIx-Class/0.08/branches/jdbicompat/t/91debug.t
   DBIx-Class/0.08/branches/jdbicompat/t/cdbi-t/11-triggers.t
   DBIx-Class/0.08/branches/jdbicompat/t/lib/DBICTest.pm
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
 
 r11194 at jules (orig r3695):  matthewt | 2007-08-21 19:24:53 +0100
  r10460 at jules (orig r3640):  tomboh | 2007-08-01 12:27:38 +0100
  Add an 'on_disconnect_do' argument to
  DBIx::Class::Storage::DBI::connect_info that, on disconnection, do what
  'on_connect_do' does on connection.  Currently, this only works if the
  code explicitly calls disconnect() on the Storage object.
  
  While I'm here, make both 'on_connect_do' and 'on_disconnect_do' accept
  code references as well as strings containing SQL statements.
  
  Finally, remove code to call compose_connection() from DBICTest.pm that
  never gets called any more.
  
 
 r11195 at jules (orig r3696):  matthewt | 2007-08-21 19:24:57 +0100
  r11152 at jules (orig r3678):  tomboh | 2007-08-15 09:24:32 +0100
  Restore code that I removed in revision 3640 that tests still need
  
 
 r11196 at jules (orig r3697):  matthewt | 2007-08-21 19:25:00 +0100
  r11153 at jules (orig r3679):  tomboh | 2007-08-15 09:25:47 +0100
  Let on_connect_do() and on_disconnect_do() take code references.
  Provide tests and documentation for this.
  
 
 r11197 at jules (orig r3698):  matthewt | 2007-08-21 19:25:33 +0100
 
 r11199 at jules (orig r3700):  matthewt | 2007-08-21 19:50:00 +0100
 arrayrefs for on_connect_do
 r11200 at jules (orig r3701):  matthewt | 2007-08-21 19:53:44 +0100
 note on_connect_do changes
 r11201 at jules (orig r3702):  matthewt | 2007-08-21 20:17:22 +0100
 oracle datetime inflator patch
 r11202 at jules (orig r3703):  matthewt | 2007-08-21 20:52:09 +0100
 force CDBICompat deps for developers, fix tests to work with latest Class::Trigger
 r11217 at jules (orig r3705):  tomboh | 2007-08-22 11:28:58 +0100
 Fix the behaviour of code refs within array refs for on_(dis)?connect_do
 and enhance tests to spot the previous mistake.
 
 r11218 at jules (orig r3706):  tomboh | 2007-08-22 11:57:14 +0100
 Add myself to the list of contributors
 
 r11232 at jules (orig r3709):  gphat | 2007-08-24 18:11:46 +0100
 Fix typos.
 
 r14025 at jules (orig r3720):  ilmari | 2007-09-04 17:44:41 +0100
 Fix return value for DBIC::ResultSource::Table->table($table)
 r14026 at jules (orig r3721):  ash | 2007-09-04 20:14:02 +0100
 Bump for New relase
 r14027 at jules (orig r3722):  semifor | 2007-09-05 04:49:46 +0100
  r1185 at titanic:  mjm | 2007-09-04 20:11:07 -0700
  Updated email address
 
 r14029 at jules (orig r3723):  castaway | 2007-09-06 21:07:52 +0100
 Doc patch from wreis
 
 r14030 at jules (orig r3724):  castaway | 2007-09-06 22:35:49 +0100
 Add more about accessors to doc
 
 r14031 at jules (orig r3725):  tomboh | 2007-09-07 17:54:00 +0100
 Small POD fix
 
 r14032 at jules (orig r3726):  semifor | 2007-09-08 17:58:56 +0100
  r1191 at titanic:  mjm | 2007-09-08 09:20:32 -0700
  discard_changes is also "refresh from storage"
 
 r14035 at jules (orig r3729):  castaway | 2007-09-12 00:23:20 +0100
 Much doch shuffling and more argument explanations (due to initself ;)
 
 r14326 at jules (orig r3782):  ash | 2007-09-25 16:39:52 +0100
 Throw if "foreign." and "self." are wrong way round in conditions for relationships



Property changes on: DBIx-Class/0.08/branches/jdbicompat
___________________________________________________________________
Name: svk:merge
   - 0ff1c2e0-7480-4c26-9844-d5e952dc0eb0:/local/dbic-jdbi:64898
168d5346-440b-0410-b799-f706be625ff1:/DBIx-Class-current:2207
462d4d0c-b505-0410-bf8e-ce8f877b3390:/local/bast/DBIx-Class:3159
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
   + 0ff1c2e0-7480-4c26-9844-d5e952dc0eb0:/local/dbic-jdbi:64898
168d5346-440b-0410-b799-f706be625ff1:/DBIx-Class-current:2207
462d4d0c-b505-0410-bf8e-ce8f877b3390:/local/bast/DBIx-Class:3159
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/branches/on_disconnect_do:3694
bd8105ee-0ff8-0310-8827-fb3f25b6796d:/DBIx-Class/0.08/trunk:3782
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/jdbicompat/Changes
===================================================================
--- DBIx-Class/0.08/branches/jdbicompat/Changes	2007-09-26 01:39:33 UTC (rev 3783)
+++ DBIx-Class/0.08/branches/jdbicompat/Changes	2007-09-26 02:08:37 UTC (rev 3784)
@@ -1,4 +1,38 @@
 Revision history for DBIx::Class
+
+        - When adding relationships, it will throw an exception if you get the
+          foreign and self parts the wrong way round in the condition
+
+0.08007 2007-09-04 19:36:00
+        - patch for Oracle datetime inflation (abram at arin.net)
+        - added on_disconnect_do
+        - on_connect_do and on_disconnect_do take coderefs and arrayrefs
+
+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/jdbicompat/Makefile.PL
===================================================================
--- DBIx-Class/0.08/branches/jdbicompat/Makefile.PL	2007-09-26 01:39:33 UTC (rev 3783)
+++ DBIx-Class/0.08/branches/jdbicompat/Makefile.PL	2007-09-26 02:08:37 UTC (rev 3784)
@@ -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;
@@ -21,16 +22,18 @@
 # Perl 5.8.0 doesn't have utf8::is_utf8()
 requires 'Encode'                    => 0 if ($] <= 5.008000);  
 
-build_requires 'DBD::SQLite'         => 1.11;
+build_requires 'DBD::SQLite'         => 1.13;
 build_requires 'Test::Builder'       => 0.33;
 
 install_script 'script/dbicadmin';
 
 tests "t/*.t t/*/*.t";
 
-# re-build README if we're in an svk checkout
-if( -e 'MANIFEST.SKIP' ) {
-    system('pod2text lib/DBIx/Class.pm > README');
+# re-build README and require CDBI modules for testing if we're in a checkout
+if( -e 'inc/.author' ) {
+  build_requires 'DBIx::ContextualFetch';
+  build_requires 'Class::Trigger';
+  system('pod2text lib/DBIx/Class.pm > README');
 }
 
 auto_provides;

Modified: DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/AccessorGroup.pm
===================================================================
--- DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/AccessorGroup.pm	2007-09-26 01:39:33 UTC (rev 3783)
+++ DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/AccessorGroup.pm	2007-09-26 02:08:37 UTC (rev 3784)
@@ -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/jdbicompat/lib/DBIx/Class/Componentised.pm
===================================================================
--- DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Componentised.pm	2007-09-26 01:39:33 UTC (rev 3783)
+++ DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Componentised.pm	2007-09-26 02:08:37 UTC (rev 3784)
@@ -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/jdbicompat/lib/DBIx/Class/InflateColumn/DateTime.pm
===================================================================
--- DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/InflateColumn/DateTime.pm	2007-09-26 01:39:33 UTC (rev 3783)
+++ DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/InflateColumn/DateTime.pm	2007-09-26 02:08:37 UTC (rev 3784)
@@ -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/jdbicompat/lib/DBIx/Class/Manual/Cookbook.pod
===================================================================
--- DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Manual/Cookbook.pod	2007-09-26 01:39:33 UTC (rev 3783)
+++ DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Manual/Cookbook.pod	2007-09-26 02:08:37 UTC (rev 3784)
@@ -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/jdbicompat/lib/DBIx/Class/Manual/FAQ.pod
===================================================================
--- DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Manual/FAQ.pod	2007-09-26 01:39:33 UTC (rev 3783)
+++ DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Manual/FAQ.pod	2007-09-26 02:08:37 UTC (rev 3784)
@@ -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.
@@ -285,6 +285,18 @@
 If supported by the database, slice will use LIMIT/OFFSET to hint to the database that we
 really only need one row. This can result in a significant speed improvement.
 
+=item .. refresh a row from storage?
+
+Use L<DBIx::Class::PK/discard_changes>.
+
+  $row->discard_changes
+
+Discarding changes and refreshing from storage are two sides fo the same coin.  When you
+want to discard your local changes, just re-fetch the row from storage.  When you want
+to get a new, fresh copy of the row, just re-fetch the row from storage.
+L<DBIx::Class::PK/discard_changes> does just that by re-fetching the row from storage
+using the row's primary key.
+
 =back
 
 =head2 Inserting and updating data
@@ -398,6 +410,6 @@
 particular column or group of columns (a-la cdbi Stringfy column
 group, or stringify_self method) ?
 
-See L<Cookbook/Stringification>
+See L<DBIx::Class::Manual::Cookbook/Stringification>
 
 =back

Modified: DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Manual/Intro.pod
===================================================================
--- DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Manual/Intro.pod	2007-09-26 01:39:33 UTC (rev 3783)
+++ DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Manual/Intro.pod	2007-09-26 02:08:37 UTC (rev 3784)
@@ -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/jdbicompat/lib/DBIx/Class/PK.pm
===================================================================
--- DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/PK.pm	2007-09-26 01:39:33 UTC (rev 3783)
+++ DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/PK.pm	2007-09-26 02:08:37 UTC (rev 3784)
@@ -30,6 +30,9 @@
 Re-selects the row from the database, losing any changes that had
 been made.
 
+This method can also be used to refresh from storage, retrieving any
+changes made since the row was last read from storage.
+
 =cut
 
 sub discard_changes {

Modified: DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Relationship.pm
===================================================================
--- DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Relationship.pm	2007-09-26 01:39:33 UTC (rev 3783)
+++ DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Relationship.pm	2007-09-26 02:08:37 UTC (rev 3784)
@@ -115,6 +115,44 @@
 
 =back
 
+Creates a relationship where the calling class stores the foreign class's
+primary key in one (or more) of its columns. This relationship defaults to
+using C<$accessor_name> as the foreign key in C<$related_class> to resolve the
+join, unless C<$foreign_key_column> specifies the foreign key column in
+C<$related_class> or C<$cond> specifies a reference to a join condition hash.
+
+=over
+
+=item accessor_name
+
+This argument is the name of the method you can call on a
+L<DBIx::Class::Row> object to retrieve the instance of the foreign
+class matching this relationship.
+
+Use this accessor_name (relation name) in L<DBIx::Class::ResultSet/join>
+or L<DBIx::Class::ResultSet/prefetch> to join to the foreign table
+indicated by this relationship.
+
+=item related_class
+
+This is the class name of the table referenced by the foreign key in
+this class.
+
+=item foreign_key_column
+
+The column name on this class that contains the foreign key.
+
+OR
+
+=item cond
+
+A hashref where the keys are C<foreign.$column_on_related_table> and
+the values are C<self.$foreign_key_column>. This is useful for
+relations that are across multiple columns.
+
+=back
+
+
   # in a Book class (where Author has many Books)
   My::DBIC::Schema::Book->belongs_to( author => 'My::DBIC::Schema::Author' );
 
@@ -127,12 +165,6 @@
                                       'My::DBIC::Schema::Author',
                                       { 'foreign.author' => 'self.author' } );
 
-Creates a relationship where the calling class stores the foreign class's
-primary key in one (or more) of its columns. This relationship defaults to
-using C<$accessor_name> as the foreign key in C<$related_class> to resolve the
-join, unless C<$foreign_key_column> specifies the foreign key column in
-C<$related_class> or C<$cond> specifies a reference to a join condition hash.
-
 If the relationship is optional -- i.e. the column containing the foreign key
 can be NULL -- then the belongs_to relationship does the right thing. Thus, in
 the example above C<$obj-E<gt>author> would return C<undef>.  However in this
@@ -163,6 +195,45 @@
 
 =back
 
+Creates a one-to-many relationship, where the corresponding elements of the
+foreign class store the calling class's primary key in one (or more) of its
+columns. This relationship defaults to using C<$accessor_name> as the foreign
+key in C<$related_class> to resolve the join, unless C<$foreign_key_column>
+specifies the foreign key column in C<$related_class> or C<$cond> specifies a
+reference to a join condition hash.
+
+=over
+
+=item accessor_name
+
+This argument is the name of the method you can call on a
+L<DBIx::Class::Row> object to retrieve a resultset of the related
+class restricted to the ones related to the row object. In list
+context it returns the row objects.
+
+Use this accessor_name (relation name) in L<DBIx::Class::ResultSet/join>
+or L<DBIx::Class::ResultSet/prefetch> to join to the foreign table
+indicated by this relationship.
+
+=item related_class
+
+This is the class name of the table which contains a foreign key
+column containing PK values of this class.
+
+=item foreign_key_column
+
+The column name on the related class that contains the foreign key.
+
+OR
+
+=item cond
+
+A hashref where the keys are C<foreign.$column_on_related_table> and
+the values are C<self.$foreign_key_column>. This is useful for
+relations that are across multiple columns.
+
+=back
+
   # in an Author class (where Author has_many Books)
   My::DBIC::Schema::Author->has_many(books => 'My::DBIC::Schema::Book', 'author');
 
@@ -184,13 +255,6 @@
     'foreign.author' => 'self.author',
   });
 
-Creates a one-to-many relationship, where the corresponding elements of the
-foreign class store the calling class's primary key in one (or more) of its
-columns. This relationship defaults to using C<$accessor_name> as the foreign
-key in C<$related_class> to resolve the join, unless C<$foreign_key_column>
-specifies the foreign key column in C<$related_class> or C<$cond> specifies a
-reference to a join condition hash.
-
 Three methods are created when you create a has_many relationship.  The first
 method is the expected accessor method, C<$accessor_name()>.  The second is
 almost exactly the same as the accessor method but "_rs" is added to the end of
@@ -217,6 +281,43 @@
 
 =back
 
+Creates an optional one-to-one relationship with a class. This relationship
+defaults to using C<$accessor_name> as the foreign key in C<$related_class> to
+resolve the join, unless C<$foreign_key_column> specifies the foreign key
+column in C<$related_class> or C<$cond> specifies a reference to a join
+condition hash.
+
+=over
+
+=item accessor_name
+
+This argument is the name of the method you can call on a
+L<DBIx::Class::Row> object to retrieve the instance of the foreign
+class matching this relationship.
+
+Use this accessor_name (relation name) in L<DBIx::Class::ResultSet/join>
+or L<DBIx::Class::ResultSet/prefetch> to join to the foreign table
+indicated by this relationship.
+
+=item related_class
+
+This is the class name of the table which contains a foreign key
+column containing PK values of this class.
+
+=item foreign_key_column
+
+The column name on the related class that contains the foreign key.
+
+OR
+
+=item cond
+
+A hashref where the keys are C<foreign.$column_on_related_table> and
+the values are C<self.$foreign_key_column>. This is useful for
+relations that are across multiple columns.
+
+=back
+
   My::DBIC::Schema::Author->might_have( pseudonym =>
                                         'My::DBIC::Schema::Pseudonym' );
 
@@ -234,14 +335,6 @@
                                         'My::DBIC::Schema::Pseudonym',
                                         { 'foreign.author' => 'self.author' } );
 
-Assuming the Pseudonym table has
-
-Creates an optional one-to-one relationship with a class. This relationship
-defaults to using C<$accessor_name> as the foreign key in C<$related_class> to
-resolve the join, unless C<$foreign_key_column> specifies the foreign key
-column in C<$related_class> or C<$cond> specifies a reference to a join
-condition hash.
-
 If you update or delete an object in a class with a C<might_have>
 relationship, the related object will be updated or deleted as well. To
 turn off this behavior, add C<< cascade_delete => 0 >> to the C<$attr>
@@ -287,6 +380,37 @@
 
 =back
 
+C<many_to_many> is not strictly a relationship in its own right. Instead, it is
+a bridge between two resultsets which provide the same kind of convenience
+accessors as true relationships provide. Although the accessor will return a 
+resultset or collection of objects just like has_many does, you cannot call 
+C<related_resultset> and similar methods which operate on true relationships.
+
+=over
+
+=item accessor_name
+
+This argument is the name of the method you can call on a
+L<DBIx::Class::Row> object to retrieve the rows matching this
+relationship.
+
+On a many_to_many, unlike other relationships, this cannot be used in
+L<DBIx::Class::ResultSet/search> to join tables. Use the relations
+bridged across instead.
+
+=item link_rel_name
+
+This is the accessor_name from the has_many relationship we are
+bridging from.
+
+=item foreign_rel_name
+
+This is the accessor_name of the belongs_to relationship in the link
+table that we are bridging across (which gives us the table we are
+bridging to).
+
+=back
+
 To create a many_to_many relationship from Actor to Role:
 
   My::DBIC::Schema::Actor->has_many( actor_roles =>
@@ -313,12 +437,6 @@
 
   $actor->add_to_roles($role, { year => 1995 });
 
-Many_to_many is not strictly a relationship in its own right. Instead, it is
-a bridge between two resultsets which provide the same kind of convenience
-accessors as true relationships provide. Although the accessor will return a 
-resultset or collection of objects just like has_many does, you cannot call 
-C<$related_resultset> and similar methods which operate on true relationships.
-
 In the above example, ActorRoles is the link table class, and Role is the
 foreign class. The C<$link_rel_name> parameter is the name of the accessor for
 the has_many relationship from this table to the link table, and the

Modified: DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/ResultClass/HashRefInflator.pm
===================================================================
--- DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/ResultClass/HashRefInflator.pm	2007-09-26 01:39:33 UTC (rev 3783)
+++ DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/ResultClass/HashRefInflator.pm	2007-09-26 02:08:37 UTC (rev 3784)
@@ -23,13 +23,13 @@
 =item *
 
 Specify C<< $rs->result_class >> on a specific resultset to affect only that
-resultser (and any chained off of it); or
+resultset (and any chained off of it); or
 
 =item *
 
 Specify C<< __PACKAGE__->result_class >> on your source object to force all
 uses of that result source to be inflated to hash-refs - this approach is not
-recomended
+recommended.
 
 =back
 

Modified: DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/ResultSet.pm
===================================================================
--- DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/ResultSet.pm	2007-09-26 01:39:33 UTC (rev 3783)
+++ DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/ResultSet.pm	2007-09-26 02:08:37 UTC (rev 3784)
@@ -971,7 +971,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;
 }
@@ -1251,7 +1251,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
@@ -1288,6 +1288,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
 
@@ -1409,7 +1417,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
@@ -1422,8 +1430,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 {
@@ -1540,10 +1553,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 {
@@ -1737,7 +1799,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;
     
@@ -1748,7 +1810,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;
 
@@ -1759,21 +1821,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;
   };
@@ -2136,13 +2209,12 @@
 
 =back
 
-Indicates column names for object inflation. That is, c< as >
+Indicates column names for object inflation. That is, C<as>
 indicates the name that the column can be accessed as via the
 C<get_column> method (or via the object accessor, B<if one already
-exists>).  It has nothing to do with the SQL code C< SELECT foo AS bar
->.
+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:
 
@@ -2254,10 +2326,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/jdbicompat/lib/DBIx/Class/ResultSource.pm
===================================================================
--- DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/ResultSource.pm	2007-09-26 01:39:33 UTC (rev 3783)
+++ DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/ResultSource.pm	2007-09-26 02:08:37 UTC (rev 3784)
@@ -81,6 +81,10 @@
 the hashref as the column_info for that column. Repeated calls of this
 method will add more columns, not replace them.
 
+The column names given will be created as accessor methods on your
+L<DBIx::Class::Row> objects, you can change the name of the accessor
+by supplying an L</accessor> in the column_info hash.
+
 The contents of the column_info are not set in stone. The following
 keys are currently recognised/used by DBIx::Class:
 
@@ -88,7 +92,7 @@
 
 =item accessor
 
-Use this to set the name of the accessor for this column. If unset,
+Use this to set the name of the accessor method for this column. If unset,
 the name of the column will be used.
 
 =item data_type
@@ -515,6 +519,14 @@
     unless $cond;
   $attrs ||= {};
 
+  # Check foreign and self are right in cond
+  if ( (ref $cond ||'') eq 'HASH') {
+    for (keys %$cond) {
+      $self->throw_exception("Keys of condition should be of form 'foreign.col', not '$_'")
+        if /\./ && !/^foreign\./;
+    }
+  }
+
   my %rels = %{ $self->_relationships };
   $rels{$rel} = { class => $f_source_name,
                   source => $f_source_name,
@@ -988,7 +1000,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/jdbicompat/lib/DBIx/Class/ResultSourceProxy/Table.pm
===================================================================
--- DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/ResultSourceProxy/Table.pm	2007-09-26 01:39:33 UTC (rev 3783)
+++ DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/ResultSourceProxy/Table.pm	2007-09-26 02:08:37 UTC (rev 3784)
@@ -63,6 +63,7 @@
     $class =~ m/([^:]+)$/;
     $class->schema_instance->register_class($class, $class);
   }
+  return $class->result_source_instance->name;
 }
 
 =head2 has_column

Modified: DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Row.pm
===================================================================
--- DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Row.pm	2007-09-26 01:39:33 UTC (rev 3783)
+++ DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Row.pm	2007-09-26 02:08:37 UTC (rev 3784)
@@ -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().
@@ -137,6 +139,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 {
@@ -188,7 +193,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}) {
@@ -259,7 +263,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/jdbicompat/lib/DBIx/Class/Schema/Versioned.pm
===================================================================
--- DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Schema/Versioned.pm	2007-09-26 01:39:33 UTC (rev 3783)
+++ DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Schema/Versioned.pm	2007-09-26 02:08:37 UTC (rev 3784)
@@ -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/jdbicompat/lib/DBIx/Class/Schema.pm
===================================================================
--- DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Schema.pm	2007-09-26 01:39:33 UTC (rev 3783)
+++ DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Schema.pm	2007-09-26 02:08:37 UTC (rev 3784)
@@ -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/jdbicompat/lib/DBIx/Class/Storage/DBI/Cursor.pm
===================================================================
--- DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Storage/DBI/Cursor.pm	2007-09-26 01:39:33 UTC (rev 3783)
+++ DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Storage/DBI/Cursor.pm	2007-09-26 02:08:37 UTC (rev 3784)
@@ -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/jdbicompat/lib/DBIx/Class/Storage/DBI/ODBC/DB2_400_SQL.pm
===================================================================
--- DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Storage/DBI/ODBC/DB2_400_SQL.pm	2007-09-26 01:39:33 UTC (rev 3783)
+++ DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Storage/DBI/ODBC/DB2_400_SQL.pm	2007-09-26 02:08:37 UTC (rev 3784)
@@ -56,7 +56,7 @@
 
 =head1 AUTHORS
 
-Marc Mims C<< <marc at sssonline.com> >>
+Marc Mims C<< <marc at questright.com> >>
 
 Based on DBIx::Class::Storage::DBI::DB2 by Jess Robinson.
 

Modified: DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Storage/DBI/ODBC.pm
===================================================================
--- DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Storage/DBI/ODBC.pm	2007-09-26 01:39:33 UTC (rev 3783)
+++ DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Storage/DBI/ODBC.pm	2007-09-26 02:08:37 UTC (rev 3784)
@@ -39,7 +39,7 @@
 
 =head1 AUTHORS
 
-Marc Mims C<< <marc at sssonline.com> >>
+Marc Mims C<< <marc at questright.com> >>
 
 =head1 LICENSE
 

Modified: DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm
===================================================================
--- DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm	2007-09-26 01:39:33 UTC (rev 3783)
+++ DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Storage/DBI/Oracle/Generic.pm	2007-09-26 02:08:37 UTC (rev 3784)
@@ -84,6 +84,15 @@
   $self->next::method(uc($table));
 }
 
+=head2 datetime_parser_type
+
+This sets the proper DateTime::Format module for use with
+L<DBIx::Class::InflateColumn::DateTime>.
+
+=cut
+
+sub datetime_parser_type { return "DateTime::Format::Oracle"; }
+
 =head1 AUTHORS
 
 Andy Grundman <andy at hybridized.org>

Modified: DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Storage/DBI/SQLite.pm
===================================================================
--- DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Storage/DBI/SQLite.pm	2007-09-26 01:39:33 UTC (rev 3783)
+++ DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Storage/DBI/SQLite.pm	2007-09-26 02:08:37 UTC (rev 3784)
@@ -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/jdbicompat/lib/DBIx/Class/Storage/DBI.pm
===================================================================
--- DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Storage/DBI.pm	2007-09-26 01:39:33 UTC (rev 3783)
+++ DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Storage/DBI.pm	2007-09-26 02:08:37 UTC (rev 3784)
@@ -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
-       transaction_depth unsafe _dbh_autocommit/
+       _conn_pid _conn_tid disable_sth_caching on_connect_do
+       on_disconnect_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;
@@ -346,10 +347,31 @@
 
 =item on_connect_do
 
-This can be set to an arrayref of literal sql statements, which will
-be executed immediately after making the connection to the database
-every time we [re-]connect.
+Specifies things to do immediately after connecting or re-connecting to
+the database.  Its value may contain:
 
+=over
+
+=item an array reference
+
+This contains SQL statements to execute in order.  Each element contains
+a string or a code reference that returns a string.
+
+=item a code reference
+
+This contains some code to execute.  Unlike code references within an
+array reference, its return value is ignored.
+
+=back
+
+=item on_disconnect_do
+
+Takes arguments in the same form as L<on_connect_do> and executes them
+immediately before disconnecting from the database.
+
+Note, this only runs if you explicitly call L<disconnect> on the
+storage object.
+
 =item disable_sth_caching
 
 If set to a true value, this option will disable the caching of
@@ -480,7 +502,10 @@
   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/) {
+    my @storage_option = qw(
+      on_connect_do on_disconnect_do disable_sth_caching unsafe cursor_class
+    );
+    for my $storage_opt (@storage_option) {
       if(my $value = delete $last_info->{$storage_opt}) {
         $self->$storage_opt($value);
       }
@@ -647,6 +672,9 @@
   my ($self) = @_;
 
   if( $self->connected ) {
+    my $connection_do = $self->on_disconnect_do;
+    $self->_do_connection_actions($connection_do) if ref($connection_do);
+
     $self->_dbh->rollback unless $self->_dbh_autocommit;
     $self->_dbh->disconnect;
     $self->_dbh(undef);
@@ -665,6 +693,7 @@
       }
       else {
           $self->_verify_pid;
+          return 0 if !$self->_dbh;
       }
       return ($dbh->FETCH('Active') && $dbh->ping);
   }
@@ -738,17 +767,44 @@
     }
   }
 
-  # 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->_dbh->do($sql_statement);
-    $self->debugobj->query_end($sql_statement) if $self->debug();
-  }
+  my $connection_do = $self->on_connect_do;
+  $self->_do_connection_actions($connection_do) if ref($connection_do);
 
   $self->_conn_pid($$);
   $self->_conn_tid(threads->tid) if $INC{'threads.pm'};
 }
 
+sub _do_connection_actions {
+  my $self = shift;
+  my $connection_do = shift;
+
+  if (ref $connection_do eq 'ARRAY') {
+    $self->_do_query($_) foreach @$connection_do;
+  }
+  elsif (ref $connection_do eq 'CODE') {
+    $connection_do->();
+  }
+
+  return $self;
+}
+
+sub _do_query {
+  my ($self, $action) = @_;
+
+  if (ref $action eq 'CODE') {
+    $action = $action->($self);
+    $self->_do_query($_) foreach @$action;
+  }
+  else {
+    my @to_run = (ref $action eq 'ARRAY') ? (@$action) : ($action);
+    $self->_query_start(@to_run);
+    $self->_dbh->do(@to_run);
+    $self->_query_end(@to_run);
+  }
+
+  return $self;
+}
+
 sub _connect {
   my ($self, @info) = @_;
 
@@ -770,7 +826,7 @@
        $dbh = DBI->connect(@info);
     }
 
-    if(!$self->unsafe) {
+    if($dbh && !$self->unsafe) {
       my $weak_self = $self;
       weaken($weak_self);
       $dbh->{HandleError} = sub {
@@ -864,6 +920,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 +963,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 +990,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 +1022,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 +1060,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);
 }
 
@@ -1061,7 +1137,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 {
@@ -1414,14 +1490,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/jdbicompat/lib/DBIx/Class/Storage/Statistics.pm
===================================================================
--- DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Storage/Statistics.pm	2007-09-26 01:39:33 UTC (rev 3783)
+++ DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Storage/Statistics.pm	2007-09-26 02:08:37 UTC (rev 3784)
@@ -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/jdbicompat/lib/DBIx/Class/Storage.pm
===================================================================
--- DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Storage.pm	2007-09-26 01:39:33 UTC (rev 3783)
+++ DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class/Storage.pm	2007-09-26 02:08:37 UTC (rev 3784)
@@ -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/jdbicompat/lib/DBIx/Class.pm
===================================================================
--- DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class.pm	2007-09-26 01:39:33 UTC (rev 3783)
+++ DBIx-Class/0.08/branches/jdbicompat/lib/DBIx/Class.pm	2007-09-26 02:08:37 UTC (rev 3784)
@@ -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.08007';
 
 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
@@ -259,6 +265,8 @@
 
 Todd Lipcon
 
+Tom Hukins
+
 typester: Daisuke Murase <typester at cpan.org>
 
 victori: Victor Igumnov <victori at cpan.org>

Modified: DBIx-Class/0.08/branches/jdbicompat/lib/SQL/Translator/Parser/DBIx/Class.pm
===================================================================
--- DBIx-Class/0.08/branches/jdbicompat/lib/SQL/Translator/Parser/DBIx/Class.pm	2007-09-26 01:39:33 UTC (rev 3783)
+++ DBIx-Class/0.08/branches/jdbicompat/lib/SQL/Translator/Parser/DBIx/Class.pm	2007-09-26 02:08:37 UTC (rev 3784)
@@ -128,7 +128,6 @@
 
             if($rel_table)
             {
-
                 my $reverse_rels = $source->reverse_relationship_info($rel);
                 my ($otherrelname, $otherrelationship) = each %{$reverse_rels};
 
@@ -145,7 +144,6 @@
 
                 #Decide if this is a foreign key based on whether the self
                 #items are our primary columns.
-                $DB::single = 1 if $moniker eq 'Tests::MBTI::Result';
 
                 # If the sets are different, then we assume it's a foreign key from
                 # us to another table.

Modified: DBIx-Class/0.08/branches/jdbicompat/t/03podcoverage.t
===================================================================
--- DBIx-Class/0.08/branches/jdbicompat/t/03podcoverage.t	2007-09-26 01:39:33 UTC (rev 3783)
+++ DBIx-Class/0.08/branches/jdbicompat/t/03podcoverage.t	2007-09-26 02:08:37 UTC (rev 3784)
@@ -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/jdbicompat/t/05components.t
===================================================================
--- DBIx-Class/0.08/branches/jdbicompat/t/05components.t	2007-09-26 01:39:33 UTC (rev 3783)
+++ DBIx-Class/0.08/branches/jdbicompat/t/05components.t	2007-09-26 02:08:37 UTC (rev 3784)
@@ -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/jdbicompat/t/33storage_reconnect.t
===================================================================
--- DBIx-Class/0.08/branches/jdbicompat/t/33storage_reconnect.t	2007-09-26 01:39:33 UTC (rev 3783)
+++ DBIx-Class/0.08/branches/jdbicompat/t/33storage_reconnect.t	2007-09-26 02:08:37 UTC (rev 3784)
@@ -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/jdbicompat/t/50fork.t
===================================================================
--- DBIx-Class/0.08/branches/jdbicompat/t/50fork.t	2007-09-26 01:39:33 UTC (rev 3783)
+++ DBIx-Class/0.08/branches/jdbicompat/t/50fork.t	2007-09-26 02:08:37 UTC (rev 3784)
@@ -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/jdbicompat/t/60core.t
===================================================================
--- DBIx-Class/0.08/branches/jdbicompat/t/60core.t	2007-09-26 01:39:33 UTC (rev 3783)
+++ DBIx-Class/0.08/branches/jdbicompat/t/60core.t	2007-09-26 02:08:37 UTC (rev 3784)
@@ -7,7 +7,7 @@
 
 my $schema = DBICTest->init_schema();
 
-plan tests => 77;
+plan tests => 78;
 
 eval { require DateTime::Format::MySQL };
 my $NO_DTFM = $@ ? 1 : 0;
@@ -337,3 +337,10 @@
     is($edata{'created_on'}, $event->created_on, 'got created date');
 }
 
+# test resultsource->table return value when setting
+{
+    my $class = $schema->class('Event');
+    diag $class;
+    my $table = $class->table($class->table);
+    is($table, $class->table, '->table($table) returns $table');
+}

Modified: DBIx-Class/0.08/branches/jdbicompat/t/67pager.t
===================================================================
--- DBIx-Class/0.08/branches/jdbicompat/t/67pager.t	2007-09-26 01:39:33 UTC (rev 3783)
+++ DBIx-Class/0.08/branches/jdbicompat/t/67pager.t	2007-09-26 02:08:37 UTC (rev 3784)
@@ -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');

Added: DBIx-Class/0.08/branches/jdbicompat/t/73oracle_inflate.t
===================================================================
--- DBIx-Class/0.08/branches/jdbicompat/t/73oracle_inflate.t	                        (rev 0)
+++ DBIx-Class/0.08/branches/jdbicompat/t/73oracle_inflate.t	2007-09-26 02:08:37 UTC (rev 3784)
@@ -0,0 +1,64 @@
+use strict;
+use warnings;  
+
+use Test::More;
+use lib qw(t/lib);
+use DBICTest;
+
+my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_ORA_${_}" } qw/DSN USER PASS/};
+
+eval "use DateTime; use DateTime::Format::Oracle;";
+if ($@) {
+    plan skip_all => 'needs DateTime and DateTime::Format::Oracle for testing';
+}
+elsif (not ($dsn && $user && $pass)) {
+    plan skip_all => 'Set $ENV{DBICTEST_ORA_DSN}, _USER and _PASS to run this test. ' .
+         'Warning: This test drops and creates a table called \'track\'';
+}
+else {
+    plan tests => 4;
+}
+
+# DateTime::Format::Oracle needs this set
+$ENV{NLS_DATE_FORMAT} = 'DD-MON-YY';
+
+my $schema = DBICTest::Schema->connect($dsn, $user, $pass);
+
+# Need to redefine the last_updated_on column
+my $col_metadata = $schema->class('Track')->column_info('last_updated_on');
+$schema->class('Track')->add_column( 'last_updated_on' => {
+    data_type => 'date' });
+
+my $dbh = $schema->storage->dbh;
+
+eval {
+  $dbh->do("DROP TABLE track");
+};
+$dbh->do("CREATE TABLE track (trackid NUMBER(12), cd NUMBER(12), position NUMBER(12), title VARCHAR(255), last_updated_on DATE)");
+
+# insert a row to play with
+my $new = $schema->resultset('Track')->create({ trackid => 1, cd => 1, position => 1, title => 'Track1', last_updated_on => '06-MAY-07' });
+is($new->trackid, 1, "insert sucessful");
+
+my $track = $schema->resultset('Track')->find( 1 );
+
+is( ref($track->last_updated_on), 'DateTime', "last_updated_on inflated ok");
+
+is( $track->last_updated_on->month, 5, "DateTime methods work on inflated column");
+
+my $dt = DateTime->now();
+$track->last_updated_on($dt);
+$track->update;
+
+is( $track->last_updated_on->month, $dt->month, "deflate ok");
+
+# clean up our mess
+END {
+    # Set the metadata back for the last_updated_on column
+    $schema->class('Track')->add_column( 'last_updated_on' => $col_metadata );
+
+    if($dbh) {
+        $dbh->do("DROP TABLE track");
+    }
+}
+

Modified: DBIx-Class/0.08/branches/jdbicompat/t/91debug.t
===================================================================
--- DBIx-Class/0.08/branches/jdbicompat/t/91debug.t	2007-09-26 01:39:33 UTC (rev 3783)
+++ DBIx-Class/0.08/branches/jdbicompat/t/91debug.t	2007-09-26 02:08:37 UTC (rev 3784)
@@ -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;

Added: DBIx-Class/0.08/branches/jdbicompat/t/92storage_on_connect_do.t
===================================================================
--- DBIx-Class/0.08/branches/jdbicompat/t/92storage_on_connect_do.t	                        (rev 0)
+++ DBIx-Class/0.08/branches/jdbicompat/t/92storage_on_connect_do.t	2007-09-26 02:08:37 UTC (rev 3784)
@@ -0,0 +1,70 @@
+use strict;
+use warnings;
+
+use Test::More tests => 9;
+
+use lib qw(t/lib);
+use base 'DBICTest';
+
+
+my $schema = DBICTest->init_schema(
+    no_connect  => 1,
+    no_deploy   => 1,
+);
+ok $schema->connection(
+    DBICTest->_database,
+    {
+        on_connect_do       => [
+            'CREATE TABLE TEST_empty (id INTEGER)',
+            [ 'INSERT INTO TEST_empty VALUES (?)', {}, 2 ],
+            \&insert_from_subref,
+        ],
+        on_disconnect_do    =>
+            [\&check_exists, 'DROP TABLE TEST_empty', \&check_dropped],
+    },
+), 'connection()';
+
+is_deeply
+  $schema->storage->dbh->selectall_arrayref('SELECT * FROM TEST_empty'),
+  [ [ 2 ], [ 3 ], [ 7 ] ],
+  'on_connect_do() worked';
+eval { $schema->storage->dbh->do('SELECT 1 FROM TEST_nonexistent'); };
+ok $@, 'Searching for nonexistent table dies';
+
+$schema->storage->disconnect();
+
+my($connected, $disconnected);
+ok $schema->connection(
+    DBICTest->_database,
+    {
+        on_connect_do       => sub { $connected = 1 },
+        on_disconnect_do    => sub { $disconnected = 1 },
+    },
+), 'second connection()';
+$schema->storage->dbh->do('SELECT 1');
+ok $connected, 'on_connect_do() called after connect()';
+ok ! $disconnected, 'on_disconnect_do() not called after connect()';
+$schema->storage->disconnect();
+ok $disconnected, 'on_disconnect_do() called after disconnect()';
+
+
+sub check_exists {
+    my $storage = shift;
+    ok $storage->dbh->do('SELECT 1 FROM TEST_empty'), 'Table still exists';
+    return;
+}
+
+sub check_dropped {
+    my $storage = shift;
+    eval { $storage->dbh->do('SELECT 1 FROM TEST_empty'); };
+    ok $@, 'Reading from dropped table fails';
+    return;
+}
+
+sub insert_from_subref {
+    my $storage = shift;
+    return [
+        [ 'INSERT INTO TEST_empty VALUES (?)', {}, 3 ],
+        'INSERT INTO TEST_empty VALUES (7)',
+    ];
+}

Modified: DBIx-Class/0.08/branches/jdbicompat/t/cdbi-t/11-triggers.t
===================================================================
--- DBIx-Class/0.08/branches/jdbicompat/t/cdbi-t/11-triggers.t	2007-09-26 01:39:33 UTC (rev 3783)
+++ DBIx-Class/0.08/branches/jdbicompat/t/cdbi-t/11-triggers.t	2007-09-26 02:08:37 UTC (rev 3784)
@@ -25,13 +25,11 @@
 
 sub default_rating { $_[0]->Rating(15); }
 
-Film->add_trigger(
-	before_create => \&default_rating,
-	after_create  => \&create_trigger2,
-	after_delete  => \&delete_trigger,
-	before_update => \&pre_up_trigger,
-	after_update  => \&pst_up_trigger,
-);
+Film->add_trigger(before_create => \&default_rating);
+Film->add_trigger(after_create  => \&create_trigger2);
+Film->add_trigger(after_delete  => \&delete_trigger);
+Film->add_trigger(before_update => \&pre_up_trigger);
+Film->add_trigger(after_update  => \&pst_up_trigger);
 
 ok(
 	my $ver = Film->create({

Modified: DBIx-Class/0.08/branches/jdbicompat/t/lib/DBICTest.pm
===================================================================
--- DBIx-Class/0.08/branches/jdbicompat/t/lib/DBICTest.pm	2007-09-26 01:39:33 UTC (rev 3783)
+++ DBIx-Class/0.08/branches/jdbicompat/t/lib/DBICTest.pm	2007-09-26 02:08:37 UTC (rev 3784)
@@ -42,9 +42,8 @@
 
 =cut
 
-sub init_schema {
+sub _database {
     my $self = shift;
-    my %args = @_;
     my $db_file = "t/var/DBIxClass.db";
 
     unlink($db_file) if -e $db_file;
@@ -55,19 +54,28 @@
     my $dbuser = $ENV{"DBICTEST_DBUSER"} || '';
     my $dbpass = $ENV{"DBICTEST_DBPASS"} || '';
 
+    my @connect_info = ($dsn, $dbuser, $dbpass, { AutoCommit => 1 });
+
+    return @connect_info;
+}
+
+sub init_schema {
+    my $self = shift;
+    my %args = @_;
+
     my $schema;
 
-    my @connect_info = ($dsn, $dbuser, $dbpass, { AutoCommit => 1 });
-
     if ($args{compose_connection}) {
       $schema = DBICTest::Schema->compose_connection(
-                  'DBICTest', @connect_info
+                  'DBICTest', $self->_database
                 );
     } else {
-      $schema = DBICTest::Schema->compose_namespace('DBICTest')
-                                ->connect(@connect_info);
+      $schema = DBICTest::Schema->compose_namespace('DBICTest');
     }
-    $schema->storage->on_connect_do(['PRAGMA synchronous = OFF']);
+    if ( !$args{no_connect} ) {
+      $schema = $schema->connect($self->_database);
+      $schema->storage->on_connect_do(['PRAGMA synchronous = OFF']);
+    }
     if ( !$args{no_deploy} ) {
         __PACKAGE__->deploy_schema( $schema );
         __PACKAGE__->populate_schema( $schema ) if( !$args{no_populate} );




More information about the Bast-commits mailing list