Skip to content

Commit

Permalink
Removed "null" default value anomaly due to the inability to accurate…
Browse files Browse the repository at this point in the history
…ly detect it.
  • Loading branch information
johncurrier committed May 6, 2011
1 parent 660385e commit 3d68702
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 33 deletions.
8 changes: 8 additions & 0 deletions dist/releaseNotes.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ <h3><a href='http://schemaspy.sourceforge.net'>SchemaSpy</a> Release Notes</h3>

<li class='release'>x.x.x - xx/xx/xxxx - Subversion revision xxx
<ul>
<li>Resolved <a href="https://sourceforge.net/tracker/index.php?func=detail&aid=2965546&group_id=137197&atid=737987">
bug 2965546</a> - Oracle DEFAULT NULL anomaly.<br>
Unfortunately I was unable to determine a mechanism for detecting the null-handling
change in behavior between various versions of JDBC (or the drivers? or the databases?),
so I had to remove the detection of the anomaly.
rev 644<br>
Thanks to Vladimir Vilinski for reporting the issue.
</li>
<li>Resolved <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=3296973&group_id=137197&atid=737987">
bug 3296973</a> - Tables not included with -i appears in relationship tab<br>
rev 643<br>
Expand Down
2 changes: 2 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@
<configuration>
<source>1.5</source>
<target>1.5</target>
<debug>true</debug>
<debuglevel>source,lines</debuglevel>
</configuration>
</plugin>
<plugin>
Expand Down
25 changes: 0 additions & 25 deletions src/main/java/net/sourceforge/schemaspy/DbAnalyzer.java
Original file line number Diff line number Diff line change
Expand Up @@ -282,31 +282,6 @@ public int compare(TableColumn column1, TableColumn column2) {
return columns;
}

/**
* Returns a list of columns that have the word "NULL" or "null" as their default value
* instead of the likely candidate value null.
*
* @param tables Collection
* @return List
*/
public static List<TableColumn> getDefaultNullStringColumns(Collection<Table> tables) {
List<TableColumn> defaultNullStringColumns = new ArrayList<TableColumn>();

for (Table table : tables) {
for (TableColumn column : table.getColumns()) {
Object defaultValue = column.getDefaultValue();
if (defaultValue != null && defaultValue instanceof String) {
String defaultString = defaultValue.toString();
if (defaultString.trim().equalsIgnoreCase("null")) {
defaultNullStringColumns.add(column);
}
}
}
}

return sortColumnsByTable(defaultNullStringColumns);
}

/**
* getSchemas - returns a List of catalog names (Strings)
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ public void write(Database database, Collection<Table> tables, List<? extends Fo
writeUniqueNullables(DbAnalyzer.getMustBeUniqueNullableColumns(new HashSet<Table>(tables)), out);
writeTablesWithOneColumn(DbAnalyzer.getTablesWithOneColumn(tables), out);
writeTablesWithIncrementingColumnNames(DbAnalyzer.getTablesWithIncrementingColumnNames(tables), out);
writeDefaultNullStrings(DbAnalyzer.getDefaultNullStringColumns(new HashSet<Table>(tables)), out);
writeFooter(out);
}

Expand Down Expand Up @@ -253,13 +252,6 @@ private void writeTablesWithOneColumn(List<Table> tables, LineWriter out) throws
out.writeln("<p></li>");
}

private void writeDefaultNullStrings(List<TableColumn> uniqueNullables, LineWriter out) throws IOException {
out.writeln("<li>");
out.writeln("<b>Columns whose default value is the word 'NULL' or 'null', but the SQL NULL value may have been intended:</b>");
writeColumnBasedAnomaly(uniqueNullables, out);
out.writeln("<p></li>");
}

private void writeColumnBasedAnomaly(List<TableColumn> columns, LineWriter out) throws IOException {
if (!columns.isEmpty()) {
out.writeln("<table class='dataTable' border='1' rules='groups'>");
Expand Down

0 comments on commit 3d68702

Please sign in to comment.