Merge 'DBIx-Class-current' into 'bulk_create'
Jess Robinson [Fri, 18 May 2007 12:24:00 +0000 (12:24 +0000)]
r3302@lilith (orig r3300):  matthewt | 2007-05-11 04:54:27 +0100
eliminate the last of the AutoCommit warnings
r3304@lilith (orig r3302):  matthewt | 2007-05-11 13:38:18 +0100
fixup for Oracle WHERE join stuff from abraxxa
r3310@lilith (orig r3308):  claco | 2007-05-12 02:31:37 +0100
Require CAG 0.05002 to kill Class::Inspector warnings.

r3317@lilith (orig r3315):  blblack | 2007-05-14 23:59:07 +0100
default AutoCommit to 1 if not explicitly set, and stop warning about it

Changes
Makefile.PL
lib/DBIx/Class/Schema.pm
lib/DBIx/Class/Storage/DBI.pm
lib/DBIx/Class/Storage/DBI/Oracle/WhereJoins.pm
t/lib/DBICTest.pm

diff --git a/Changes b/Changes
index b135908..d4cc20e 100644 (file)
--- a/Changes
+++ b/Changes
@@ -9,7 +9,7 @@ Revision history for DBIx::Class
           is_foreign_key_constrain to allow explicit control over wether or
           not a foreign constraint is needed
         - resultset_class/result_class now (again) auto loads the specified
-          class; requires Class::Accessor::Grouped 0.05001+
+          class; requires Class::Accessor::Grouped 0.05002+
 
 0.07006 2007-04-17 23:18:00
         - Lots of documentation updates
index 10deaa1..a8319c5 100644 (file)
@@ -15,7 +15,7 @@ requires 'Carp::Clan'                => 0;
 requires 'DBI'                       => 1.40;
 requires 'Module::Find'              => 0;
 requires 'Class::Inspector'          => 0;
-requires 'Class::Accessor::Grouped'  => 0.05001;
+requires 'Class::Accessor::Grouped'  => 0.05002;
 requires 'JSON'                      => 1.00; 
 
 # Perl 5.8.0 doesn't have utf8::is_utf8()
index 223dbd3..b1fa17f 100644 (file)
@@ -503,7 +503,8 @@ more information.
   sub compose_connection {
     my ($self, $target, @info) = @_;
 
-    warn "compose_connection deprecated as of 0.08000" unless $warn++;
+    warn "compose_connection deprecated as of 0.08000"
+      unless ($INC{"DBIx/Class/CDBICompat.pm"} || $warn++);
 
     my $base = 'DBIx::Class::ResultSetProxy';
     eval "require ${base};";
index 067a47a..860cc36 100644 (file)
@@ -335,8 +335,9 @@ a connected database handle.  Please note that the L<DBI> docs
 recommend that you always explicitly set C<AutoCommit> to either
 C<0> or C<1>.   L<DBIx::Class> further recommends that it be set
 to C<1>, and that you perform transactions via our L</txn_do>
-method.  L<DBIx::Class> will emit a warning if you fail to explicitly
-set C<AutoCommit> one way or the other.  See below for more details.
+method.  L<DBIx::Class> will set it to C<1> if you do not do explicitly
+set it to zero.  This is the default for most DBDs.  See below for more
+details.
 
 In either case, if the final argument in your connect_info happens
 to be a hashref, C<connect_info> will look there for several
@@ -482,16 +483,23 @@ sub connect_info {
     pop(@$info) if !keys %$last_info;
   }
 
-  # Now check the (possibly new) final argument for AutoCommit,
-  #  but not in the coderef case, obviously.
   if(ref $info->[0] ne 'CODE') {
-      $last_info = $info->[3];
+      # Extend to 3 arguments with undefs, if necessary
+      while(scalar(@$info) < 3) { push(@$info, undef) }
 
-      warn "You *really* should explicitly set AutoCommit "
-         . "(preferably to 1) in your db connect info"
-           if !$last_info
-              || ref $last_info ne 'HASH'
-              || !defined $last_info->{AutoCommit};
+      # Complain if 4th argument is defined and is not a HASH
+      if(defined $info->[3] && ref $info->[3] ne 'HASH') {
+          warn "4th argument of DBI connect info is defined "
+               . " but is not a hashref!";
+      }
+
+      # Set AutoCommit to 1 if not specified manually
+      else {
+          $info->[3] ||= {};
+          if(!defined $info->[3]->{AutoCommit}) {
+              $info->[3]->{AutoCommit} = 1;
+          }
+      }
   }
 
   $self->_connect_info($info);
index 2ba6815..9dbe9e0 100644 (file)
@@ -58,10 +58,10 @@ BEGIN {
         die "Can't handle full outer joins in Oracle 8 yet!\n"
           if $to_jt->{-join_type} =~ /full/i;
 
-        $left_join  = q{(+)} if $to_jt->{-join_type} =~ /right/i
+        $left_join  = q{(+)} if $to_jt->{-join_type} =~ /left/i
                              && $to_jt->{-join_type} !~ /inner/i;
 
-        $right_join = q{(+)} if $to_jt->{-join_type} =~ /left/i
+        $right_join = q{(+)} if $to_jt->{-join_type} =~ /right/i
                              && $to_jt->{-join_type} !~ /inner/i;
       }
 
index 8f1521c..5e518b1 100755 (executable)
@@ -55,12 +55,18 @@ sub init_schema {
     my $dbuser = $ENV{"DBICTEST_DBUSER"} || '';
     my $dbpass = $ENV{"DBICTEST_DBPASS"} || '';
 
-    my $compose_method = ($args{compose_connection}
-                           ? 'compose_connection'
-                           : 'compose_namespace');
+    my $schema;
 
-    my $schema = DBICTest::Schema->$compose_method('DBICTest')
-                     ->connect($dsn, $dbuser, $dbpass, { AutoCommit => 1 });
+    my @connect_info = ($dsn, $dbuser, $dbpass, { AutoCommit => 1 });
+
+    if ($args{compose_connection}) {
+      $schema = DBICTest::Schema->compose_connection(
+                  'DBICTest', @connect_info
+                );
+    } else {
+      $schema = DBICTest::Schema->compose_namespace('DBICTest')
+                                ->connect(@connect_info);
+    }
     $schema->storage->on_connect_do(['PRAGMA synchronous = OFF']);
     if ( !$args{no_deploy} ) {
         __PACKAGE__->deploy_schema( $schema );