Skip to content

Commit

Permalink
Attempt to resolve bug 2857682 - incorrect tables linked when same na…
Browse files Browse the repository at this point in the history
…me tables exist in multiple schemas
  • Loading branch information
johncurrier committed Sep 29, 2009
1 parent 40be563 commit 81112fb
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/net/sourceforge/schemaspy/view/DotConnector.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ public class DotConnector implements Comparable<DotConnector> {
private final Table parentTable;
private final TableColumn childColumn;
private final Table childTable;
private boolean implied;
private boolean bottomJustify;
private final boolean implied;
private final boolean bottomJustify;
private String parentPort;
private String childPort;

Expand All @@ -30,11 +30,11 @@ public DotConnector(TableColumn parentColumn, TableColumn childColumn, boolean i
this.parentColumn = parentColumn;
this.childColumn = childColumn;
this.implied = implied;
this.parentPort = parentColumn.getName();
this.parentTable = parentColumn.getTable();
this.childPort = childColumn.getName();
this.childTable = childColumn.getTable();
this.bottomJustify = !Dot.getInstance().supportsCenteredEastWestEdges();
parentPort = parentColumn.getName();
parentTable = parentColumn.getTable();
childPort = childColumn.getName();
childTable = childColumn.getTable();
bottomJustify = !Dot.getInstance().supportsCenteredEastWestEdges();
}

/**
Expand Down Expand Up @@ -93,7 +93,7 @@ public String toString() {
// if enabled makes the diagram unreadable
// have to figure out how to render these details in a readable manner
final boolean fullErNotation = false;

// Thanks to Dan Zingaro for figuring out how to correctly annotate
// these relationships
if (fullErNotation) {
Expand All @@ -118,7 +118,7 @@ public String toString() {
if (implied)
edge.append(" style=dashed");
edge.append("];");

return edge.toString();
}

Expand All @@ -130,6 +130,10 @@ public int compareTo(DotConnector other) {
rc = parentTable.getName().compareToIgnoreCase(other.parentTable.getName());
if (rc == 0)
rc = parentColumn.getName().compareToIgnoreCase(other.parentColumn.getName());
if (rc == 0 && childTable.getSchema() != null && other.childTable.getSchema() != null)
rc = childTable.getSchema().compareToIgnoreCase(other.childTable.getSchema());
if (rc == 0 && parentTable.getSchema() != null && other.parentTable.getSchema() != null)
rc = parentTable.getSchema().compareToIgnoreCase(other.parentTable.getSchema());
if (rc == 0 && implied != other.implied)
rc = implied ? 1 : -1;
return rc;
Expand Down

0 comments on commit 81112fb

Please sign in to comment.