many graph introspection problems solved. method name generation is still
Allen Day [Wed, 7 Apr 2004 19:21:29 +0000 (19:21 +0000)]
fubar due to empty ([% %]) tt2 tags, need to trace through old commits to
find out what used to be in them...

lib/SQL/Translator/Producer/Turnkey.pm
lib/SQL/Translator/Schema/Graph.pm

index c233687..a209557 100644 (file)
@@ -1,7 +1,7 @@
 package SQL::Translator::Producer::Turnkey;
 
 # -------------------------------------------------------------------
-# $Id: Turnkey.pm,v 1.36 2004-04-06 08:50:32 boconnor Exp $
+# $Id: Turnkey.pm,v 1.37 2004-04-07 19:21:27 allenday Exp $
 # -------------------------------------------------------------------
 # Copyright (C) 2002-4 SQLFairy Authors
 #
@@ -22,7 +22,7 @@ package SQL::Translator::Producer::Turnkey;
 
 use strict;
 use vars qw[ $VERSION $DEBUG ];
-$VERSION = sprintf "%d.%02d", q$Revision: 1.36 $ =~ /(\d+)\.(\d+)/;
+$VERSION = sprintf "%d.%02d", q$Revision: 1.37 $ =~ /(\d+)\.(\d+)/;
 $DEBUG   = 1 unless defined $DEBUG;
 
 use SQL::Translator::Schema::Constants;
@@ -277,6 +277,7 @@ sub [% edge.thatnode.table.name %]_[% format_fk(edge.thatnode.name,edge.thatfiel
 sub [% edge.thatnode.table.name %]s { return shift->[% edge.thatnode.table.name %]_[% edge.thatfield.name %] }
       [% END %]
     [% END %]
+
   [% END %]
 [% END %]
 
@@ -338,7 +339,6 @@ sub [% h.vianode.table.name %]_[% format_fk(h.vianode,h.thisviafield_index(i).na
 #[% thisnode.name %]::[% h.thisfield_index(i).name %] -> [% h.vianode.name %]::[% h.thisviafield_index(i).name %] ... [% h.vianode.name %]::[% h.thatviafield_index(j).name %] <- [% h.thatnode_index(j).name %]::[% h.thatfield_index(j).name %]
 sub [% h.vianode.table.name %]_[% format_fk(h.vianode,h.thisviafield_index(i).name) %]_[% format_fk(h.vianode,h.thatviafield_index(j).name) %]s { my \$self = shift; return map \$_->[% %], \$self->[% %] }
       [% j = j + 1 %]
-
     [% END %]
     [% i = i + 1 %]
   [% END %]
index e63b90f..818b906 100644 (file)
@@ -3,6 +3,7 @@ package SQL::Translator::Schema::Graph;
 use strict;
 
 use Data::Dumper;
+$Data::Dumper::Maxdepth = 3;
 
 use SQL::Translator::Schema::Graph::Node;
 use SQL::Translator::Schema::Graph::Edge;
@@ -74,13 +75,11 @@ sub init {
                                                   thatfield => $self->translator->schema->get_table($field->foreign_key_reference->reference_table)->get_field(($field->foreign_key_reference->reference_fields)[0])
                                                  );
 
-#        $node->edgecount($that->name, $node->edgecount($that->name)+1);
          $node->edgecount($that->name, $node->edgecount($that->name)+1);
 
          $node->has($that->name, $node->has($that->name)+1);
          $that->many($node->name, $that->many($node->name)+1);
 
-#        $that->edgecount($node->name, $that->edgecount($node->name)+1);
          $that->edgecount($node->name, $that->edgecount($node->name)+1);
 
       #warn "\t" . $node->name . "\t" . $node->edgecount($that->name);
@@ -157,9 +156,17 @@ sub init {
                  $inode1->via($inode2->name,$inode1->via($inode2->name)+1);
                  $inode2->via($inode1->name,$inode2->via($inode1->name)+1);
                }
+#warn Dumper($cedge);
 
                $inode1->push_compoundedges($cedge);
                $inode2->push_compoundedges($cedge) unless $inode1 eq $inode2;
+#        if($inode1->name ne $inode2->name){
+#          my $flipped_cedge = $cedge;
+#          foreach my $flipped_cedge_edge ($flipped_cedge->edges){
+#            warn Dumper $flipped_cedge_edge;
+#            warn "\t". Dumper $flipped_cedge_edge->flip;
+#          }
+#        }
          }
        }
   }