From: Allen Day Date: Wed, 7 Apr 2004 19:21:29 +0000 (+0000) Subject: many graph introspection problems solved. method name generation is still X-Git-Tag: v0.06~91 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0be4a1f86f641de40092ac120352456e36584125;p=dbsrgits%2FSQL-Translator.git many graph introspection problems solved. method name generation is still fubar due to empty ([% %]) tt2 tags, need to trace through old commits to find out what used to be in them... --- diff --git a/lib/SQL/Translator/Producer/Turnkey.pm b/lib/SQL/Translator/Producer/Turnkey.pm index c233687..a209557 100644 --- a/lib/SQL/Translator/Producer/Turnkey.pm +++ b/lib/SQL/Translator/Producer/Turnkey.pm @@ -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 %] diff --git a/lib/SQL/Translator/Schema/Graph.pm b/lib/SQL/Translator/Schema/Graph.pm index e63b90f..818b906 100644 --- a/lib/SQL/Translator/Schema/Graph.pm +++ b/lib/SQL/Translator/Schema/Graph.pm @@ -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; +# } +# } } } }