From: Jess Robinson Date: Fri, 18 May 2007 12:24:00 +0000 (+0000) Subject: Merge 'DBIx-Class-current' into 'bulk_create' X-Git-Tag: v0.08010~150^2~51^2~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=db4900f2f4608671ef43b116d7ba5da56a928d3f;hp=e287d9b08f5652a490eb7943ac07d5e38377852e;p=dbsrgits%2FDBIx-Class.git Merge 'DBIx-Class-current' into 'bulk_create' 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 --- diff --git a/Changes b/Changes index b135908..d4cc20e 100644 --- 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 diff --git a/Makefile.PL b/Makefile.PL index 10deaa1..a8319c5 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -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() diff --git a/lib/DBIx/Class/Schema.pm b/lib/DBIx/Class/Schema.pm index 223dbd3..b1fa17f 100644 --- a/lib/DBIx/Class/Schema.pm +++ b/lib/DBIx/Class/Schema.pm @@ -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};"; diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index 067a47a..860cc36 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -335,8 +335,9 @@ a connected database handle. Please note that the L docs recommend that you always explicitly set C to either C<0> or C<1>. L further recommends that it be set to C<1>, and that you perform transactions via our L -method. L will emit a warning if you fail to explicitly -set C one way or the other. See below for more details. +method. L 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 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); diff --git a/lib/DBIx/Class/Storage/DBI/Oracle/WhereJoins.pm b/lib/DBIx/Class/Storage/DBI/Oracle/WhereJoins.pm index 2ba6815..9dbe9e0 100644 --- a/lib/DBIx/Class/Storage/DBI/Oracle/WhereJoins.pm +++ b/lib/DBIx/Class/Storage/DBI/Oracle/WhereJoins.pm @@ -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; } diff --git a/t/lib/DBICTest.pm b/t/lib/DBICTest.pm index 8f1521c..5e518b1 100755 --- a/t/lib/DBICTest.pm +++ b/t/lib/DBICTest.pm @@ -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 );