diff --git a/dist/releaseNotes.html b/dist/releaseNotes.html
index 81d63da..c488c93 100644
--- a/dist/releaseNotes.html
+++ b/dist/releaseNotes.html
@@ -120,6 +120,10 @@
the scope of SchemaSpy, so plug in your own if desired.
Use -dp to make the specified class visible to SchemaSpy's class loader.
+ Now treats DB2 Materialized Query Tables (MQTs) as views per
+
+ Jonas S�derstr�m's suggestion.
+
diff --git a/src/net/sourceforge/schemaspy/dbTypes/db2.properties b/src/net/sourceforge/schemaspy/dbTypes/db2.properties
index 7dc9e02..8315430 100755
--- a/src/net/sourceforge/schemaspy/dbTypes/db2.properties
+++ b/src/net/sourceforge/schemaspy/dbTypes/db2.properties
@@ -26,3 +26,6 @@ selectIndexIdsSql=select iid index_id, indname index_name, tabname table_name fr
# this says which schemas to include in our evaluation of "all schemas"
# basically .* (at the end) matches anything and the rest of it says "except schemas starting with SYS"
schemaSpec=(?!^SYS.*$).*
+
+# treat DB2's MQTs as views
+viewTypes=VIEW, MATERIALIZED QUERY TABLE
\ No newline at end of file
diff --git a/src/net/sourceforge/schemaspy/model/Database.java b/src/net/sourceforge/schemaspy/model/Database.java
index 92fefdd..8ad1276 100755
--- a/src/net/sourceforge/schemaspy/model/Database.java
+++ b/src/net/sourceforge/schemaspy/model/Database.java
@@ -201,7 +201,7 @@ private void initTables(final DatabaseMetaData metadata, final Properties proper
if (verbose)
System.out.println();
- String[] types = {"TABLE"};
+ String[] types = getTypes("tableTypes", "TABLE", properties);
NameValidator validator = new NameValidator("table", include, exclude, verbose, types);
List entries = getBasicTableMeta(metadata, true, properties, types);
@@ -263,7 +263,7 @@ private void initViews(DatabaseMetaData metadata, Properties properties,
if (verbose)
System.out.println();
- String[] types = {"VIEW"};
+ String[] types = getTypes("viewTypes", "VIEW", properties);
NameValidator validator = new NameValidator("view", includeTables, excludeTables, verbose, types);
for (BasicTableMeta entry : getBasicTableMeta(metadata, false, properties, types)) {
@@ -391,6 +391,27 @@ private List getBasicTableMeta(DatabaseMetaData metadata,
return basics;
}
+ /**
+ * Return a database-specific array of types from the .properties file
+ * with the specified property name.
+ *
+ * @param propName
+ * @param defaultValue
+ * @param props
+ * @return
+ */
+ private String[] getTypes(String propName, String defaultValue, Properties props) {
+ String value = props.getProperty(propName, defaultValue);
+ List types = new ArrayList();
+ for (String type : value.split(",")) {
+ type = type.trim();
+ if (type.length() > 0)
+ types.add(type);
+ }
+
+ return types.toArray(new String[types.size()]);
+ }
+
/**
* Some databases don't play nice with their metadata.
* E.g. Oracle doesn't have a REMARKS column at all.