Skip to content

Commit

Permalink
Added "isForeignKey()" to try to remove some obfuscation.
Browse files Browse the repository at this point in the history
  • Loading branch information
johncurrier committed Aug 1, 2007
1 parent 80f0f0b commit b04dc86
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/net/sourceforge/schemaspy/DbAnalyzer.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public int compare(Object object1, Object object2) {

for (Iterator columnIter = table.getColumns().iterator(); columnIter.hasNext(); ) {
TableColumn column = (TableColumn)columnIter.next();
if (column.getParents().isEmpty())
if (!column.isForeignKey())
columnsWithoutParents.add(column);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/net/sourceforge/schemaspy/model/Table.java
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ public void unlinkParents() {
public boolean isRoot() {
for (Iterator iter = columns.values().iterator(); iter.hasNext(); ) {
TableColumn column = (TableColumn)iter.next();
if (!column.getParents().isEmpty()) {
if (column.isForeignKey()) {
return false;
}
}
Expand Down
8 changes: 8 additions & 0 deletions src/net/sourceforge/schemaspy/model/TableColumn.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,14 @@ public boolean isUnique() {
public boolean isPrimary() {
return table.getPrimaryColumns().contains(this);
}

/**
* Returns <code>true</code> if this column points to another table's primary key.
* @return
*/
public boolean isForeignKey() {
return !parents.isEmpty();
}

public Object getDefaultValue() {
return defaultValue;
Expand Down

0 comments on commit b04dc86

Please sign in to comment.