[Bast-commits] r6789 - in DBIx-Class/0.08/trunk: lib/DBIx/Class t t/lib/DBICTest/Schema

ribasushi at dev.catalyst.perl.org ribasushi at dev.catalyst.perl.org
Thu Jun 25 09:04:27 GMT 2009


Author: ribasushi
Date: 2009-06-25 09:04:26 +0000 (Thu, 25 Jun 2009)
New Revision: 6789

Modified:
   DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSource.pm
   DBIx-Class/0.08/trunk/t/86sqlt.t
   DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema/ArtistUndirectedMap.pm
   DBIx-Class/0.08/trunk/t/zzzzzzz_sqlite_deadlock.t
Log:
Minor cleanups

Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSource.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSource.pm	2009-06-25 07:19:10 UTC (rev 6788)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSource.pm	2009-06-25 09:04:26 UTC (rev 6789)
@@ -1083,26 +1083,23 @@
 
 # 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 @@
         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 @@
     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);

Modified: DBIx-Class/0.08/trunk/t/86sqlt.t
===================================================================
--- DBIx-Class/0.08/trunk/t/86sqlt.t	2009-06-25 07:19:10 UTC (rev 6788)
+++ DBIx-Class/0.08/trunk/t/86sqlt.t	2009-06-25 09:04:26 UTC (rev 6789)
@@ -155,7 +155,7 @@
       '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,
     },
   ],
 

Modified: DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema/ArtistUndirectedMap.pm
===================================================================
--- DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema/ArtistUndirectedMap.pm	2009-06-25 07:19:10 UTC (rev 6788)
+++ DBIx-Class/0.08/trunk/t/lib/DBICTest/Schema/ArtistUndirectedMap.pm	2009-06-25 09:04:26 UTC (rev 6789)
@@ -11,7 +11,7 @@
 __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'} ],

Modified: DBIx-Class/0.08/trunk/t/zzzzzzz_sqlite_deadlock.t
===================================================================
--- DBIx-Class/0.08/trunk/t/zzzzzzz_sqlite_deadlock.t	2009-06-25 07:19:10 UTC (rev 6788)
+++ DBIx-Class/0.08/trunk/t/zzzzzzz_sqlite_deadlock.t	2009-06-25 09:04:26 UTC (rev 6789)
@@ -27,7 +27,6 @@
 
   lives_ok (sub {
     my $schema = DBICTest::Schema->connect ("DBI:SQLite:$tmp_fn");
-    warn $tmp_fn;
     DBICTest->deploy_schema ($schema);
     DBICTest->populate_schema ($schema);
   });




More information about the Bast-commits mailing list