From: Peter Rabbitson Date: Thu, 25 Jun 2009 09:04:26 +0000 (+0000) Subject: Minor cleanups X-Git-Tag: v0.08108~60 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b230b4bee9367c652bc213f09053386a5f9aeb12;p=dbsrgits%2FDBIx-Class.git Minor cleanups --- diff --git a/lib/DBIx/Class/ResultSource.pm b/lib/DBIx/Class/ResultSource.pm index 2287bef..d6fd004 100644 --- a/lib/DBIx/Class/ResultSource.pm +++ b/lib/DBIx/Class/ResultSource.pm @@ -1083,26 +1083,23 @@ sub resolve_join { # Returns the {from} structure used to express JOIN conditions sub _resolve_join { - my ($self, $join, $alias, $seen, $force_left, $jpath) = @_; + my ($self, $join, $alias, $seen, $jpath, $force_left) = @_; # we need a supplied one, because we do in-place modifications, no returns $self->throw_exception ('You must supply a seen hashref as the 3rd argument to _resolve_join') unless $seen; - $force_left ||= { force => 0 }; - # This isn't quite right, we should actually dive into $seen and reconstruct # the entire path (the reference entry point would be the join conditional # with depth == current_depth - 1. At this point however nothing depends on # having the entire path, transcending related_resultset, so just leave it # as is, hairy enough already. - $jpath ||= []; + $jpath ||= []; if (ref $join eq 'ARRAY') { return map { - local $force_left->{force} = $force_left->{force}; - $self->_resolve_join($_, $alias, $seen, $force_left, [@$jpath]); + $self->_resolve_join($_, $alias, $seen, [@$jpath], $force_left); } @$join; } elsif (ref $join eq 'HASH') { return @@ -1110,9 +1107,9 @@ sub _resolve_join { my $as = ($seen->{$_} ? join ('_', $_, $seen->{$_} + 1) : $_); # the actual seen value will be incremented below local $force_left->{force} = $force_left->{force}; ( - $self->_resolve_join($_, $alias, $seen, $force_left, [@$jpath]), + $self->_resolve_join($_, $alias, $seen, [@$jpath], $force_left), $self->related_source($_)->_resolve_join( - $join->{$_}, $as, $seen, $force_left, [@$jpath, $_] + $join->{$_}, $as, $seen, [@$jpath, $_], $force_left ) ); } keys %$join; @@ -1126,11 +1123,11 @@ sub _resolve_join { my $rel_info = $self->relationship_info($join); $self->throw_exception("No such relationship ${join}") unless $rel_info; my $type; - if ($force_left->{force}) { + if ($force_left) { $type = 'left'; } else { $type = $rel_info->{attrs}{join_type} || ''; - $force_left->{force} = 1 if lc($type) eq 'left'; + $force_left = 1 if lc($type) eq 'left'; } my $rel_src = $self->related_source($join); diff --git a/t/86sqlt.t b/t/86sqlt.t index 4b89019..c033113 100644 --- a/t/86sqlt.t +++ b/t/86sqlt.t @@ -155,7 +155,7 @@ my %fk_constraints = ( 'name' => 'artist_undirected_map_fk_id2', 'index_name' => 'artist_undirected_map_idx_id2', 'selftable' => 'artist_undirected_map', 'foreigntable' => 'artist', 'selfcols' => ['id2'], 'foreigncols' => ['artistid'], - on_delete => '', on_update => 'CASCADE', deferrable => 1, + on_delete => '', on_update => '', deferrable => 1, }, ], diff --git a/t/lib/DBICTest/Schema/ArtistUndirectedMap.pm b/t/lib/DBICTest/Schema/ArtistUndirectedMap.pm index 1626787..2f4d85f 100644 --- a/t/lib/DBICTest/Schema/ArtistUndirectedMap.pm +++ b/t/lib/DBICTest/Schema/ArtistUndirectedMap.pm @@ -11,7 +11,7 @@ __PACKAGE__->add_columns( __PACKAGE__->set_primary_key(qw/id1 id2/); __PACKAGE__->belongs_to( 'artist1', 'DBICTest::Schema::Artist', 'id1', { on_delete => 'RESTRICT', on_update => 'CASCADE'} ); -__PACKAGE__->belongs_to( 'artist2', 'DBICTest::Schema::Artist', 'id2', { on_delete => undef, on_update => 'CASCADE'} ); +__PACKAGE__->belongs_to( 'artist2', 'DBICTest::Schema::Artist', 'id2', { on_delete => undef, on_update => undef} ); __PACKAGE__->has_many( 'mapped_artists', 'DBICTest::Schema::Artist', [ {'foreign.artistid' => 'self.id1'}, {'foreign.artistid' => 'self.id2'} ], diff --git a/t/zzzzzzz_sqlite_deadlock.t b/t/zzzzzzz_sqlite_deadlock.t index 7bb0fe0..80990f4 100644 --- a/t/zzzzzzz_sqlite_deadlock.t +++ b/t/zzzzzzz_sqlite_deadlock.t @@ -27,7 +27,6 @@ for my $close (0,1) { lives_ok (sub { my $schema = DBICTest::Schema->connect ("DBI:SQLite:$tmp_fn"); - warn $tmp_fn; DBICTest->deploy_schema ($schema); DBICTest->populate_schema ($schema); });