Merge with 3.0PR17Q4
authorAugusto Mauch <augusto.mauch@openbravo.com>
Thu, 19 Oct 2017 10:12:04 +0200
changeset 1125 42d211d9f505
parent 1124 2d5ab2a4454f (current diff)
parent 1122 2ff142f917c9 (diff)
child 1126 61c5fea745de
Merge with 3.0PR17Q4
.hgtags
src/org/apache/ddlutils/PlatformUtils.java
src/org/apache/ddlutils/alteration/package.html
src/org/apache/ddlutils/dynabean/package.html
src/org/apache/ddlutils/io/converters/package.html
src/org/apache/ddlutils/io/package.html
src/org/apache/ddlutils/model/package.html
src/org/apache/ddlutils/package.html
src/org/apache/ddlutils/platform/Oracle8StandardBatchEvaluator.java
src/org/apache/ddlutils/platform/axion/AxionBuilder.java
src/org/apache/ddlutils/platform/axion/AxionModelReader.java
src/org/apache/ddlutils/platform/axion/AxionPlatform.java
src/org/apache/ddlutils/platform/axion/package.html
src/org/apache/ddlutils/platform/cloudscape/CloudscapeBuilder.java
src/org/apache/ddlutils/platform/cloudscape/CloudscapePlatform.java
src/org/apache/ddlutils/platform/cloudscape/package.html
src/org/apache/ddlutils/platform/db2/Db2Builder.java
src/org/apache/ddlutils/platform/db2/Db2ModelReader.java
src/org/apache/ddlutils/platform/db2/Db2Platform.java
src/org/apache/ddlutils/platform/db2/Db2v8Builder.java
src/org/apache/ddlutils/platform/db2/Db2v8Platform.java
src/org/apache/ddlutils/platform/db2/package.html
src/org/apache/ddlutils/platform/derby/DerbyBuilder.java
src/org/apache/ddlutils/platform/derby/DerbyModelReader.java
src/org/apache/ddlutils/platform/derby/DerbyPlatform.java
src/org/apache/ddlutils/platform/derby/package.html
src/org/apache/ddlutils/platform/firebird/FirebirdBuilder.java
src/org/apache/ddlutils/platform/firebird/FirebirdModelReader.java
src/org/apache/ddlutils/platform/firebird/FirebirdPlatform.java
src/org/apache/ddlutils/platform/firebird/package.html
src/org/apache/ddlutils/platform/hsqldb/HsqlDbBuilder.java
src/org/apache/ddlutils/platform/hsqldb/HsqlDbModelReader.java
src/org/apache/ddlutils/platform/hsqldb/HsqlDbPlatform.java
src/org/apache/ddlutils/platform/hsqldb/package.html
src/org/apache/ddlutils/platform/interbase/InterbaseBuilder.java
src/org/apache/ddlutils/platform/interbase/InterbaseModelReader.java
src/org/apache/ddlutils/platform/interbase/InterbasePlatform.java
src/org/apache/ddlutils/platform/interbase/package.html
src/org/apache/ddlutils/platform/maxdb/MaxDbBuilder.java
src/org/apache/ddlutils/platform/maxdb/MaxDbModelReader.java
src/org/apache/ddlutils/platform/maxdb/MaxDbPlatform.java
src/org/apache/ddlutils/platform/maxdb/package.html
src/org/apache/ddlutils/platform/mckoi/MckoiBuilder.java
src/org/apache/ddlutils/platform/mckoi/MckoiModelReader.java
src/org/apache/ddlutils/platform/mckoi/MckoiPlatform.java
src/org/apache/ddlutils/platform/mckoi/package.html
src/org/apache/ddlutils/platform/mssql/MSSqlBuilder.java
src/org/apache/ddlutils/platform/mssql/MSSqlModelReader.java
src/org/apache/ddlutils/platform/mssql/MSSqlPlatform.java
src/org/apache/ddlutils/platform/mssql/package.html
src/org/apache/ddlutils/platform/mysql/MySql50ModelReader.java
src/org/apache/ddlutils/platform/mysql/MySql50Platform.java
src/org/apache/ddlutils/platform/mysql/MySqlBuilder.java
src/org/apache/ddlutils/platform/mysql/MySqlModelReader.java
src/org/apache/ddlutils/platform/mysql/MySqlPlatform.java
src/org/apache/ddlutils/platform/mysql/package.html
src/org/apache/ddlutils/platform/oracle/Oracle10Builder.java
src/org/apache/ddlutils/platform/oracle/Oracle10ModelReader.java
src/org/apache/ddlutils/platform/oracle/Oracle10Platform.java
src/org/apache/ddlutils/platform/oracle/Oracle8Builder.java
src/org/apache/ddlutils/platform/oracle/Oracle8ModelReader.java
src/org/apache/ddlutils/platform/oracle/Oracle8Platform.java
src/org/apache/ddlutils/platform/oracle/Oracle9Platform.java
src/org/apache/ddlutils/platform/oracle/package.html
src/org/apache/ddlutils/platform/package.html
src/org/apache/ddlutils/platform/postgresql/package.html
src/org/apache/ddlutils/platform/sapdb/SapDbBuilder.java
src/org/apache/ddlutils/platform/sapdb/SapDbModelReader.java
src/org/apache/ddlutils/platform/sapdb/SapDbPlatform.java
src/org/apache/ddlutils/platform/sapdb/package.html
src/org/apache/ddlutils/platform/sybase/SybaseASE15Platform.java
src/org/apache/ddlutils/platform/sybase/SybaseBuilder.java
src/org/apache/ddlutils/platform/sybase/SybaseModelReader.java
src/org/apache/ddlutils/platform/sybase/SybasePlatform.java
src/org/apache/ddlutils/platform/sybase/package.html
src/org/apache/ddlutils/task/package.html
src/org/apache/ddlutils/util/package.html
--- a/.hgtags	Thu Oct 19 10:11:00 2017 +0200
+++ b/.hgtags	Thu Oct 19 10:12:04 2017 +0200
@@ -31,5 +31,5 @@
 c204e6f0767c6e40b640fd2f339383e598f85efd 3.0PR16Q2
 285d1158f06141582bd7a6d021c3db800244c678 3.0PR17Q1
 5dc3382f910dc2ad74b09ceac22fb83eba6b20e8 3.0PR17Q2.4
-7cdd957ca8790f1c9bb971e66c40b9f38a842b7d 3.0PR17Q3.1
-8089c66b5970304269aa72058ec05ebb97ec7b06 3.0PR17Q4
+a6b6565a165c27af6158283d705815f12043026c 3.0PR17Q3.1
+8089c66b5970304269aa72058ec05ebb97ec7b06 3.0PR17Q4
\ No newline at end of file
--- a/src-test/src/org/openbravo/dbsm/test/base/DbsmTest.java	Thu Oct 19 10:11:00 2017 +0200
+++ b/src-test/src/org/openbravo/dbsm/test/base/DbsmTest.java	Thu Oct 19 10:12:04 2017 +0200
@@ -30,7 +30,6 @@
 import java.util.Collection;
 import java.util.Date;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
@@ -43,21 +42,17 @@
 import org.apache.commons.lang.RandomStringUtils;
 import org.apache.ddlutils.Platform;
 import org.apache.ddlutils.PlatformFactory;
-import org.apache.ddlutils.alteration.AddRowChange;
 import org.apache.ddlutils.alteration.Change;
-import org.apache.ddlutils.alteration.ColumnDataChange;
-import org.apache.ddlutils.alteration.DataChange;
 import org.apache.ddlutils.alteration.DataComparator;
 import org.apache.ddlutils.alteration.ModelChange;
 import org.apache.ddlutils.alteration.ModelComparator;
-import org.apache.ddlutils.alteration.RemoveRowChange;
 import org.apache.ddlutils.io.DatabaseIO;
 import org.apache.ddlutils.model.Column;
 import org.apache.ddlutils.model.Database;
 import org.apache.ddlutils.model.DatabaseData;
 import org.apache.ddlutils.model.Table;
 import org.apache.ddlutils.platform.ExcludeFilter;
-import org.apache.ddlutils.platform.Oracle8StandardBatchEvaluator;
+import org.apache.ddlutils.platform.OracleStandardBatchEvaluator;
 import org.apache.ddlutils.platform.PGStandardBatchEvaluator;
 import org.apache.ddlutils.platform.SQLBatchEvaluator;
 import org.apache.log4j.Level;
@@ -75,10 +70,10 @@
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 import org.junit.runners.Parameterized.Parameters;
+import org.openbravo.ddlutils.process.DBUpdater;
 import org.openbravo.ddlutils.task.DatabaseUtils;
 import org.openbravo.ddlutils.util.DBSMOBUtil;
 import org.openbravo.ddlutils.util.OBDataset;
-import org.openbravo.ddlutils.util.OBDatasetTable;
 
 /**
  * Base class to for test cases for DBSM. Classes extending this one, should be run as
@@ -341,175 +336,46 @@
    */
   protected Database updateDatabase(String dbModelPath, String adDirectoryName,
       List<String> adTableNames, boolean assertDBisCorrect, List<String> configScripts) {
-    Connection connection = null;
-    try {
-      File dbModel = new File("model", dbModelPath);
-      final Platform platform = getPlatform();
-      platform.setMaxThreads(threads);
-      log.info("Max threads " + platform.getMaxThreads());
+    DBUpdater dbUpdater = getDBUpdater(dbModelPath, adDirectoryName, adTableNames, configScripts);
+    Database updatedDB = dbUpdater.update();
 
-      if (recreationMode == RecreationMode.forced) {
-        platform.getSqlBuilder().setForcedRecreation("all");
-      }
+    if (assertDBisCorrect) {
+      checkDBIsCorrect(updatedDB);
+    }
 
-      Database originalDB = platform.loadModelFromDatabase(getExcludeFilter(), true);
-
-      Database newDB = DatabaseUtils.readDatabaseWithoutConfigScript(dbModel);
-      final DatabaseData databaseOrgData = new DatabaseData(newDB);
-      databaseOrgData.setStrictMode(false);
-
-      if (adDirectoryName != null) {
-        DBSMOBUtil.getInstance().loadDataStructures(platform, databaseOrgData, originalDB, newDB,
-            new File(adDirectoryName).getAbsolutePath(), "none", new File(adDirectoryName), false,
-            false);
-      }
-
-      // Applied ConfigScripts in the same order as in the dbsm source
-      if (configScripts != null) {
-        applyConfigScripts(configScripts, platform, databaseOrgData, newDB, true);
-      }
-
-      OBDataset ad = new OBDataset(databaseOrgData);
-      if (adDirectoryName != null && adTableNames != null) {
-        Vector<OBDatasetTable> adTables = new Vector<OBDatasetTable>();
-        for (String tName : adTableNames) {
-          OBDatasetTable t = new OBDatasetTable();
-          t.setName(tName);
-          t.setIncludeAllColumns(true);
-          adTables.add(t);
-        }
-        ad.setTables(adTables);
-      }
-
-      Database oldModel;
-      try {
-        oldModel = (Database) originalDB.clone();
-      } catch (CloneNotSupportedException e1) {
-        throw new RuntimeException(e1);
-      }
-      log.info("Updating database model...");
-      platform.alterTables(originalDB, newDB, false);
-      log.info("Model update complete.");
-
-      if (false) {
-        DBSMOBUtil.getInstance().moveModuleDataFromInstTables(platform, newDB, null);
-      }
-      connection = platform.borrowConnection();
-      log.info("Comparing databases to find differences");
-      final DataComparator dataComparator = new DataComparator(platform.getSqlBuilder()
-          .getPlatformInfo(), platform.isDelimitedIdentifierModeOn());
-      try {
-        dataComparator.compareToUpdate(newDB, platform, databaseOrgData, ad, null);
-      } catch (SQLException e) {
-        // TODO Auto-generated catch block
-        e.printStackTrace();
-      }
-      Set<String> adTablesWithRemovedOrInsertedRecords = new HashSet<String>();
-      Set<String> adTablesWithRemovedRecords = new HashSet<String>();
-      for (Change dataChange : dataComparator.getChanges()) {
-        if (dataChange instanceof RemoveRowChange) {
-          Table table = ((RemoveRowChange) dataChange).getTable();
-          String tableName = table.getName();
-          if (ad.getTable(tableName) != null) {
-            adTablesWithRemovedOrInsertedRecords.add(tableName);
-            adTablesWithRemovedRecords.add(tableName);
-          }
-        } else if (dataChange instanceof AddRowChange) {
-          Table table = ((AddRowChange) dataChange).getTable();
-          String tableName = table.getName();
-          if (ad.getTable(tableName) != null) {
-            adTablesWithRemovedOrInsertedRecords.add(tableName);
-          }
-        }
-      }
-      log.info("Disabling foreign keys");
-      platform.disableDatasetFK(connection, originalDB, ad, false,
-          adTablesWithRemovedOrInsertedRecords);
-      log.info("Disabling triggers");
-      platform.disableAllTriggers(connection, newDB, false);
-      platform.disableNOTNULLColumns(newDB, ad);
-
-      // // Executing modulescripts
-      //
-      // ModuleScriptHandler hd = new ModuleScriptHandler();
-      // hd.setBasedir(new File(basedir + "/../"));
-      // hd.execute();
-      //
-
-      log.info("Updating Application Dictionary data...");
-      platform.alterData(connection, newDB, dataComparator.getChanges());
-      log.info("Removing invalid rows.");
-      platform.deleteInvalidConstraintRows(newDB, ad, adTablesWithRemovedRecords, false);
-      log.info("Recreating Primary Keys");
-      List changes = platform.alterTablesRecreatePKs(oldModel, newDB, false);
-      log.info("Executing oncreatedefault statements for mandatory columns");
-      platform.executeOnCreateDefaultForMandatoryColumns(newDB, ad);
-      log.info("Recreating not null constraints");
-      platform.enableNOTNULLColumns(newDB, ad);
-      log.info("Executing update final script (dropping temporary tables)");
-      boolean postscriptCorrect = platform.alterTablesPostScript(oldModel, newDB, true, changes,
-          null, ad);
-
-      // assertThat("Postscript should be correct", postscriptCorrect, is(true));
-
-      log.info("Enabling Foreign Keys and Triggers");
-      boolean fksEnabled = platform.enableDatasetFK(connection, originalDB, ad,
-          adTablesWithRemovedOrInsertedRecords, true);
-      boolean triggersEnabled = platform.enableAllTriggers(connection, newDB, false);
-
-      // Now check the new model updated in db is as it should
-      if (assertDBisCorrect) {
-        ModelComparator comparator = new ModelComparator(platform.getPlatformInfo(),
-            platform.isDelimitedIdentifierModeOn());
-
-        @SuppressWarnings("unchecked")
-        List<ModelChange> newChanges = comparator.compare(newDB,
-            platform.loadModelFromDatabase(getExcludeFilter()));
-        assertThat("changes between updated db and target db", newChanges, is(empty()));
-      }
-
-      return newDB;
-    } finally {
-      platform.returnConnection(connection);
-    }
+    return updatedDB;
   }
 
-  private void applyConfigScripts(List<String> templates, Platform currentPlatform,
-      DatabaseData databaseOrgData, Database db, boolean applyConfigScriptData) {
+  private DBUpdater getDBUpdater(String dbModelPath, String adDirectoryName,
+      List<String> adTableNames, List<String> configScripts) {
+    DBUpdater dbUpdater = new DBUpdater();
 
-    log.info("Loading and applying configuration scripts");
-    Vector<File> configScripts = new Vector<File>();
-    for (String template : templates) {
-      File configScript = new File(template);
-      if (configScript.exists()) {
-        configScripts.add(configScript);
-        DatabaseIO dbIO = new DatabaseIO();
-        log.info("Loading configuration script: " + configScript.getAbsolutePath());
-        Vector<Change> changes = dbIO.readChanges(configScript);
-        for (Change change : changes) {
-          if (change instanceof ModelChange)
-            ((ModelChange) change).apply(db, currentPlatform.isDelimitedIdentifierModeOn());
-          else if (change instanceof DataChange && applyConfigScriptData) {
-            if (isValidChange(change)) {
-              ((DataChange) change).apply(databaseOrgData,
-                  currentPlatform.isDelimitedIdentifierModeOn());
-            }
-          }
-          log.info("Change: " + change);
-        }
-      } else {
-        log.info("Couldn't find configuration script for template: " + template + " (file: "
-            + configScript.getAbsolutePath() + ")");
-      }
+    dbUpdater.setLog(log);
+    dbUpdater.setExcludeFilter(getExcludeFilter());
+    dbUpdater.setPlatform(getPlatform());
+    dbUpdater.setUpdateCheckSums(false);
+    dbUpdater.setStrict(false);
+    dbUpdater.setExecuteModuleScripts(false);
+    dbUpdater.setDatafilter("none");
+    dbUpdater.setCheckDBModified(false);
+
+    dbUpdater.setModel(new File("model", dbModelPath));
+    dbUpdater.setBaseSrcAD(adDirectoryName == null ? null : new File(adDirectoryName));
+    dbUpdater.setAdTableNames(adTableNames);
+    dbUpdater.setConfigScripts(configScripts);
+    if (recreationMode == RecreationMode.forced) {
+      platform.getSqlBuilder().setForcedRecreation("all");
     }
+    return dbUpdater;
   }
 
-  private boolean isValidChange(Change change) {
-    if (!(change instanceof ColumnDataChange)) {
-      return true;
-    }
-    return !(((ColumnDataChange) change).getColumnname().equals("SEQNO") && ((ColumnDataChange) change)
-        .getTablename().equalsIgnoreCase("AD_FIELD"));
+  private void checkDBIsCorrect(Database updatedDB) {
+    ModelComparator comparator = new ModelComparator(platform.getPlatformInfo(),
+        platform.isDelimitedIdentifierModeOn());
+
+    List<ModelChange> newChanges = comparator.compare(updatedDB,
+        platform.loadModelFromDatabase(getExcludeFilter()));
+    assertThat("changes between updated db and target db", newChanges, is(empty()));
   }
 
   /**
@@ -693,11 +559,12 @@
         evaluator = new PGStandardBatchEvaluator(platform);
         break;
       case ORA:
-        evaluator = new Oracle8StandardBatchEvaluator(platform);
+        evaluator = new OracleStandardBatchEvaluator(platform);
         break;
       }
     }
     platform.setBatchEvaluator(evaluator);
+    platform.setMaxThreads(threads);
 
     return platform;
   }
@@ -808,15 +675,19 @@
   protected String getActualValue(String tableName, String columnName) throws SQLException {
     Connection cn = null;
     PreparedStatement st = null;
+    String sql = "select " + columnName + " from " + tableName;
     try {
       cn = getDataSource().getConnection();
 
-      st = cn.prepareStatement("select " + columnName + " from " + tableName);
+      st = cn.prepareStatement(sql);
 
       ResultSet rs = st.executeQuery();
 
       rs.next();
       return rs.getString(1);
+    } catch (SQLException e) {
+      log.error("Error executing query: " + sql, e);
+      throw e;
     } finally {
       if (st != null) {
         try {
--- a/src-test/src/org/openbravo/dbsm/test/base/TestBatchEvaluator.java	Thu Oct 19 10:11:00 2017 +0200
+++ b/src-test/src/org/openbravo/dbsm/test/base/TestBatchEvaluator.java	Thu Oct 19 10:12:04 2017 +0200
@@ -40,7 +40,7 @@
   public int evaluateBatch(Connection connection, List<String> sql, boolean continueOnError,
       long firstSqlCommandIndex) throws DatabaseOperationException {
     statements.addAll(sql);
-    return sql.size();
+    return 0;
   }
 
   @Override
@@ -62,4 +62,9 @@
   public boolean isLogInfoSucessCommands() {
     return false;
   }
+
+  @Override
+  public boolean isDBEvaluator() {
+    return false;
+  }
 }
--- a/src-test/src/org/openbravo/dbsm/test/model/ModelSuite.java	Thu Oct 19 10:11:00 2017 +0200
+++ b/src-test/src/org/openbravo/dbsm/test/model/ModelSuite.java	Thu Oct 19 10:12:04 2017 +0200
@@ -15,7 +15,6 @@
 import org.junit.runner.RunWith;
 import org.junit.runners.Suite;
 import org.junit.runners.Suite.SuiteClasses;
-import org.openbravo.dbsm.test.configscript.ConfigScriptSuite;
 import org.openbravo.dbsm.test.model.data.CreateDefault;
 import org.openbravo.dbsm.test.model.data.DefaultValuesTest;
 import org.openbravo.dbsm.test.model.data.OtherDefaults;
@@ -63,8 +62,7 @@
     PreventCascadeRowDeletion.class,//
     PLCode.class,
 
-    ColumnSizeChangesWithDependentViews.class,//
-    ConfigScriptSuite.class })
+    ColumnSizeChangesWithDependentViews.class })
 public class ModelSuite {
 
 }
--- a/src-test/src/org/openbravo/dbsm/test/model/data/CreateDefault.java	Thu Oct 19 10:11:00 2017 +0200
+++ b/src-test/src/org/openbravo/dbsm/test/model/data/CreateDefault.java	Thu Oct 19 10:12:04 2017 +0200
@@ -12,7 +12,6 @@
 
 package org.openbravo.dbsm.test.model.data;
 
-import static org.hamcrest.Matchers.anyOf;
 import static org.hamcrest.Matchers.equalTo;
 import static org.hamcrest.Matchers.is;
 import static org.hamcrest.Matchers.not;
@@ -94,7 +93,8 @@
 
   @Test
   public void nonMandatoryDefault_NM1() throws SQLException {
-    assumeThat(dataMode, not(anyOf(is(DataMode.ADAfterUpdate), is(DataMode.ADAddInUpdate))));
+    assumeThat("AD data does not get defaulted with default, it requires onCreateDefault",
+        dataMode, is(DataMode.instance));
     assertDefaults("NM1", equalTo("A"));
   }
 
@@ -120,8 +120,8 @@
 
   @Test
   public void mandatoryDefault_M1() throws SQLException {
-    assumeThat(dataMode, not(anyOf(is(DataMode.ADAfterUpdate), is(DataMode.ADAddInUpdate))));
-
+    assumeThat("AD data does not get defaulted with default, it requires onCreateDefault",
+        dataMode, is(DataMode.instance));
     assertDefaults("M1", equalTo("A"));
   }
 
--- a/src-test/src/org/openbravo/dbsm/test/sourcedata/SourcedataUpdates.java	Thu Oct 19 10:11:00 2017 +0200
+++ b/src-test/src/org/openbravo/dbsm/test/sourcedata/SourcedataUpdates.java	Thu Oct 19 10:12:04 2017 +0200
@@ -21,7 +21,6 @@
 import java.util.Arrays;
 import java.util.List;
 
-import org.junit.Ignore;
 import org.junit.Test;
 import org.openbravo.dbsm.test.base.DbsmTest;
 
@@ -38,8 +37,6 @@
    * statement. See issue #35653
    */
   @Test
-  // TODO: recover this tests case once #36938 gets fixed
-  @Ignore("Current test plaform does not support src updates, see issue #36938")
   public void allChangesInARowAreExecutedAltogether() throws SQLException {
     resetDB();
     String model = "constraints/TWO_COLS_CHECK.xml";
@@ -59,8 +56,6 @@
    * Ensures changes in different AD rows are applied in proper order.
    */
   @Test
-  // TODO: recover this tests case once #36938 gets fixed
-  @Ignore("Current test plaform does not support src updates, see issue #36938")
   public void updatesAreAppliedInProperOrder() throws SQLException {
     resetDB();
     String model = "constraints/SIMPLE_UNIQUE.xml";
--- a/src/org/apache/ddlutils/Platform.java	Thu Oct 19 10:11:00 2017 +0200
+++ b/src/org/apache/ddlutils/Platform.java	Thu Oct 19 10:12:04 2017 +0200
@@ -335,8 +335,9 @@
    *          Whether to drop the tables prior to creating them (anew)
    * @param continueOnError
    *          Whether to continue executing the sql commands when an error occurred
+   * @return false if an error is raised when executing sql commands
    */
-  public void createTables(Database model, boolean dropTablesFirst, boolean continueOnError)
+  public boolean createTables(Database model, boolean dropTablesFirst, boolean continueOnError)
       throws DatabaseOperationException;
 
   /**
@@ -350,8 +351,9 @@
    *          Whether to drop the tables prior to creating them (anew)
    * @param continueOnError
    *          Whether to continue executing the sql commands when an error occurred
+   * @return false if an error is raised when executing sql commands
    */
-  public void createTables(Connection connection, Database model, boolean dropTablesFirst,
+  public boolean createTables(Connection connection, Database model, boolean dropTablesFirst,
       boolean continueOnError) throws DatabaseOperationException;
 
   /**
@@ -425,19 +427,9 @@
    *          The database model
    * @param continueOnError
    *          Whether to continue executing the sql commands when an error occurred
+   * @return true if all FK are created as expected. false if an error is occurred.
    */
-  public void createAllFKs(Database model, boolean continueOnError);
-
-  /**
-   * Alters the database schema so that it match the given model.
-   * 
-   * @param desiredDb
-   *          The desired database schema
-   * @param continueOnError
-   *          Whether to continue with the next sql statement when an error occurred
-   */
-  public void alterTables(Database desiredDb, boolean continueOnError)
-      throws DatabaseOperationException;
+  public boolean createAllFKs(Database model, boolean continueOnError);
 
   /**
    * Returns the SQL for altering the database schema so that it match the given model.
@@ -555,19 +547,6 @@
   public String getAlterTablesSql(String catalog, String schema, String[] tableTypes,
       Database desiredDb, CreationParameters params) throws DatabaseOperationException;
 
-  /**
-   * Alters the database schema so that it match the given model.
-   * 
-   * @param connection
-   *          A connection to the existing database that shall be modified
-   * @param desiredDb
-   *          The desired database schema
-   * @param continueOnError
-   *          Whether to continue with the next sql statement when an error occurred
-   */
-  public void alterTables(Connection connection, Database desiredDb, boolean continueOnError)
-      throws DatabaseOperationException;
-
   public void alterTables(Connection connection, Database currentModel, Database desiredModel,
       boolean continueOnError) throws DatabaseOperationException;
 
@@ -580,9 +559,6 @@
   public void alterData(Connection connection, Database model, Vector<Change> changes)
       throws DatabaseOperationException;
 
-  public void alterData(Database model, Vector<Change> changes, Writer writer)
-      throws DatabaseOperationException;
-
   /**
    * Executes a small postscript to correct null constraints in new not-null columns added to the
    * database.
@@ -1035,16 +1011,6 @@
   public String getInsertSql(Database model, DynaBean dynaBean);
 
   /**
-   * Inserts the given DynaBean in the database, assuming the primary key values are specified.
-   * 
-   * @param model
-   *          The database model to use
-   * @param dynaBean
-   *          The bean to insert
-   */
-  public void insert(Database model, DynaBean dynaBean) throws DatabaseOperationException;
-
-  /**
    * Inserts the bean. If one of the columns is an auto-incremented column, then the bean will also
    * be updated with the column value generated by the database. Note that the connection will not
    * be closed by this method.
@@ -1060,19 +1026,6 @@
       throws DatabaseOperationException;
 
   /**
-   * Inserts the given beans in the database, assuming the primary key values are specified. Note
-   * that a batch insert is used for subsequent beans of the same type. Also the properties for the
-   * primary keys are not updated in the beans. Hence you should not use this method when the
-   * primary key values are defined by the database (via a sequence or identity constraint).
-   * 
-   * @param model
-   *          The database model to use
-   * @param dynaBeans
-   *          The beans to insert
-   */
-  public void insert(Database model, Collection dynaBeans) throws DatabaseOperationException;
-
-  /**
    * Inserts the given beans. Note that a batch insert is used for subsequent beans of the same
    * type. Also the properties for the primary keys are not updated in the beans. Hence you should
    * not use this method when the primary key values are defined by the database (via a sequence or
@@ -1100,16 +1053,6 @@
   public String getUpdateSql(Database model, DynaBean dynaBean);
 
   /**
-   * Updates the given bean in the database, assuming the primary key values are specified.
-   * 
-   * @param model
-   *          The database model to use
-   * @param dynaBean
-   *          The bean
-   */
-  public void update(Database model, DynaBean dynaBean) throws DatabaseOperationException;
-
-  /**
    * Updates the row which maps to the given bean.
    * 
    * @param connection
@@ -1151,29 +1094,6 @@
    */
   public String getDeleteSql(Database model, DynaBean dynaBean);
 
-  /**
-   * Deletes the given bean from the database, assuming the primary key values are specified.
-   * 
-   * @param model
-   *          The database model to use
-   * @param dynaBean
-   *          The bean to delete
-   */
-  public void delete(Database model, DynaBean dynaBean) throws DatabaseOperationException;
-
-  /**
-   * Deletes the row which maps to the given bean from the database.
-   * 
-   * @param model
-   *          The database model to use
-   * @param dynaBean
-   *          The bean
-   * @param connection
-   *          The database connection
-   */
-  public void delete(Connection connection, Database model, DynaBean dynaBean)
-      throws DatabaseOperationException;
-
   public Database loadModelFromDatabase(ExcludeFilter filter) throws DatabaseOperationException;
 
   public Database loadModelFromDatabase(ExcludeFilter filter, boolean doPlSqlStandardization)
@@ -1277,6 +1197,7 @@
    *          The database model
    * @param continueOnError
    *          Whether to continue executing the sql commands when an error occurred
+   * @return true if all triggers are enabled as expected. false if an error is occurred.
    */
   public boolean enableAllTriggers(Connection connection, Database model, boolean continueOnError)
       throws DatabaseOperationException;
--- a/src/org/apache/ddlutils/PlatformFactory.java	Thu Oct 19 10:11:00 2017 +0200
+++ b/src/org/apache/ddlutils/PlatformFactory.java	Thu Oct 19 10:12:04 2017 +0200
@@ -19,97 +19,28 @@
  * under the License.
  */
 
-import java.util.HashMap;
-import java.util.Map;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.SQLException;
+
 import javax.sql.DataSource;
-import org.apache.ddlutils.platform.axion.AxionPlatform;
-import org.apache.ddlutils.platform.cloudscape.CloudscapePlatform;
-import org.apache.ddlutils.platform.db2.Db2Platform;
-import org.apache.ddlutils.platform.db2.Db2v8Platform;
-import org.apache.ddlutils.platform.derby.DerbyPlatform;
-import org.apache.ddlutils.platform.firebird.FirebirdPlatform;
-import org.apache.ddlutils.platform.hsqldb.HsqlDbPlatform;
-import org.apache.ddlutils.platform.interbase.InterbasePlatform;
-import org.apache.ddlutils.platform.maxdb.MaxDbPlatform;
-import org.apache.ddlutils.platform.mckoi.MckoiPlatform;
-import org.apache.ddlutils.platform.mssql.MSSqlPlatform;
-import org.apache.ddlutils.platform.mysql.MySqlPlatform;
-import org.apache.ddlutils.platform.mysql.MySql50Platform;
-import org.apache.ddlutils.platform.oracle.Oracle10Platform;
-import org.apache.ddlutils.platform.oracle.Oracle8Platform;
-import org.apache.ddlutils.platform.oracle.Oracle9Platform;
+
+import org.apache.ddlutils.platform.oracle.OraclePlatform;
+import org.apache.ddlutils.platform.postgresql.PostgreSql10Platform;
 import org.apache.ddlutils.platform.postgresql.PostgreSqlPlatform;
-import org.apache.ddlutils.platform.sapdb.SapDbPlatform;
-import org.apache.ddlutils.platform.sybase.SybaseASE15Platform;
-import org.apache.ddlutils.platform.sybase.SybasePlatform;
 
 /**
- * A factory of {@link org.apache.ddlutils.Platform} instances based on a case insensitive database
- * name. Note that this is a convenience class as the platforms can also simply be created via their
- * constructors.
+ * A factory of {@link org.apache.ddlutils.Platform} instances. Note that this is a convenience
+ * class as the platforms can also simply be created via their constructors.
  * 
  * @version $Revision: 209952 $
  */
 public class PlatformFactory {
-  /** The database name -> platform map. */
-  private static Map _platforms = null;
 
   /**
-   * Returns the platform map.
-   * 
-   * @return The platform list
-   */
-  private static synchronized Map getPlatforms() {
-    if (_platforms == null) {
-      // lazy initialization
-      _platforms = new HashMap();
-      registerPlatforms();
-    }
-    return _platforms;
-  }
-
-  /**
-   * Creates a new platform for the given (case insensitive) database name or returns null if the
-   * database is not recognized.
-   * 
-   * @param databaseName
-   *          The name of the database (case is not important)
-   * @return The platform or <code>null</code> if the database is not supported
-   */
-  public static synchronized Platform createNewPlatformInstance(String databaseName)
-      throws DdlUtilsException {
-    Class platformClass = (Class) getPlatforms().get(databaseName.toLowerCase());
-
-    try {
-      return platformClass != null ? (Platform) platformClass.newInstance() : null;
-    } catch (Exception ex) {
-      throw new DdlUtilsException("Could not create platform for database " + databaseName, ex);
-    }
-  }
-
-  /**
-   * Creates a new platform for the specified database. This is a shortcut method that uses
-   * {@link PlatformUtils#determineDatabaseType(String, String)} to determine the parameter for
-   * {@link #createNewPlatformInstance(String)}. Note that no database connection is established
-   * when using this method.
-   * 
-   * @param jdbcDriver
-   *          The jdbc driver
-   * @param jdbcConnectionUrl
-   *          The connection url
-   * @return The platform or <code>null</code> if the database is not supported
-   */
-  public static synchronized Platform createNewPlatformInstance(String jdbcDriver,
-      String jdbcConnectionUrl) throws DdlUtilsException {
-    return createNewPlatformInstance(new PlatformUtils().determineDatabaseType(jdbcDriver,
-        jdbcConnectionUrl));
-  }
-
-  /**
-   * Creates a new platform for the specified database. This is a shortcut method that uses
-   * {@link PlatformUtils#determineDatabaseType(DataSource)} to determine the parameter for
-   * {@link #createNewPlatformInstance(String)} . Note that this method sets the data source at the
-   * returned platform instance (method {@link Platform#setDataSource(DataSource)}).
+   * Creates a new platform for the database whose information is retrieved using the data source
+   * passed as parameter. Note that this method sets the data source at the returned platform
+   * instance (method {@link Platform#setDataSource(DataSource)}).
    * 
    * @param dataSource
    *          The data source for the database
@@ -117,45 +48,42 @@
    */
   public static synchronized Platform createNewPlatformInstance(DataSource dataSource)
       throws DdlUtilsException {
-    Platform platform = createNewPlatformInstance(new PlatformUtils()
-        .determineDatabaseType(dataSource));
-
-    platform.setDataSource(dataSource);
-    return platform;
+    try (Connection connection = dataSource.getConnection()) {
+      DatabaseMetaData metaData = connection.getMetaData();
+      Platform platform = selectPlatformInstance(metaData.getDatabaseProductName(),
+          metaData.getDatabaseMajorVersion());
+      if (platform != null) {
+        platform.setDataSource(dataSource);
+      }
+      return platform;
+    } catch (SQLException ex) {
+      throw new DatabaseOperationException("Error while reading the database metadata: "
+          + ex.getMessage(), ex);
+    }
   }
 
-  /**
-   * Creates a new platform for the specified database. This is a shortcut method that uses
-   * {@link PlatformUtils#determineDatabaseType(DataSource)} to determine the parameter for
-   * {@link #createNewPlatformInstance(String)} . Note that this method sets the data source at the
-   * returned platform instance (method {@link Platform#setDataSource(DataSource)}).
-   * 
-   * @param dataSource
-   *          The data source for the database
-   * @param username
-   *          The user name to use for connecting to the database
-   * @param password
-   *          The password to use for connecting to the database
-   * @return The platform or <code>null</code> if the database is not supported
-   */
-  public static synchronized Platform createNewPlatformInstance(DataSource dataSource,
-      String username, String password) throws DdlUtilsException {
-    Platform platform = createNewPlatformInstance(new PlatformUtils().determineDatabaseType(
-        dataSource, username, password));
-
-    platform.setDataSource(dataSource);
-    platform.setUsername(username);
-    platform.setPassword(password);
-    return platform;
-  }
-
-  /**
-   * Returns a list of all supported platforms.
-   * 
-   * @return The names of the currently registered platforms
-   */
-  public static synchronized String[] getSupportedPlatforms() {
-    return (String[]) getPlatforms().keySet().toArray(new String[0]);
+  private static Platform selectPlatformInstance(String databaseProductName, int majorVersion) {
+    try {
+      Class<? extends Platform> selectedPlatform;
+      switch (databaseProductName) {
+      case "Oracle":
+        selectedPlatform = OraclePlatform.class;
+        break;
+      case "PostgreSQL":
+        if (majorVersion >= 10) {
+          selectedPlatform = PostgreSql10Platform.class;
+        } else {
+          selectedPlatform = PostgreSqlPlatform.class;
+        }
+        break;
+      default:
+        return null;
+      }
+      return selectedPlatform.newInstance();
+    } catch (Exception ex) {
+      throw new DdlUtilsException("Could not create platform for database " + databaseProductName
+          + " version " + majorVersion, ex);
+    }
   }
 
   /**
@@ -166,63 +94,7 @@
    * @return <code>true</code> if the platform is supported
    */
   public static boolean isPlatformSupported(String platformName) {
-    return getPlatforms().containsKey(platformName.toLowerCase());
-  }
-
-  /**
-   * Registers a new platform.
-   * 
-   * @param platformName
-   *          The platform name
-   * @param platformClass
-   *          The platform class which must implement the {@link Platform} interface
-   */
-  public static synchronized void registerPlatform(String platformName, Class platformClass) {
-    addPlatform(getPlatforms(), platformName, platformClass);
-  }
-
-  /**
-   * Registers the known platforms.
-   */
-  private static void registerPlatforms() {
-    addPlatform(_platforms, AxionPlatform.DATABASENAME, AxionPlatform.class);
-    addPlatform(_platforms, CloudscapePlatform.DATABASENAME, CloudscapePlatform.class);
-    addPlatform(_platforms, Db2Platform.DATABASENAME, Db2Platform.class);
-    addPlatform(_platforms, Db2v8Platform.DATABASENAME, Db2v8Platform.class);
-    addPlatform(_platforms, DerbyPlatform.DATABASENAME, DerbyPlatform.class);
-    addPlatform(_platforms, FirebirdPlatform.DATABASENAME, FirebirdPlatform.class);
-    addPlatform(_platforms, HsqlDbPlatform.DATABASENAME, HsqlDbPlatform.class);
-    addPlatform(_platforms, InterbasePlatform.DATABASENAME, InterbasePlatform.class);
-    addPlatform(_platforms, MaxDbPlatform.DATABASENAME, MaxDbPlatform.class);
-    addPlatform(_platforms, MckoiPlatform.DATABASENAME, MckoiPlatform.class);
-    addPlatform(_platforms, MSSqlPlatform.DATABASENAME, MSSqlPlatform.class);
-    addPlatform(_platforms, MySqlPlatform.DATABASENAME, MySqlPlatform.class);
-    addPlatform(_platforms, MySql50Platform.DATABASENAME, MySql50Platform.class);
-    addPlatform(_platforms, Oracle8Platform.DATABASENAME, Oracle8Platform.class);
-    addPlatform(_platforms, Oracle9Platform.DATABASENAME, Oracle9Platform.class);
-    addPlatform(_platforms, Oracle10Platform.DATABASENAME, Oracle10Platform.class);
-    addPlatform(_platforms, PostgreSqlPlatform.DATABASENAME, PostgreSqlPlatform.class);
-    addPlatform(_platforms, SapDbPlatform.DATABASENAME, SapDbPlatform.class);
-    addPlatform(_platforms, SybasePlatform.DATABASENAME, SybasePlatform.class);
-    addPlatform(_platforms, SybaseASE15Platform.DATABASENAME, SybaseASE15Platform.class);
-  }
-
-  /**
-   * Registers a new platform.
-   * 
-   * @param platformMap
-   *          The map to add the platform info to
-   * @param platformName
-   *          The platform name
-   * @param platformClass
-   *          The platform class which must implement the {@link Platform} interface
-   */
-  private static synchronized void addPlatform(Map platformMap, String platformName,
-      Class platformClass) {
-    if (!Platform.class.isAssignableFrom(platformClass)) {
-      throw new IllegalArgumentException("Cannot register class " + platformClass.getName()
-          + " because it does not implement the " + Platform.class.getName() + " interface");
-    }
-    platformMap.put(platformName.toLowerCase(), platformClass);
+    return OraclePlatform.DATABASENAME.equalsIgnoreCase(platformName)
+        || PostgreSqlPlatform.DATABASENAME.equalsIgnoreCase(platformName);
   }
 }
--- a/src/org/apache/ddlutils/PlatformUtils.java	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,332 +0,0 @@
-package org.apache.ddlutils;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.sql.SQLException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.sql.DataSource;
-
-import org.apache.ddlutils.platform.axion.AxionPlatform;
-import org.apache.ddlutils.platform.cloudscape.CloudscapePlatform;
-import org.apache.ddlutils.platform.db2.Db2Platform;
-import org.apache.ddlutils.platform.derby.DerbyPlatform;
-import org.apache.ddlutils.platform.firebird.FirebirdPlatform;
-import org.apache.ddlutils.platform.hsqldb.HsqlDbPlatform;
-import org.apache.ddlutils.platform.interbase.InterbasePlatform;
-import org.apache.ddlutils.platform.mckoi.MckoiPlatform;
-import org.apache.ddlutils.platform.mssql.MSSqlPlatform;
-import org.apache.ddlutils.platform.mysql.MySqlPlatform;
-import org.apache.ddlutils.platform.oracle.Oracle8Platform;
-import org.apache.ddlutils.platform.postgresql.PostgreSqlPlatform;
-import org.apache.ddlutils.platform.sapdb.SapDbPlatform;
-import org.apache.ddlutils.platform.sybase.SybasePlatform;
-
-/**
- * Utility functions for dealing with database platforms.
- * 
- * @version $Revision: 279421 $
- */
-public class PlatformUtils {
-  // Extended drivers that support more than one database
-
-  /** The DataDirect Connect DB2 jdbc driver. */
-  public static final String JDBC_DRIVER_DATADIRECT_DB2 = "com.ddtek.jdbc.db2.DB2Driver";
-  /** The DataDirect Connect SQLServer jdbc driver. */
-  public static final String JDBC_DRIVER_DATADIRECT_SQLSERVER = "com.ddtek.jdbc.sqlserver.SQLServerDriver";
-  /** The DataDirect Connect Oracle jdbc driver. */
-  public static final String JDBC_DRIVER_DATADIRECT_ORACLE = "com.ddtek.jdbc.oracle.OracleDriver";
-  /** The DataDirect Connect Sybase jdbc driver. */
-  public static final String JDBC_DRIVER_DATADIRECT_SYBASE = "com.ddtek.jdbc.sybase.SybaseDriver";
-  /** The i-net DB2 jdbc driver. */
-  public static final String JDBC_DRIVER_INET_DB2 = "com.inet.drda.DRDADriver";
-  /** The i-net Oracle jdbc driver. */
-  public static final String JDBC_DRIVER_INET_ORACLE = "com.inet.ora.OraDriver";
-  /** The i-net SQLServer jdbc driver. */
-  public static final String JDBC_DRIVER_INET_SQLSERVER = "com.inet.tds.TdsDriver";
-  /** The i-net Sybase jdbc driver. */
-  public static final String JDBC_DRIVER_INET_SYBASE = "com.inet.syb.SybDriver";
-  /** The i-net pooled jdbc driver for SQLServer and Sybase. */
-  public static final String JDBC_DRIVER_INET_POOLED = "com.inet.pool.PoolDriver";
-  /** The JNetDirect SQLServer jdbc driver. */
-  public static final String JDBC_DRIVER_JSQLCONNECT_SQLSERVER = "com.jnetdirect.jsql.JSQLDriver";
-  /** The jTDS jdbc driver for SQLServer and Sybase. */
-  public static final String JDBC_DRIVER_JTDS = "net.sourceforge.jtds.jdbc.Driver";
-
-  /** The subprotocol used by the DataDirect DB2 driver. */
-  public static final String JDBC_SUBPROTOCOL_DATADIRECT_DB2 = "datadirect:db2";
-  /** The subprotocol used by the DataDirect SQLServer driver. */
-  public static final String JDBC_SUBPROTOCOL_DATADIRECT_SQLSERVER = "datadirect:sqlserver";
-  /** The subprotocol used by the DataDirect Oracle driver. */
-  public static final String JDBC_SUBPROTOCOL_DATADIRECT_ORACLE = "datadirect:oracle";
-  /** The subprotocol used by the DataDirect Sybase driver. */
-  public static final String JDBC_SUBPROTOCOL_DATADIRECT_SYBASE = "datadirect:sybase";
-  /** The subprotocol used by the i-net DB2 driver. */
-  public static final String JDBC_SUBPROTOCOL_INET_DB2 = "inetdb2";
-  /** The subprotocol used by the i-net Oracle driver. */
-  public static final String JDBC_SUBPROTOCOL_INET_ORACLE = "inetora";
-  /** A subprotocol used by the i-net SQLServer driver. */
-  public static final String JDBC_SUBPROTOCOL_INET_SQLSERVER = "inetdae";
-  /** A subprotocol used by the i-net SQLServer driver. */
-  public static final String JDBC_SUBPROTOCOL_INET_SQLSERVER6 = "inetdae6";
-  /** A subprotocol used by the i-net SQLServer driver. */
-  public static final String JDBC_SUBPROTOCOL_INET_SQLSERVER7 = "inetdae7";
-  /** A subprotocol used by the i-net SQLServer driver. */
-  public static final String JDBC_SUBPROTOCOL_INET_SQLSERVER7A = "inetdae7a";
-  /** A subprotocol used by the pooled i-net SQLServer driver. */
-  public static final String JDBC_SUBPROTOCOL_INET_SQLSERVER_POOLED_1 = "inetpool:inetdae";
-  /** A subprotocol used by the pooled i-net SQLServer driver. */
-  public static final String JDBC_SUBPROTOCOL_INET_SQLSERVER6_POOLED_1 = "inetpool:inetdae6";
-  /** A subprotocol used by the pooled i-net SQLServer driver. */
-  public static final String JDBC_SUBPROTOCOL_INET_SQLSERVER7_POOLED_1 = "inetpool:inetdae7";
-  /** A subprotocol used by the pooled i-net SQLServer driver. */
-  public static final String JDBC_SUBPROTOCOL_INET_SQLSERVER7A_POOLED_1 = "inetpool:inetdae7a";
-  /** A subprotocol used by the pooled i-net SQLServer driver. */
-  public static final String JDBC_SUBPROTOCOL_INET_SQLSERVER_POOLED_2 = "inetpool:jdbc:inetdae";
-  /** A subprotocol used by the pooled i-net SQLServer driver. */
-  public static final String JDBC_SUBPROTOCOL_INET_SQLSERVER6_POOLED_2 = "inetpool:jdbc:inetdae6";
-  /** A subprotocol used by the pooled i-net SQLServer driver. */
-  public static final String JDBC_SUBPROTOCOL_INET_SQLSERVER7_POOLED_2 = "inetpool:jdbc:inetdae7";
-  /** A subprotocol used by the pooled i-net SQLServer driver. */
-  public static final String JDBC_SUBPROTOCOL_INET_SQLSERVER7A_POOLED_2 = "inetpool:jdbc:inetdae7a";
-  /** The subprotocol used by the i-net Sybase driver. */
-  public static final String JDBC_SUBPROTOCOL_INET_SYBASE = "inetsyb";
-  /** The subprotocol used by the pooled i-net Sybase driver. */
-  public static final String JDBC_SUBPROTOCOL_INET_SYBASE_POOLED_1 = "inetpool:inetsyb";
-  /** The subprotocol used by the pooled i-net Sybase driver. */
-  public static final String JDBC_SUBPROTOCOL_INET_SYBASE_POOLED_2 = "inetpool:jdbc:inetsyb";
-  /** The subprotocol used by the JNetDirect SQLServer driver. */
-  public static final String JDBC_SUBPROTOCOL_JSQLCONNECT_SQLSERVER = "JSQLConnect";
-  /** The subprotocol used by the jTDS SQLServer driver. */
-  public static final String JDBC_SUBPROTOCOL_JTDS_SQLSERVER = "jtds:sqlserver";
-  /** The subprotocol used by the jTDS Sybase driver. */
-  public static final String JDBC_SUBPROTOCOL_JTDS_SYBASE = "jtds:sybase";
-
-  /**
-   * Maps the sub-protocl part of a jdbc connection url to a OJB platform name.
-   */
-  private HashMap jdbcSubProtocolToPlatform = new HashMap();
-  /** Maps the jdbc driver name to a OJB platform name. */
-  private HashMap jdbcDriverToPlatform = new HashMap();
-
-  /**
-   * Creates a new instance.
-   */
-  public PlatformUtils() {
-    // Note that currently Sapdb and MaxDB have equal subprotocols and
-    // drivers so we have no means to distinguish them
-    jdbcSubProtocolToPlatform.put(AxionPlatform.JDBC_SUBPROTOCOL, AxionPlatform.DATABASENAME);
-    jdbcSubProtocolToPlatform.put(CloudscapePlatform.JDBC_SUBPROTOCOL_1,
-        CloudscapePlatform.DATABASENAME);
-    jdbcSubProtocolToPlatform.put(CloudscapePlatform.JDBC_SUBPROTOCOL_2,
-        CloudscapePlatform.DATABASENAME);
-    jdbcSubProtocolToPlatform.put(Db2Platform.JDBC_SUBPROTOCOL, Db2Platform.DATABASENAME);
-    jdbcSubProtocolToPlatform.put(Db2Platform.JDBC_SUBPROTOCOL_OS390_1, Db2Platform.DATABASENAME);
-    jdbcSubProtocolToPlatform.put(Db2Platform.JDBC_SUBPROTOCOL_OS390_2, Db2Platform.DATABASENAME);
-    jdbcSubProtocolToPlatform.put(Db2Platform.JDBC_SUBPROTOCOL_JTOPEN, Db2Platform.DATABASENAME);
-    jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_DATADIRECT_DB2,
-        Db2Platform.DATABASENAME);
-    jdbcSubProtocolToPlatform
-        .put(PlatformUtils.JDBC_SUBPROTOCOL_INET_DB2, Db2Platform.DATABASENAME);
-    jdbcSubProtocolToPlatform.put(DerbyPlatform.JDBC_SUBPROTOCOL, DerbyPlatform.DATABASENAME);
-    jdbcSubProtocolToPlatform.put(FirebirdPlatform.JDBC_SUBPROTOCOL, FirebirdPlatform.DATABASENAME);
-    jdbcSubProtocolToPlatform.put(HsqlDbPlatform.JDBC_SUBPROTOCOL, HsqlDbPlatform.DATABASENAME);
-    jdbcSubProtocolToPlatform.put(InterbasePlatform.JDBC_SUBPROTOCOL,
-        InterbasePlatform.DATABASENAME);
-    jdbcSubProtocolToPlatform.put(SapDbPlatform.JDBC_SUBPROTOCOL, SapDbPlatform.DATABASENAME);
-    jdbcSubProtocolToPlatform.put(MckoiPlatform.JDBC_SUBPROTOCOL, MckoiPlatform.DATABASENAME);
-    jdbcSubProtocolToPlatform.put(MSSqlPlatform.JDBC_SUBPROTOCOL, MSSqlPlatform.DATABASENAME);
-    jdbcSubProtocolToPlatform.put(MSSqlPlatform.JDBC_SUBPROTOCOL_NEW, MSSqlPlatform.DATABASENAME);
-    jdbcSubProtocolToPlatform.put(MSSqlPlatform.JDBC_SUBPROTOCOL_INTERNAL,
-        MSSqlPlatform.DATABASENAME);
-    jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_DATADIRECT_SQLSERVER,
-        MSSqlPlatform.DATABASENAME);
-    jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_INET_SQLSERVER,
-        MSSqlPlatform.DATABASENAME);
-    jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_INET_SQLSERVER6,
-        MSSqlPlatform.DATABASENAME);
-    jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_INET_SQLSERVER7,
-        MSSqlPlatform.DATABASENAME);
-    jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_INET_SQLSERVER7A,
-        MSSqlPlatform.DATABASENAME);
-    jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_INET_SQLSERVER_POOLED_1,
-        MSSqlPlatform.DATABASENAME);
-    jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_INET_SQLSERVER6_POOLED_1,
-        MSSqlPlatform.DATABASENAME);
-    jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_INET_SQLSERVER7_POOLED_1,
-        MSSqlPlatform.DATABASENAME);
-    jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_INET_SQLSERVER7A_POOLED_1,
-        MSSqlPlatform.DATABASENAME);
-    jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_INET_SQLSERVER_POOLED_2,
-        MSSqlPlatform.DATABASENAME);
-    jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_INET_SQLSERVER6_POOLED_2,
-        MSSqlPlatform.DATABASENAME);
-    jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_INET_SQLSERVER7_POOLED_2,
-        MSSqlPlatform.DATABASENAME);
-    jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_INET_SQLSERVER7A_POOLED_2,
-        MSSqlPlatform.DATABASENAME);
-    jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_JSQLCONNECT_SQLSERVER,
-        MSSqlPlatform.DATABASENAME);
-    jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_JTDS_SQLSERVER,
-        MSSqlPlatform.DATABASENAME);
-    jdbcSubProtocolToPlatform.put(MySqlPlatform.JDBC_SUBPROTOCOL, MySqlPlatform.DATABASENAME);
-    jdbcSubProtocolToPlatform.put(Oracle8Platform.JDBC_SUBPROTOCOL_THIN,
-        Oracle8Platform.DATABASENAME);
-    jdbcSubProtocolToPlatform.put(Oracle8Platform.JDBC_SUBPROTOCOL_OCI8,
-        Oracle8Platform.DATABASENAME);
-    jdbcSubProtocolToPlatform.put(Oracle8Platform.JDBC_SUBPROTOCOL_THIN_OLD,
-        Oracle8Platform.DATABASENAME);
-    jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_DATADIRECT_ORACLE,
-        Oracle8Platform.DATABASENAME);
-    jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_INET_ORACLE,
-        Oracle8Platform.DATABASENAME);
-    jdbcSubProtocolToPlatform.put(PostgreSqlPlatform.JDBC_SUBPROTOCOL,
-        PostgreSqlPlatform.DATABASENAME);
-    jdbcSubProtocolToPlatform.put(SybasePlatform.JDBC_SUBPROTOCOL, SybasePlatform.DATABASENAME);
-    jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_DATADIRECT_SYBASE,
-        SybasePlatform.DATABASENAME);
-    jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_INET_SYBASE,
-        SybasePlatform.DATABASENAME);
-    jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_INET_SYBASE_POOLED_1,
-        SybasePlatform.DATABASENAME);
-    jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_INET_SYBASE_POOLED_2,
-        SybasePlatform.DATABASENAME);
-    jdbcSubProtocolToPlatform.put(PlatformUtils.JDBC_SUBPROTOCOL_JTDS_SYBASE,
-        SybasePlatform.DATABASENAME);
-
-    jdbcDriverToPlatform.put(AxionPlatform.JDBC_DRIVER, AxionPlatform.DATABASENAME);
-    jdbcDriverToPlatform.put(Db2Platform.JDBC_DRIVER, Db2Platform.DATABASENAME);
-    jdbcDriverToPlatform.put(Db2Platform.JDBC_DRIVER_OLD1, Db2Platform.DATABASENAME);
-    jdbcDriverToPlatform.put(Db2Platform.JDBC_DRIVER_OLD2, Db2Platform.DATABASENAME);
-    jdbcDriverToPlatform.put(Db2Platform.JDBC_DRIVER_JTOPEN, Db2Platform.DATABASENAME);
-    jdbcDriverToPlatform.put(PlatformUtils.JDBC_DRIVER_DATADIRECT_DB2, Db2Platform.DATABASENAME);
-    jdbcDriverToPlatform.put(PlatformUtils.JDBC_DRIVER_INET_DB2, Db2Platform.DATABASENAME);
-    jdbcDriverToPlatform.put(DerbyPlatform.JDBC_DRIVER_EMBEDDED, DerbyPlatform.DATABASENAME);
-    jdbcDriverToPlatform.put(DerbyPlatform.JDBC_DRIVER, DerbyPlatform.DATABASENAME);
-    jdbcDriverToPlatform.put(FirebirdPlatform.JDBC_DRIVER, FirebirdPlatform.DATABASENAME);
-    jdbcDriverToPlatform.put(HsqlDbPlatform.JDBC_DRIVER, HsqlDbPlatform.DATABASENAME);
-    jdbcDriverToPlatform.put(InterbasePlatform.JDBC_DRIVER, InterbasePlatform.DATABASENAME);
-    jdbcDriverToPlatform.put(SapDbPlatform.JDBC_DRIVER, SapDbPlatform.DATABASENAME);
-    jdbcDriverToPlatform.put(MckoiPlatform.JDBC_DRIVER, MckoiPlatform.DATABASENAME);
-    jdbcDriverToPlatform.put(MSSqlPlatform.JDBC_DRIVER, MSSqlPlatform.DATABASENAME);
-    jdbcDriverToPlatform.put(MSSqlPlatform.JDBC_DRIVER_NEW, MSSqlPlatform.DATABASENAME);
-    jdbcDriverToPlatform.put(PlatformUtils.JDBC_DRIVER_DATADIRECT_SQLSERVER,
-        MSSqlPlatform.DATABASENAME);
-    jdbcDriverToPlatform.put(PlatformUtils.JDBC_DRIVER_INET_SQLSERVER, MSSqlPlatform.DATABASENAME);
-    jdbcDriverToPlatform.put(PlatformUtils.JDBC_DRIVER_JSQLCONNECT_SQLSERVER,
-        MSSqlPlatform.DATABASENAME);
-    jdbcDriverToPlatform.put(MySqlPlatform.JDBC_DRIVER, MySqlPlatform.DATABASENAME);
-    jdbcDriverToPlatform.put(MySqlPlatform.JDBC_DRIVER_OLD, MySqlPlatform.DATABASENAME);
-    jdbcDriverToPlatform.put(Oracle8Platform.JDBC_DRIVER, Oracle8Platform.DATABASENAME);
-    jdbcDriverToPlatform.put(Oracle8Platform.JDBC_DRIVER_OLD, Oracle8Platform.DATABASENAME);
-    jdbcDriverToPlatform.put(PlatformUtils.JDBC_DRIVER_DATADIRECT_ORACLE,
-        Oracle8Platform.DATABASENAME);
-    jdbcDriverToPlatform.put(PlatformUtils.JDBC_DRIVER_INET_ORACLE, Oracle8Platform.DATABASENAME);
-    jdbcDriverToPlatform.put(PostgreSqlPlatform.JDBC_DRIVER, PostgreSqlPlatform.DATABASENAME);
-    jdbcDriverToPlatform.put(SybasePlatform.JDBC_DRIVER, SybasePlatform.DATABASENAME);
-    jdbcDriverToPlatform.put(SybasePlatform.JDBC_DRIVER_OLD, SybasePlatform.DATABASENAME);
-    jdbcDriverToPlatform.put(PlatformUtils.JDBC_DRIVER_DATADIRECT_SYBASE,
-        SybasePlatform.DATABASENAME);
-    jdbcDriverToPlatform.put(PlatformUtils.JDBC_DRIVER_INET_SYBASE, SybasePlatform.DATABASENAME);
-  }
-
-  /**
-   * Tries to determine the database type for the given data source. Note that this will establish a
-   * connection to the database.
-   * 
-   * @param dataSource
-   *          The data source
-   * @return The database type or <code>null</code> if the database type couldn't be determined
-   */
-  public String determineDatabaseType(DataSource dataSource) throws DatabaseOperationException {
-    return determineDatabaseType(dataSource, null, null);
-  }
-
-  /**
-   * Tries to determine the database type for the given data source. Note that this will establish a
-   * connection to the database.
-   * 
-   * @param dataSource
-   *          The data source
-   * @param username
-   *          The user name to use for connecting to the database
-   * @param password
-   *          The password to use for connecting to the database
-   * @return The database type or <code>null</code> if the database type couldn't be determined
-   */
-  public String determineDatabaseType(DataSource dataSource, String username, String password)
-      throws DatabaseOperationException {
-    Connection connection = null;
-
-    try {
-      if (username != null) {
-        connection = dataSource.getConnection(username, password);
-      } else {
-        connection = dataSource.getConnection();
-      }
-
-      DatabaseMetaData metaData = connection.getMetaData();
-
-      return determineDatabaseType(metaData.getDriverName(), metaData.getURL());
-    } catch (SQLException ex) {
-      throw new DatabaseOperationException("Error while reading the database metadata: "
-          + ex.getMessage(), ex);
-    } finally {
-      if (connection != null) {
-        try {
-          connection.close();
-        } catch (SQLException ex) {
-          // we ignore this one
-        }
-      }
-    }
-  }
-
-  /**
-   * Tries to determine the database type for the given jdbc driver and connection url.
-   * 
-   * @param driverName
-   *          The fully qualified name of the JDBC driver
-   * @param jdbcConnectionUrl
-   *          The connection url
-   * @return The database type or <code>null</code> if the database type couldn't be determined
-   */
-  public String determineDatabaseType(String driverName, String jdbcConnectionUrl) {
-    if (jdbcDriverToPlatform.containsKey(driverName)) {
-      return (String) jdbcDriverToPlatform.get(driverName);
-    }
-    if (jdbcConnectionUrl == null) {
-      return null;
-    }
-    for (Iterator it = jdbcSubProtocolToPlatform.entrySet().iterator(); it.hasNext();) {
-      Map.Entry entry = (Map.Entry) it.next();
-      String curSubProtocol = "jdbc:" + (String) entry.getKey() + ":";
-
-      if (jdbcConnectionUrl.startsWith(curSubProtocol)) {
-        return (String) entry.getValue();
-      }
-    }
-    return null;
-  }
-}
--- a/src/org/apache/ddlutils/alteration/package.html	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-<html>
-<head>
-<!-- 
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-   <meta name="Author" content="Thomas Dudziak">
-</head>
-<body bgcolor="white">
-  <p>
-  	Contains the algorithm for comparing two database models and determining
-    what needs to be changed to migrate one to the other.
-  </p>
-</body>
-</html>
--- a/src/org/apache/ddlutils/dynabean/package.html	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-<html>
-<head>
-<!-- 
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-   <meta name="Author" content="Thomas Dudziak">
-</head>
-<body bgcolor="white">
-  <p>
-  	Provides the special DdlUtils implementations of {@link org.apache.commons.beanutils.DynaClass}
-  	and {@link org.apache.commons.beanutils.DynaBean} that directly map to tables in the database
-  	model. These are used by DdlUtils when reading data from or writing data to the database.
-  	If you want to create these beans manually, use the
-  	{@link org.apache.ddlutils.model.Database#createDynaBeanFor(org.apache.ddlutils.model.Table)} and
-  	{@link org.apache.ddlutils.model.Database#createDynaBeanFor(java.lang.String, boolean)} methods
-  	rather than the classes directly.
-  </p>
-</body>
-</html>
--- a/src/org/apache/ddlutils/io/converters/package.html	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-<html>
-<head>
-<!-- 
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-   <meta name="Author" content="Thomas Dudziak">
-</head>
-<body bgcolor="white">
-  <p>
-  	This package contains helper classes that convert between textual representations
-  	and values of the types that correspond to the JDBC type codes given by
-  	{@link java.sql.Types}. These converters are used by the 
-  	{@link org.apache.ddlutils.io.DataReader} when inserting data into the database.
-<!-- TODO: Add a reference to DataWriter once it uses converters -->
-  </p>
-</body>
-</html>
--- a/src/org/apache/ddlutils/io/package.html	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-<html>
-<head>
-<!-- 
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-   <meta name="Author" content="Thomas Dudziak">
-</head>
-<body bgcolor="white">
-  <p>
-  	The <code>org.apache.ddlutils.io</code> package contains a classes for input
-  	and output of both the database schemas and data files. Specifically, the
-  	{@link org.apache.ddlutils.io.DatabaseIO} class reads from and writes to schema
-  	XML files, and the {@link org.apache.ddlutils.io.DataReader} and
-  	{@link org.apache.ddlutils.io.DataWriter} classes to the same for data XML files.
-  	The DTD for these data XML files is generated via the
-  	{@link org.apache.ddlutils.io.DataDtdWriter} class.
-  </p>
-</body>
-</html>
--- a/src/org/apache/ddlutils/model/package.html	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-<html>
-<head>
-<!-- 
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-   <meta name="Author" content="Thomas Dudziak">
-</head>
-<body bgcolor="white">
-  <p>
-  	This package contains the classes making up the database model.
-  </p>
-</body>
-</html>
--- a/src/org/apache/ddlutils/package.html	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-<html>
-<head>
-<!-- 
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-   <meta name="Author" content="Thomas Dudziak">
-</head>
-<body bgcolor="white">
-  <p>
-  	This package mainly contains the database platform abstraction, {@link org.apache.ddlutils.Platform}
-  	and the factory to create instances for individual platforms,
-  	{@link org.apache.ddlutils.PlatformFactory}.
-  </p>
-</body>
-</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/apache/ddlutils/platform/FileBatchEvaluator.java	Thu Oct 19 10:12:04 2017 +0200
@@ -0,0 +1,82 @@
+/*
+ ************************************************************************************
+ * Copyright (C) 2017 Openbravo S.L.U.
+ * Licensed under the Apache Software License version 2.0
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to  in writing,  software  distributed
+ * under the License is distributed  on  an  "AS IS"  BASIS,  WITHOUT  WARRANTIES  OR
+ * CONDITIONS OF ANY KIND, either  express  or  implied.  See  the  License  for  the
+ * specific language governing permissions and limitations under the License.
+ ************************************************************************************
+ */
+
+package org.apache.ddlutils.platform;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.StandardOpenOption;
+import java.sql.Connection;
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ddlutils.DatabaseOperationException;
+import org.apache.ddlutils.Platform;
+
+/** Writes statements in {@code out File} */
+public class FileBatchEvaluator implements SQLBatchEvaluator {
+  private static final Log log = LogFactory.getLog(PlatformImplBase.class);
+  private Path outPath;
+
+  public FileBatchEvaluator(File out) {
+    outPath = out.toPath();
+    try {
+      Files.deleteIfExists(outPath);
+      Files.createFile(outPath);
+    } catch (IOException e) {
+      throw new RuntimeException("Couldn't create file " + out, e);
+    }
+
+  }
+
+  @Override
+  public void setPlatform(Platform p) {
+    // platform not needed
+  }
+
+  @Override
+  public int evaluateBatch(Connection connection, List<String> statements, boolean continueOnError,
+      long firstSqlCommandIndex) throws DatabaseOperationException {
+    for (String sql : statements) {
+      try {
+        Files.write(outPath, sql.getBytes(), StandardOpenOption.APPEND);
+      } catch (IOException e) {
+        log.error("Error writting to " + outPath, e);
+      }
+    }
+    return 0; // 0 failures
+  }
+
+  @Override
+  public int evaluateBatchRealBatch(Connection connection, List<String> sql, boolean continueOnError)
+      throws DatabaseOperationException {
+    return evaluateBatch(connection, sql, continueOnError, 0);
+  }
+
+  @Override
+  public void setLogInfoSucessCommands(boolean logInfoSucessCommands) {
+
+  }
+
+  @Override
+  public boolean isLogInfoSucessCommands() {
+    return false;
+  }
+
+  @Override
+  public boolean isDBEvaluator() {
+    return false;
+  }
+}
\ No newline at end of file
--- a/src/org/apache/ddlutils/platform/Oracle8StandardBatchEvaluator.java	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- ************************************************************************************
- * Copyright (C) 2015 Openbravo S.L.U.
- * Licensed under the Apache Software License version 2.0
- * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to  in writing,  software  distributed
- * under the License is distributed  on  an  "AS IS"  BASIS,  WITHOUT  WARRANTIES  OR
- * CONDITIONS OF ANY KIND, either  express  or  implied.  See  the  License  for  the
- * specific language governing permissions and limitations under the License.
- ************************************************************************************
- */
-
-package org.apache.ddlutils.platform;
-
-import java.sql.Connection;
-import java.util.List;
-
-import org.apache.ddlutils.Platform;
-
-public class Oracle8StandardBatchEvaluator extends StandardBatchEvaluator {
-
-  public Oracle8StandardBatchEvaluator(Platform platform) {
-    super(platform);
-  }
-
-  @Override
-  protected int handleFailedBatchExecution(Connection connection, List<String> sql,
-      boolean continueOnError, long indexFailedStatement) {
-    _log.info("Batch statement failed. Retrying from statement #" + indexFailedStatement + "("
-        + sql.get((int) indexFailedStatement) + ")");
-    // The batch failed. We will execute all commands again using the old method
-    return evaluateBatch(connection, sql, continueOnError, indexFailedStatement);
-  }
-
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/apache/ddlutils/platform/OracleStandardBatchEvaluator.java	Thu Oct 19 10:12:04 2017 +0200
@@ -0,0 +1,35 @@
+/*
+ ************************************************************************************
+ * Copyright (C) 2015 Openbravo S.L.U.
+ * Licensed under the Apache Software License version 2.0
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to  in writing,  software  distributed
+ * under the License is distributed  on  an  "AS IS"  BASIS,  WITHOUT  WARRANTIES  OR
+ * CONDITIONS OF ANY KIND, either  express  or  implied.  See  the  License  for  the
+ * specific language governing permissions and limitations under the License.
+ ************************************************************************************
+ */
+
+package org.apache.ddlutils.platform;
+
+import java.sql.Connection;
+import java.util.List;
+
+import org.apache.ddlutils.Platform;
+
+public class OracleStandardBatchEvaluator extends StandardBatchEvaluator {
+
+  public OracleStandardBatchEvaluator(Platform platform) {
+    super(platform);
+  }
+
+  @Override
+  protected int handleFailedBatchExecution(Connection connection, List<String> sql,
+      boolean continueOnError, long indexFailedStatement) {
+    _log.info("Batch statement failed. Retrying from statement #" + indexFailedStatement + "("
+        + sql.get((int) indexFailedStatement) + ")");
+    // The batch failed. We will execute all commands again using the old method
+    return evaluateBatch(connection, sql, continueOnError, indexFailedStatement);
+  }
+
+}
--- a/src/org/apache/ddlutils/platform/PlatformImplBase.java	Thu Oct 19 10:11:00 2017 +0200
+++ b/src/org/apache/ddlutils/platform/PlatformImplBase.java	Thu Oct 19 10:12:04 2017 +0200
@@ -470,12 +470,12 @@
   /**
    * {@inheritDoc}
    */
-  public void createTables(Database model, boolean dropTablesFirst, boolean continueOnError)
+  public boolean createTables(Database model, boolean dropTablesFirst, boolean continueOnError)
       throws DatabaseOperationException {
     Connection connection = borrowConnection();
 
     try {
-      createTables(connection, model, dropTablesFirst, continueOnError);
+      return createTables(connection, model, dropTablesFirst, continueOnError);
     } finally {
       returnConnection(connection);
     }
@@ -484,12 +484,12 @@
   /**
    * {@inheritDoc}
    */
-  public void createTables(Connection connection, Database model, boolean dropTablesFirst,
+  public boolean createTables(Connection connection, Database model, boolean dropTablesFirst,
       boolean continueOnError) throws DatabaseOperationException {
     String sql = getCreateTablesSql(model, dropTablesFirst, continueOnError);
     _log.info("Finished preparing SQL");
 
-    evaluateBatch(connection, sql, continueOnError);
+    return evaluateBatch(connection, sql, continueOnError) > 0 ? false : true;
   }
 
   /**
@@ -562,9 +562,9 @@
   }
 
   @Override
-  public void createAllFKs(Database model, boolean continueOnError) {
+  public boolean createAllFKs(Database model, boolean continueOnError) {
     Connection connection = borrowConnection();
-
+    boolean isExecuted = false;
     try {
       String sql;
       StringWriter buffer = new StringWriter();
@@ -572,26 +572,13 @@
       getSqlBuilder().setWriter(buffer);
       getSqlBuilder().createExternalForeignKeys(model);
       sql = buffer.toString();
-      evaluateBatchRealBatch(connection, sql, continueOnError);
+      isExecuted = evaluateBatchRealBatch(connection, sql, continueOnError) > 0 ? false : true;
     } catch (IOException e) {
       // won't happen because we're using a string writer
     }
 
     returnConnection(connection);
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public void alterTables(Database desiredDb, boolean continueOnError)
-      throws DatabaseOperationException {
-    Connection connection = borrowConnection();
-
-    try {
-      alterTables(connection, desiredDb, continueOnError);
-    } finally {
-      returnConnection(connection);
-    }
+    return isExecuted;
   }
 
   /**
@@ -638,26 +625,9 @@
   /**
    * {@inheritDoc}
    */
-  public void alterTables(Connection connection, Database desiredModel, boolean continueOnError)
-      throws DatabaseOperationException {
-    String sql = getAlterTablesSql(connection, desiredModel);
-
-    evaluateBatch(connection, sql, continueOnError);
-  }
-
-  public void alterTables(Connection connection, Database desiredModel, boolean continueOnError,
-      List changes) throws DatabaseOperationException {
-    String sql = getAlterTablesSql(connection, desiredModel, changes);
-
-    evaluateBatch(connection, sql, continueOnError);
-  }
-
-  /**
-   * {@inheritDoc}
-   */
   public void alterTables(Database currentModel, Database desiredModel, boolean continueOnError)
       throws DatabaseOperationException {
-
+    _log.info("Updating database model...");
     Connection connection = borrowConnection();
 
     try {
@@ -741,7 +711,7 @@
   public boolean alterTablesPostScript(Database currentModel, Database desiredModel,
       boolean continueOnError, List changes, Database fullModel, OBDataset ad)
       throws DatabaseOperationException {
-
+    _log.info("Dropping temporary tables...");
     Connection connection = borrowConnection();
 
     try {
@@ -755,7 +725,7 @@
 
   public List alterTablesRecreatePKs(Database currentModel, Database desiredModel,
       boolean continueOnError) throws DatabaseOperationException {
-
+    _log.info("Recreating Primary Keys...");
     Connection connection = borrowConnection();
 
     try {
@@ -844,12 +814,17 @@
 
   public void alterData(Connection connection, Database model, Vector<Change> changes)
       throws DatabaseOperationException {
+    _log.info("Updating Application Dictionary data...");
+
     // ColumnDataChanges are individual column changes, let's group them per row to update them
     // altogether. Note they're already sorted by row.
     List<ColumnDataChange> rowDataChanges = new ArrayList<>();
     Object currentPK = null;
     String currentTable = null;
 
+    StringWriter buffer = new StringWriter();
+    getSqlBuilder().setWriter(buffer);
+
     for (Change change : changes) {
       if (change instanceof ColumnDataChange) {
         ColumnDataChange updateChange = (ColumnDataChange) change;
@@ -867,7 +842,7 @@
       }
 
       if (change instanceof AddRowChange) {
-        upsert(connection, model, ((AddRowChange) change).getRow());
+        insert(connection, model, ((AddRowChange) change).getRow());
       } else if (change instanceof RemoveRowChange) {
         delete(connection, model, (RemoveRowChange) change);
       }
@@ -875,80 +850,11 @@
 
     // flush possible pending row data changes
     update(connection, model, rowDataChanges);
+
+    String sql = buffer.toString();
+    evaluateBatch(connection, sql, false);
   }
 
-  public void alterData(Database model, Vector<Change> changes, Writer writer)
-      throws DatabaseOperationException {
-    try {
-      getSqlBuilder().setWriter(writer);
-      for (Change change : changes) {
-        if (change instanceof AddRowChange) {
-          HashMap map = new HashMap();
-          AddRowChange addChange = (AddRowChange) change;
-          Table table = addChange.getTable();
-          for (int i = 0; i < table.getColumnCount(); i++) {
-            if (table.getColumn(i).getName().equalsIgnoreCase("UPDATED"))
-              map.put(table.getColumn(i).getName(), "now()");
-            else if (table.getColumn(i).getName().equalsIgnoreCase("UPDATEDBY"))
-              map.put(table.getColumn(i).getName(), "O");
-            else if (table.getColumn(i).getName().equalsIgnoreCase("CREATED"))
-              map.put(table.getColumn(i).getName(), "now()");
-            else if (table.getColumn(i).getName().equalsIgnoreCase("CREATEDBY"))
-              map.put(table.getColumn(i).getName(), "0");
-            else
-              map.put(table.getColumn(i).getName(),
-                  addChange.getRow().get(table.getColumn(i).getName()));
-          }
-
-          writer.append(getSqlBuilder().getInsertSql(table, map, false));
-          getSqlBuilder().printEndOfStatement("");
-        } else if (change instanceof RemoveRowChange) {
-          RemoveRowChange removeChange = (RemoveRowChange) change;
-          HashMap map = new HashMap();
-          Table table = removeChange.getTable();
-          for (int i = 0; i < table.getPrimaryKeyColumns().length; i++)
-            map.put(table.getPrimaryKeyColumns()[i].getName(),
-                removeChange.getRow().get(table.getPrimaryKeyColumns()[i].getName()).toString());
-          writer.append(getSqlBuilder().getDeleteSql(table, map, false));
-          getSqlBuilder().printEndOfStatement("");
-        } else if (change instanceof ColumnDataChange) {
-          HashMap map = new HashMap();
-          ColumnDataChange colChange = (ColumnDataChange) change;
-          Table table = colChange.getTable();
-          String pk = table.getPrimaryKeyColumns()[0].getName();
-          map.put(pk, colChange.getPkRow());
-          if (table.findColumn("UPDATED") != null)
-            map.put("UPDATED", "now()");
-          else if (table.findColumn("UPDATEDBY") != null)
-            map.put("UPDATEDBY", "O");
-          if (colChange.getColumnname().equalsIgnoreCase("CREATED"))
-            map.put(colChange.getColumnname(), "now()");
-          else if (colChange.getColumnname().equalsIgnoreCase("CREATEDBY"))
-            map.put(colChange.getColumnname(), "0");
-          else
-            map.put(colChange.getColumnname(), colChange.getNewValue());
-
-          writer.append(getSqlBuilder().getUpdateSql(table, map, false));
-          getSqlBuilder().printEndOfStatement("");
-        }
-      }
-      writer.flush();
-
-    } catch (Exception e) {
-      e.printStackTrace();
-    }
-  }
-
-  /*
-   * String sql = null;
-   * 
-   * try { StringWriter buffer = new StringWriter();
-   * 
-   * getSqlBuilder().setWriter(buffer); getSqlBuilder().alterData(model, changes); sql =
-   * buffer.toString(); } catch (IOException ex) { // won't happen because we're using a string
-   * writer } evaluateBatch(connection, sql, true);
-   */
-
   /**
    * {@inheritDoc}
    */
@@ -1614,15 +1520,7 @@
    */
   public void upsert(Connection connection, Database model, DynaBean dynaBean)
       throws DatabaseOperationException {
-    _log.debug("Attempting to update a single row " + dynaBean + " into table ");
-    // int count = privateupdate(connection, model, dynaBean);
-    // if (count == 0) {
     insert(connection, model, dynaBean);
-    /*
-     * } else if (count != 1) { _log.warn("Attempted to update a single row " + dynaBean +
-     * " into table " + model.getDynaClassFor(dynaBean).getTableName() + " but changed " + count +
-     * " row(s)"); }
-     */
   }
 
   /**
@@ -1655,13 +1553,20 @@
       return;
     }
 
-    String insertSql = createInsertSql(model, dynaClass, properties, null);
+    String insertSql = createInsertSql(model, dynaClass, properties,
+        batchEvaluator.isDBEvaluator() ? null : dynaBean);
     String queryIdentitySql = null;
 
     if (_log.isDebugEnabled()) {
       _log.debug("About to execute SQL: " + insertSql);
     }
 
+    if (!batchEvaluator.isDBEvaluator()) {
+      // not working with actual db -> evaluate and go
+      batchEvaluator.evaluateBatch(connection, Arrays.asList(insertSql + ";\n"), true, 0);
+      return;
+    }
+
     if (autoIncrColumns.length > 0) {
       if (!getPlatformInfo().isLastIdentityValueReadable()) {
         _log.warn("The database does not support querying for auto-generated column values");
@@ -1682,8 +1587,6 @@
 
       Timestamp date = getDateStatement(connection);
 
-      beforeInsert(connection, dynaClass.getTable());
-
       statement = connection.prepareStatement(insertSql);
 
       int sqlIndex = 1;
@@ -1715,8 +1618,6 @@
 
       int count = statement.executeUpdate();
 
-      afterInsert(connection, dynaClass.getTable());
-
       if (count != 1) {
         _log.warn("Attempted to insert a single row " + dynaBean + " in table "
             + dynaClass.getTableName() + " but changed " + count + " row(s)");
@@ -1798,19 +1699,6 @@
   /**
    * {@inheritDoc}
    */
-  public void insert(Database model, DynaBean dynaBean) throws DatabaseOperationException {
-    Connection connection = borrowConnection();
-
-    try {
-      insert(connection, model, dynaBean);
-    } finally {
-      returnConnection(connection);
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   */
   public void insert(Connection connection, Database model, Collection dynaBeans)
       throws DatabaseOperationException {
     SqlDynaClass dynaClass = null;
@@ -1912,12 +1800,9 @@
       try {
         Connection connection = statement.getConnection();
 
-        beforeInsert(connection, table);
-
         int[] results = statement.executeBatch();
 
         closeStatement(statement);
-        afterInsert(connection, table);
 
         boolean hasSum = true;
         int sum = 0;
@@ -1948,43 +1833,6 @@
   }
 
   /**
-   * {@inheritDoc}
-   */
-  public void insert(Database model, Collection dynaBeans) throws DatabaseOperationException {
-    Connection connection = borrowConnection();
-
-    try {
-      insert(connection, model, dynaBeans);
-    } finally {
-      returnConnection(connection);
-    }
-  }
-
-  /**
-   * Allows platforms to issue statements directly before rows are inserted into the specified
-   * table.
-   * 
-   * @param connection
-   *          The connection used for the insertion
-   * @param table
-   *          The table that the rows are inserted into
-   */
-  protected void beforeInsert(Connection connection, Table table) throws SQLException {
-  }
-
-  /**
-   * Allows platforms to issue statements directly after rows have been inserted into the specified
-   * table.
-   * 
-   * @param connection
-   *          The connection used for the insertion
-   * @param table
-   *          The table that the rows have been inserted into
-   */
-  protected void afterInsert(Connection connection, Table table) throws SQLException {
-  }
-
-  /**
    * Creates the SQL for updating an object of the given type. If a concrete bean is given, then a
    * concrete update statement is created, otherwise an update statement usable in a prepared
    * statement is build.
@@ -2122,13 +1970,19 @@
       params.put(change.getColumnname(), change.getNewValue());
     }
 
-    String sql = getSqlBuilder().getUpdateSql(table, params, true);
+    String sql = getSqlBuilder().getUpdateSql(table, params, batchEvaluator.isDBEvaluator());
     PreparedStatement statement = null;
 
     if (_log.isDebugEnabled()) {
       _log.debug("About to execute SQL: " + sql + " - " + params);
     }
 
+    if (!batchEvaluator.isDBEvaluator()) {
+      // not working with actual db -> evaluate and go
+      batchEvaluator.evaluateBatch(connection, Arrays.asList(sql + ";\n"), true, 0);
+      return;
+    }
+
     try {
       beforeUpdate(connection, table);
 
@@ -2182,19 +2036,6 @@
   }
 
   /**
-   * {@inheritDoc}
-   */
-  public void update(Database model, DynaBean dynaBean) throws DatabaseOperationException {
-    Connection connection = borrowConnection();
-
-    try {
-      update(connection, model, dynaBean);
-    } finally {
-      returnConnection(connection);
-    }
-  }
-
-  /**
    * Allows platforms to issue statements directly before rows are updated in the specified table.
    * 
    * @param connection
@@ -2286,61 +2127,6 @@
     }
   }
 
-  /**
-   * {@inheritDoc}
-   */
-  public void delete(Database model, DynaBean dynaBean) throws DatabaseOperationException {
-    Connection connection = borrowConnection();
-
-    try {
-      delete(connection, model, dynaBean);
-    } finally {
-      returnConnection(connection);
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public void delete(Connection connection, Database model, DynaBean dynaBean)
-      throws DatabaseOperationException {
-    PreparedStatement statement = null;
-
-    try {
-      SqlDynaClass dynaClass = model.getDynaClassFor(dynaBean);
-      SqlDynaProperty[] primaryKeys = dynaClass.getPrimaryKeyProperties();
-
-      if (primaryKeys.length == 0) {
-        _log.warn("Cannot delete instances of type " + dynaClass
-            + " because it has no primary keys");
-        return;
-      }
-
-      String sql = createDeleteSql(model, dynaClass, primaryKeys, null);
-
-      if (_log.isDebugEnabled()) {
-        _log.debug("About to execute SQL " + sql);
-      }
-
-      statement = connection.prepareStatement(sql);
-
-      for (int idx = 0; idx < primaryKeys.length; idx++) {
-        setObject(statement, idx + 1, dynaBean, primaryKeys[idx]);
-      }
-
-      int count = statement.executeUpdate();
-
-      if (count != 1) {
-        _log.warn("Attempted to delete a single row " + dynaBean + " in table "
-            + dynaClass.getTableName() + " but changed " + count + " row(s).");
-      }
-    } catch (SQLException ex) {
-      throw new DatabaseOperationException("Error while deleting from the database", ex);
-    } finally {
-      closeStatement(statement);
-    }
-  }
-
   public void delete(Connection connection, Database model, RemoveRowChange change)
       throws DatabaseOperationException {
     PreparedStatement statement = null;
@@ -2348,10 +2134,16 @@
     try {
       Table table = change.getTable();
       Column[] pk = table.getPrimaryKeyColumns();
-      HashMap pkValues = new HashMap();
+      Map<String, Object> pkValues = new HashMap<>();
       pkValues.put(pk[0].getName(), change.getRow().get(pk[0].getName()).toString());
-      String sql = getSqlBuilder().getDeleteSql(change.getTable(), pkValues, true);
-      // createDeleteSql(model, dynaClass, primaryKeys, null);
+      String sql = getSqlBuilder().getDeleteSql(change.getTable(), pkValues,
+          batchEvaluator.isDBEvaluator());
+
+      if (!batchEvaluator.isDBEvaluator()) {
+        // not working with actual db -> evaluate and go
+        batchEvaluator.evaluateBatch(connection, Arrays.asList(sql + ";\n"), true, 0);
+        return;
+      }
 
       if (_log.isDebugEnabled()) {
         _log.debug("About to execute SQL " + sql);
@@ -2362,7 +2154,7 @@
         setObject(statement, idx + 1, change.getRow().get(pk[idx].getName()).toString(), pk[idx]);
       }
 
-      int count = statement.executeUpdate();
+      statement.executeUpdate();
 
     } catch (SQLException ex) {
       throw new DatabaseOperationException("Error while deleting from the database", ex);
@@ -2392,7 +2184,7 @@
 
   public Database loadModelFromDatabase(ExcludeFilter filter, boolean doPlSqlStandardization)
       throws DatabaseOperationException {
-
+    _log.info("Loading model from database...");
     Connection connection = borrowConnection();
     try {
       getModelLoader().setLog(_log);
@@ -2404,6 +2196,7 @@
     }
   }
 
+  /** API for ezattributes */
   public Database loadModelFromDatabase(ExcludeFilter filter, String prefix,
       boolean loadCompleteTables, String moduleId) throws DatabaseOperationException {
 
@@ -2506,6 +2299,7 @@
   public void disableDatasetFK(Connection connection, Database model, OBDataset dataset,
       boolean continueOnError, Set<String> datasetTablesWithRemovedOrInsertedRecords)
       throws DatabaseOperationException {
+    _log.info("Disabling foreign keys");
     try {
       StringWriter buffer = new StringWriter();
       getSqlBuilder().setWriter(buffer);
@@ -2552,7 +2346,7 @@
    */
   public void disableAllTriggers(Connection connection, Database model, boolean continueOnError)
       throws DatabaseOperationException {
-
+    _log.info("Disabling triggers");
     try {
       StringWriter endStatementBuffer = new StringWriter();
       getSqlBuilder().setWriter(endStatementBuffer);
@@ -2603,6 +2397,7 @@
   public boolean enableDatasetFK(Connection connection, Database model, OBDataset dataset,
       Set<String> datasetTablesWithRemovedOrInsertedRecords, boolean continueOnError)
       throws DatabaseOperationException {
+    _log.info("Enabling Foreign Keys...");
     try {
       StringWriter buffer = new StringWriter();
       getSqlBuilder().setWriter(buffer);
@@ -2635,6 +2430,8 @@
    */
   public boolean enableAllTriggers(Connection connection, Database model, boolean continueOnError)
       throws DatabaseOperationException {
+    _log.info("Enabling Triggers...");
+    boolean isEvaluated = false;
     try {
       StringWriter endStatementBuffer = new StringWriter();
       getSqlBuilder().setWriter(endStatementBuffer);
@@ -2650,7 +2447,8 @@
           buffer.append(rs.getString("SQL_STR"));
           buffer.append(endOfStatement);
         }
-        evaluateBatchRealBatch(connection, buffer.toString(), continueOnError);
+        isEvaluated = evaluateBatchRealBatch(connection, buffer.toString(), continueOnError) > 0 ? false
+            : true;
       } catch (SQLException e) {
         getLog().error("SQL command failed: " + query, e);
         throw new DatabaseOperationException("Error while disabling triggers ", e);
@@ -2658,7 +2456,7 @@
     } catch (IOException e) {
       getLog().error("Error when writing in a StringWriter", e);
     }
-    return true;
+    return isEvaluated;
   }
 
   /**
@@ -3097,6 +2895,7 @@
   }
 
   public void deleteInvalidConstraintRows(Database model, OBDataset dataset, boolean continueOnError) {
+    _log.info("Removing invalid rows.");
     Set<String> allDatasetTables = new HashSet<String>();
     Vector<OBDatasetTable> datasetTables = dataset.getTableList();
     for (int i = 0; i < datasetTables.size(); i++) {
@@ -3294,6 +3093,7 @@
 
   @Override
   public void disableNOTNULLColumns(Database db, OBDataset ad) {
+    _log.info("Disabling not null constatraints...");
     Connection connection = borrowConnection();
     try {
       evaluateBatch(connection, disableNOTNULLColumnsSql(db, ad), true);
@@ -3388,7 +3188,7 @@
   }
 
   public void enableNOTNULLColumns(Database database, OBDataset dataset) {
-
+    _log.info("Recreating not null constraints...");
     Connection connection = borrowConnection();
 
     try {
@@ -3532,6 +3332,7 @@
 
   @Override
   public void executeOnCreateDefaultForMandatoryColumns(Database database, OBDataset ad) {
+    _log.info("Executing oncreatedefault statements for mandatory columns...");
     Connection connection = borrowConnection();
 
     try {
--- a/src/org/apache/ddlutils/platform/SQLBatchEvaluator.java	Thu Oct 19 10:11:00 2017 +0200
+++ b/src/org/apache/ddlutils/platform/SQLBatchEvaluator.java	Thu Oct 19 10:12:04 2017 +0200
@@ -1,6 +1,6 @@
 /*
  ************************************************************************************
- * Copyright (C) 2015-2016 Openbravo S.L.U.
+ * Copyright (C) 2015-2017 Openbravo S.L.U.
  * Licensed under the Apache Software License version 2.0
  * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
  * Unless required by applicable law or agreed to  in writing,  software  distributed
@@ -38,4 +38,7 @@
 
   /** Should successful commands be logged */
   public boolean isLogInfoSucessCommands();
+
+  /** Evaluators can be used to execute statements in DB or to generate log files */
+  public boolean isDBEvaluator();
 }
--- a/src/org/apache/ddlutils/platform/StandardBatchEvaluator.java	Thu Oct 19 10:11:00 2017 +0200
+++ b/src/org/apache/ddlutils/platform/StandardBatchEvaluator.java	Thu Oct 19 10:12:04 2017 +0200
@@ -350,4 +350,9 @@
   public boolean isLogInfoSucessCommands() {
     return logInfoSucessCommands;
   }
+
+  @Override
+  public boolean isDBEvaluator() {
+    return true;
+  }
 }
--- a/src/org/apache/ddlutils/platform/axion/AxionBuilder.java	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-package org.apache.ddlutils.platform.axion;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.IOException;
-
-import org.apache.ddlutils.Platform;
-import org.apache.ddlutils.model.Column;
-import org.apache.ddlutils.model.Index;
-import org.apache.ddlutils.model.Table;
-import org.apache.ddlutils.platform.SqlBuilder;
-
-/**
- * The SQL Builder for the Axion database.
- * 
- * @version $Revision: 463757 $
- */
-public class AxionBuilder extends SqlBuilder {
-  /**
-   * Creates a new axion sql builder.
-   * 
-   * @param platform
-   *          The plaftform this builder belongs to
-   */
-  public AxionBuilder(Platform platform) {
-    super(platform);
-    addEscapedCharSequence("'", "''");
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected void writeColumnAutoIncrementStmt(Table table, Column column) throws IOException {
-    print("GENERATED BY DEFAULT AS IDENTITY");
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public void dropTable(Table table) throws IOException {
-    print("DROP TABLE IF EXISTS ");
-    printIdentifier(getStructureObjectName(table));
-    printEndOfStatement();
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public void writeExternalIndexDropStmt(Table table, Index index) throws IOException {
-    print("DROP INDEX ");
-    printIdentifier(getConstraintObjectName(index));
-    printEndOfStatement();
-  }
-}
--- a/src/org/apache/ddlutils/platform/axion/AxionModelReader.java	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-package org.apache.ddlutils.platform.axion;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.apache.ddlutils.Platform;
-import org.apache.ddlutils.model.Index;
-import org.apache.ddlutils.model.Table;
-import org.apache.ddlutils.platform.DatabaseMetaDataWrapper;
-import org.apache.ddlutils.platform.JdbcModelReader;
-
-/**
- * Reads a database model from an Axion database.
- * 
- * @version $Revision: $
- */
-public class AxionModelReader extends JdbcModelReader {
-  /**
-   * Creates a new model reader for Axion databases.
-   * 
-   * @param platform
-   *          The platform that this model reader belongs to
-   */
-  public AxionModelReader(Platform platform) {
-    super(platform);
-    setDefaultCatalogPattern(null);
-    setDefaultSchemaPattern(null);
-    setDefaultTablePattern("%");
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected Collection readPrimaryKeyNames(DatabaseMetaDataWrapper metaData, String tableName)
-      throws SQLException {
-    // Axion still does not support DatabaseMetaData#getPrimaryKeys
-    return new ArrayList();
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected Collection readForeignKeys(DatabaseMetaDataWrapper metaData, String tableName)
-      throws SQLException {
-    // Axion still does not support DatabaseMetaData#getImportedKeys or
-    // #getExportedKeys
-    return new ArrayList();
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected void removeSystemIndices(DatabaseMetaDataWrapper metaData, Table table)
-      throws SQLException {
-    // Axion's JDBC driver does not support primary key reading, so we have
-    // to filter at this level
-    for (int indexIdx = 0; indexIdx < table.getIndexCount();) {
-      Index index = table.getIndex(indexIdx);
-
-      // also, Axion's internal indices are not unique
-      if (index.getName().startsWith("SYS_")) {
-        table.removeIndex(indexIdx);
-      } else {
-        indexIdx++;
-      }
-    }
-  }
-}
--- a/src/org/apache/ddlutils/platform/axion/AxionPlatform.java	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,131 +0,0 @@
-package org.apache.ddlutils.platform.axion;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Types;
-import java.util.Map;
-
-import org.apache.ddlutils.DatabaseOperationException;
-import org.apache.ddlutils.PlatformInfo;
-import org.apache.ddlutils.platform.PlatformImplBase;
-
-/**
- * The platform for the Axion database.
- * 
- * @version $Revision: 231306 $
- */
-public class AxionPlatform extends PlatformImplBase {
-  /** Database name of this platform. */
-  public static final String DATABASENAME = "Axion";
-  /** The axion jdbc driver. */
-  public static final String JDBC_DRIVER = "org.axiondb.jdbc.AxionDriver";
-  /** The subprotocol used by the axion driver. */
-  public static final String JDBC_SUBPROTOCOL = "axiondb";
-
-  /**
-   * Creates a new axion platform instance.
-   */
-  public AxionPlatform() {
-    PlatformInfo info = getPlatformInfo();
-
-    info.setDelimitedIdentifiersSupported(false);
-    info.setSqlCommentsSupported(false);
-    info.setLastIdentityValueReadable(false);
-    info.addNativeTypeMapping(Types.ARRAY, "BLOB", Types.BLOB);
-    info.addNativeTypeMapping(Types.BIT, "BOOLEAN");
-    info.addNativeTypeMapping(Types.DISTINCT, "VARBINARY", Types.VARBINARY);
-    info.addNativeTypeMapping(Types.NULL, "VARBINARY", Types.VARBINARY);
-    info.addNativeTypeMapping(Types.OTHER, "BLOB", Types.BLOB);
-    info.addNativeTypeMapping(Types.REAL, "REAL", Types.FLOAT);
-    info.addNativeTypeMapping(Types.REF, "VARBINARY", Types.VARBINARY);
-    info.addNativeTypeMapping(Types.STRUCT, "VARBINARY", Types.VARBINARY);
-    info.addNativeTypeMapping(Types.TINYINT, "SMALLINT", Types.SMALLINT);
-    info.addNativeTypeMapping("DATALINK", "VARBINARY", "VARBINARY");
-
-    setSqlBuilder(new AxionBuilder(this));
-    setModelReader(new AxionModelReader(this));
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getName() {
-    return DATABASENAME;
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public void createDatabase(String jdbcDriverClassName, String connectionUrl, String username,
-      String password, Map parameters) throws DatabaseOperationException,
-      UnsupportedOperationException {
-    // Axion will create the database automatically when connecting for the
-    // first time
-    if (JDBC_DRIVER.equals(jdbcDriverClassName)) {
-      Connection connection = null;
-
-      try {
-        Class.forName(jdbcDriverClassName);
-
-        connection = DriverManager.getConnection(connectionUrl, username, password);
-        logWarnings(connection);
-      } catch (Exception ex) {
-        throw new DatabaseOperationException("Error while trying to create a database", ex);
-      } finally {
-        if (connection != null) {
-          try {
-            connection.close();
-          } catch (SQLException ex) {
-          }
-        }
-      }
-    } else {
-      throw new UnsupportedOperationException("Unable to create a Axion database via the driver "
-          + jdbcDriverClassName);
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected Object extractColumnValue(ResultSet resultSet, String columnName, int columnIdx,
-      int jdbcType) throws SQLException {
-    boolean useIdx = (columnName == null);
-    Object value = null;
-
-    switch (jdbcType) {
-    case Types.BIGINT:
-      // The Axion JDBC driver does not support reading BIGINT values
-      // directly
-      String strValue = useIdx ? resultSet.getString(columnIdx) : resultSet.getString(columnName);
-
-      value = resultSet.wasNull() ? null : new Long(strValue);
-      break;
-    default:
-      value = super.extractColumnValue(resultSet, columnName, columnIdx, jdbcType);
-      break;
-    }
-    return value;
-  }
-}
--- a/src/org/apache/ddlutils/platform/axion/package.html	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-<html>
-<head>
-<!-- 
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-   <meta name="Author" content="Thomas Dudziak">
-</head>
-<body bgcolor="white">
-  <p>
-  	This package contains the platform implementation for the <a href="http://axion.tigris.org/">Axion</a> database.
-  </p>
-</body>
-</html>
--- a/src/org/apache/ddlutils/platform/cloudscape/CloudscapeBuilder.java	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-package org.apache.ddlutils.platform.cloudscape;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.IOException;
-
-import org.apache.ddlutils.Platform;
-import org.apache.ddlutils.model.Column;
-import org.apache.ddlutils.model.Table;
-import org.apache.ddlutils.platform.SqlBuilder;
-
-/**
- * The SQL Builder for Cloudscape.
- * 
- * @version $Revision: 463757 $
- */
-public class CloudscapeBuilder extends SqlBuilder {
-  /**
-   * Creates a new builder instance.
-   * 
-   * @param platform
-   *          The plaftform this builder belongs to
-   */
-  public CloudscapeBuilder(Platform platform) {
-    super(platform);
-    addEscapedCharSequence("'", "''");
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected void writeColumnAutoIncrementStmt(Table table, Column column) throws IOException {
-    print("GENERATED ALWAYS AS IDENTITY");
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getSelectLastIdentityValues(Table table) {
-    return "VALUES IDENTITY_VAL_LOCAL()";
-  }
-}
--- a/src/org/apache/ddlutils/platform/cloudscape/CloudscapePlatform.java	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-package org.apache.ddlutils.platform.cloudscape;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.sql.Types;
-
-import org.apache.ddlutils.PlatformInfo;
-import org.apache.ddlutils.platform.PlatformImplBase;
-
-/**
- * The Cloudscape platform implementation.
- * 
- * @version $Revision: 231306 $
- */
-public class CloudscapePlatform extends PlatformImplBase {
-  /** Database name of this platform. */
-  public static final String DATABASENAME = "Cloudscape";
-  /** A subprotocol used by the DB2 network driver. */
-  public static final String JDBC_SUBPROTOCOL_1 = "db2j:net";
-  /** A subprotocol used by the DB2 network driver. */
-  public static final String JDBC_SUBPROTOCOL_2 = "cloudscape:net";
-
-  /**
-   * Creates a new platform instance.
-   */
-  public CloudscapePlatform() {
-    PlatformInfo info = getPlatformInfo();
-
-    info.setMaxIdentifierLength(128);
-    info.setSystemForeignKeyIndicesAlwaysNonUnique(true);
-    // BINARY and VARBINARY will also be handled by
-    // CloudscapeBuilder.getSqlType
-    info.addNativeTypeMapping(Types.ARRAY, "BLOB", Types.BLOB);
-    info.addNativeTypeMapping(Types.BINARY, "CHAR {0} FOR BIT DATA");
-    info.addNativeTypeMapping(Types.BIT, "SMALLINT", Types.SMALLINT);
-    info.addNativeTypeMapping(Types.DISTINCT, "BLOB", Types.BLOB);
-    info.addNativeTypeMapping(Types.DOUBLE, "DOUBLE PRECISION");
-    info.addNativeTypeMapping(Types.FLOAT, "DOUBLE PRECISION", Types.DOUBLE);
-    info.addNativeTypeMapping(Types.JAVA_OBJECT, "BLOB", Types.BLOB);
-    info.addNativeTypeMapping(Types.LONGVARBINARY, "LONG VARCHAR FOR BIT DATA");
-    info.addNativeTypeMapping(Types.LONGVARCHAR, "LONG VARCHAR");
-    info.addNativeTypeMapping(Types.NULL, "LONG VARCHAR FOR BIT DATA", Types.LONGVARBINARY);
-    info.addNativeTypeMapping(Types.OTHER, "BLOB", Types.BLOB);
-    info.addNativeTypeMapping(Types.REF, "LONG VARCHAR FOR BIT DATA", Types.LONGVARBINARY);
-    info.addNativeTypeMapping(Types.STRUCT, "BLOB", Types.BLOB);
-    info.addNativeTypeMapping(Types.TINYINT, "SMALLINT", Types.SMALLINT);
-    info.addNativeTypeMapping(Types.VARBINARY, "VARCHAR {0} FOR BIT DATA");
-    info.addNativeTypeMapping("BOOLEAN", "SMALLINT", "SMALLINT");
-    info.addNativeTypeMapping("DATALINK", "LONG VARCHAR FOR BIT DATA", "LONGVARBINARY");
-
-    info.setDefaultSize(Types.BINARY, 254);
-    info.setDefaultSize(Types.CHAR, 254);
-    info.setDefaultSize(Types.VARBINARY, 254);
-    info.setDefaultSize(Types.VARCHAR, 254);
-
-    setSqlBuilder(new CloudscapeBuilder(this));
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getName() {
-    return DATABASENAME;
-  }
-}
--- a/src/org/apache/ddlutils/platform/cloudscape/package.html	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-<html>
-<head>
-<!-- 
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-   <meta name="Author" content="Thomas Dudziak">
-</head>
-<body bgcolor="white">
-  <p>
-  	This package contains the platform implementation for the
-    <a href="http://www-128.ibm.com/developerworks/db2/zones/cloudscape/">Cloudscape</a> database.
-  </p>
-</body>
-</html>
--- a/src/org/apache/ddlutils/platform/db2/Db2Builder.java	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,257 +0,0 @@
-package org.apache.ddlutils.platform.db2;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.IOException;
-import java.sql.Types;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.ddlutils.Platform;
-import org.apache.ddlutils.alteration.AddColumnChange;
-import org.apache.ddlutils.alteration.AddPrimaryKeyChange;
-import org.apache.ddlutils.alteration.PrimaryKeyChange;
-import org.apache.ddlutils.alteration.RemoveColumnChange;
-import org.apache.ddlutils.alteration.RemovePrimaryKeyChange;
-import org.apache.ddlutils.alteration.TableChange;
-import org.apache.ddlutils.model.Column;
-import org.apache.ddlutils.model.Database;
-import org.apache.ddlutils.model.Index;
-import org.apache.ddlutils.model.Table;
-import org.apache.ddlutils.model.TypeMap;
-import org.apache.ddlutils.model.ValueObject;
-import org.apache.ddlutils.platform.SqlBuilder;
-import org.apache.ddlutils.util.Jdbc3Utils;
-
-/**
- * The SQL Builder for DB2.
- * 
- * @version $Revision: 504811 $
- */
-public class Db2Builder extends SqlBuilder {
-  /**
-   * Creates a new builder instance.
-   * 
-   * @param platform
-   *          The plaftform this builder belongs to
-   */
-  public Db2Builder(Platform platform) {
-    super(platform);
-    addEscapedCharSequence("'", "''");
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected String getNativeDefaultValue(ValueObject column) {
-    if ((column.getTypeCode() == Types.BIT)
-        || (Jdbc3Utils.supportsJava14JdbcTypes() && (column.getTypeCode() == Jdbc3Utils
-            .determineBooleanTypeCode()))) {
-      return getDefaultValueHelper().convert(column.getDefaultValue(), column.getTypeCode(),
-          Types.SMALLINT).toString();
-    } else {
-      return super.getNativeDefaultValue(column);
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected void writeColumnAutoIncrementStmt(Table table, Column column) throws IOException {
-    print("GENERATED BY DEFAULT AS IDENTITY");
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getSelectLastIdentityValues(Table table) {
-    return "VALUES IDENTITY_VAL_LOCAL()";
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public void writeExternalIndexDropStmt(Table table, Index index) throws IOException {
-    // Index names in DB2 are unique to a schema and hence Derby does not
-    // use the ON <tablename> clause
-    print("DROP INDEX ");
-    printIdentifier(getConstraintObjectName(index));
-    printEndOfStatement();
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected void writeCastExpression(Column sourceColumn, Column targetColumn) throws IOException {
-    String sourceNativeType = getBareNativeType(sourceColumn);
-    String targetNativeType = getBareNativeType(targetColumn);
-
-    if (sourceNativeType.equals(targetNativeType)) {
-      printIdentifier(getColumnName(sourceColumn));
-    } else {
-      String type = getSqlType(targetColumn);
-
-      // DB2 has the limitation that it cannot convert numeric values
-      // to VARCHAR, though it can convert them to CHAR
-      if (TypeMap.isNumericType(sourceColumn.getTypeCode())
-          && "VARCHAR".equalsIgnoreCase(targetNativeType)) {
-        Object sizeSpec = targetColumn.getSize();
-
-        if (sizeSpec == null) {
-          sizeSpec = getPlatformInfo().getDefaultSize(targetColumn.getTypeCode());
-        }
-        type = "CHAR(" + sizeSpec.toString() + ")";
-      }
-
-      print("CAST(");
-      printIdentifier(getColumnName(sourceColumn));
-      print(" AS ");
-      print(type);
-      print(")");
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected void processTableStructureChanges(Database currentModel, Database desiredModel,
-      Table sourceTable, Table targetTable, Map parameters, List changes) throws IOException {
-    // DB2 provides only limited ways to alter a column, so we don't use
-    // them
-    for (Iterator changeIt = changes.iterator(); changeIt.hasNext();) {
-      TableChange change = (TableChange) changeIt.next();
-
-      if (change instanceof AddColumnChange) {
-        AddColumnChange addColumnChange = (AddColumnChange) change;
-
-        // DB2 can only add not insert columns
-        // Also, DB2 does not allow the GENERATED BY DEFAULT AS IDENTITY
-        // clause in
-        // the ALTER TABLE ADD COLUMN statement, so we have to rebuild
-        // the table instead
-        if ((addColumnChange.getNextColumn() == null)
-            && !addColumnChange.getNewColumn().isAutoIncrement()) {
-          processChange(currentModel, desiredModel, addColumnChange);
-          changeIt.remove();
-        }
-      }
-    }
-
-    for (Iterator changeIt = changes.iterator(); changeIt.hasNext();) {
-      TableChange change = (TableChange) changeIt.next();
-
-      if (change instanceof AddPrimaryKeyChange) {
-        processChange(currentModel, desiredModel, (AddPrimaryKeyChange) change);
-        changeIt.remove();
-      } else if (change instanceof PrimaryKeyChange) {
-        processChange(currentModel, desiredModel, (PrimaryKeyChange) change);
-        changeIt.remove();
-      } else if (change instanceof RemovePrimaryKeyChange) {
-        processChange(currentModel, desiredModel, (RemovePrimaryKeyChange) change);
-        changeIt.remove();
-      }
-    }
-  }
-
-  /**
-   * Processes the addition of a column to a table.
-   * 
-   * @param currentModel
-   *          The current database schema
-   * @param desiredModel
-   *          The desired database schema
-   * @param change
-   *          The change object
-   */
-  protected void processChange(Database currentModel, Database desiredModel, AddColumnChange change)
-      throws IOException {
-    print("ALTER TABLE ");
-    printlnIdentifier(getStructureObjectName(change.getChangedTable()));
-    printIndent();
-    print("ADD COLUMN ");
-    writeColumn(change.getChangedTable(), change.getNewColumn());
-    printEndOfStatement();
-    change.apply(currentModel, getPlatform().isDelimitedIdentifierModeOn());
-  }
-
-  /**
-   * Processes the removal of a column from a table.
-   * 
-   * @param currentModel
-   *          The current database schema
-   * @param desiredModel
-   *          The desired database schema
-   * @param change
-   *          The change object
-   */
-  protected void processChange(Database currentModel, Database desiredModel,
-      RemoveColumnChange change) throws IOException {
-    print("ALTER TABLE ");
-    printlnIdentifier(getStructureObjectName(change.getChangedTable()));
-    printIndent();
-    print("DROP COLUMN ");
-    printIdentifier(getColumnName(change.getColumn()));
-    printEndOfStatement();
-    change.apply(currentModel, getPlatform().isDelimitedIdentifierModeOn());
-  }
-
-  /**
-   * Processes the removal of a primary key from a table.
-   * 
-   * @param currentModel
-   *          The current database schema
-   * @param desiredModel
-   *          The desired database schema
-   * @param change
-   *          The change object
-   */
-  protected void processChange(Database currentModel, Database desiredModel,
-      RemovePrimaryKeyChange change) throws IOException {
-    print("ALTER TABLE ");
-    printlnIdentifier(getStructureObjectName(change.getChangedTable()));
-    printIndent();
-    print("DROP PRIMARY KEY");
-    printEndOfStatement();
-    change.apply(currentModel, getPlatform().isDelimitedIdentifierModeOn());
-  }
-
-  /**
-   * Processes the change of the primary key of a table.
-   * 
-   * @param currentModel
-   *          The current database schema
-   * @param desiredModel
-   *          The desired database schema
-   * @param change
-   *          The change object
-   */
-  protected void processChange(Database currentModel, Database desiredModel, PrimaryKeyChange change)
-      throws IOException {
-    print("ALTER TABLE ");
-    printlnIdentifier(getStructureObjectName(change.getChangedTable()));
-    printIndent();
-    print("DROP PRIMARY KEY");
-    printEndOfStatement();
-    writeExternalPrimaryKeysCreateStmt(change.getChangedTable(), change.getNewName(), change
-        .getNewPrimaryKeyColumns());
-    change.apply(currentModel, getPlatform().isDelimitedIdentifierModeOn());
-  }
-}
--- a/src/org/apache/ddlutils/platform/db2/Db2ModelReader.java	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,204 +0,0 @@
-package org.apache.ddlutils.platform.db2;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Types;
-import java.util.HashSet;
-import java.util.Map;
-
-import org.apache.ddlutils.DdlUtilsException;
-import org.apache.ddlutils.Platform;
-import org.apache.ddlutils.model.Column;
-import org.apache.ddlutils.model.Index;
-import org.apache.ddlutils.model.Table;
-import org.apache.ddlutils.model.TypeMap;
-import org.apache.ddlutils.platform.DatabaseMetaDataWrapper;
-import org.apache.ddlutils.platform.JdbcModelReader;
-import org.apache.oro.text.regex.MalformedPatternException;
-import org.apache.oro.text.regex.Pattern;
-import org.apache.oro.text.regex.PatternCompiler;
-import org.apache.oro.text.regex.PatternMatcher;
-import org.apache.oro.text.regex.Perl5Compiler;
-import org.apache.oro.text.regex.Perl5Matcher;
-
-/**
- * Reads a database model from a Db2 UDB database.
- * 
- * @version $Revision: $
- */
-public class Db2ModelReader extends JdbcModelReader {
-  /** Known system tables that Db2 creates (e.g. automatic maintenance). */
-  private static final String[] KNOWN_SYSTEM_TABLES = { "STMG_DBSIZE_INFO", "HMON_ATM_INFO",
-      "HMON_COLLECTION", "POLICY" };
-  /** The regular expression pattern for the time values that Db2 returns. */
-  private Pattern _db2TimePattern;
-  /**
-   * The regular expression pattern for the timestamp values that Db2 returns.
-   */
-  private Pattern _db2TimestampPattern;
-
-  /**
-   * Creates a new model reader for Db2 databases.
-   * 
-   * @param platform
-   *          The platform that this model reader belongs to
-   */
-  public Db2ModelReader(Platform platform) {
-    super(platform);
-    setDefaultCatalogPattern(null);
-    setDefaultSchemaPattern(null);
-
-    PatternCompiler compiler = new Perl5Compiler();
-
-    try {
-      _db2TimePattern = compiler.compile("'(\\d{2}).(\\d{2}).(\\d{2})'");
-      _db2TimestampPattern = compiler
-          .compile("'(\\d{4}\\-\\d{2}\\-\\d{2})\\-(\\d{2}).(\\d{2}).(\\d{2})(\\.\\d{1,8})?'");
-    } catch (MalformedPatternException ex) {
-      throw new DdlUtilsException(ex);
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected Table readTable(DatabaseMetaDataWrapper metaData, Map values) throws SQLException {
-    String tableName = (String) values.get("TABLE_NAME");
-
-    for (int idx = 0; idx < KNOWN_SYSTEM_TABLES.length; idx++) {
-      if (KNOWN_SYSTEM_TABLES[idx].equals(tableName)) {
-        return null;
-      }
-    }
-
-    Table table = super.readTable(metaData, values);
-
-    if (table != null) {
-      // Db2 does not return the auto-increment status via the database
-      // metadata
-      determineAutoIncrementFromResultSetMetaData(table, table.getColumns());
-    }
-    return table;
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected Column readColumn(DatabaseMetaDataWrapper metaData, Map values) throws SQLException {
-    Column column = super.readColumn(metaData, values);
-
-    if (column.getDefaultValue() != null) {
-      if (column.getTypeCode() == Types.TIME) {
-        PatternMatcher matcher = new Perl5Matcher();
-
-        // Db2 returns "HH24.MI.SS"
-        if (matcher.matches(column.getDefaultValue(), _db2TimePattern)) {
-          StringBuffer newDefault = new StringBuffer();
-
-          newDefault.append("'");
-          // the hour
-          newDefault.append(matcher.getMatch().group(1));
-          newDefault.append(":");
-          // the minute
-          newDefault.append(matcher.getMatch().group(2));
-          newDefault.append(":");
-          // the second
-          newDefault.append(matcher.getMatch().group(3));
-          newDefault.append("'");
-
-          column.setDefaultValue(newDefault.toString());
-        }
-      } else if (column.getTypeCode() == Types.TIMESTAMP) {
-        PatternMatcher matcher = new Perl5Matcher();
-
-        // Db2 returns "YYYY-MM-DD-HH24.MI.SS.FF"
-        if (matcher.matches(column.getDefaultValue(), _db2TimestampPattern)) {
-          StringBuffer newDefault = new StringBuffer();
-
-          newDefault.append("'");
-          // group 1 is the date which has the correct format
-          newDefault.append(matcher.getMatch().group(1));
-          newDefault.append(" ");
-          // the hour
-          newDefault.append(matcher.getMatch().group(2));
-          newDefault.append(":");
-          // the minute
-          newDefault.append(matcher.getMatch().group(3));
-          newDefault.append(":");
-          // the second
-          newDefault.append(matcher.getMatch().group(4));
-          // optionally, the fraction
-          if ((matcher.getMatch().groups() > 4) && (matcher.getMatch().group(4) != null)) {
-            newDefault.append(matcher.getMatch().group(5));
-          }
-          newDefault.append("'");
-
-          column.setDefaultValue(newDefault.toString());
-        }
-      } else if (TypeMap.isTextType(column.getTypeCode())) {
-        column.setDefaultValue(unescape(column.getDefaultValue(), "'", "''"));
-      }
-    }
-    return column;
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected boolean isInternalPrimaryKeyIndex(DatabaseMetaDataWrapper metaData, Table table,
-      Index index) throws SQLException {
-    // Db2 uses the form "SQL060205225246220" if the primary key was defined
-    // during table creation
-    // When the ALTER TABLE way was used however, the index has the name of
-    // the primary key
-    if (index.getName().startsWith("SQL")) {
-      try {
-        Long.parseLong(index.getName().substring(3));
-        return true;
-      } catch (NumberFormatException ex) {
-        // we ignore it
-      }
-      return false;
-    } else {
-      // we'll compare the index name to the names of all primary keys
-      // TODO: Once primary key names are supported, this can be done
-      // easier via the table object
-      ResultSet pkData = null;
-      HashSet pkNames = new HashSet();
-
-      try {
-        pkData = metaData.getPrimaryKeys(table.getName());
-        while (pkData.next()) {
-          Map values = readColumns(pkData, getColumnsForPK());
-
-          pkNames.add(values.get("PK_NAME"));
-        }
-      } finally {
-        if (pkData != null) {
-          pkData.close();
-        }
-      }
-
-      return pkNames.contains(index.getName());
-    }
-  }
-}
--- a/src/org/apache/ddlutils/platform/db2/Db2Platform.java	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +0,0 @@
-package org.apache.ddlutils.platform.db2;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.sql.Types;
-
-import org.apache.ddlutils.PlatformInfo;
-import org.apache.ddlutils.platform.PlatformImplBase;
-
-/**
- * The DB2 platform implementation.
- * 
- * @version $Revision: 231306 $
- */
-public class Db2Platform extends PlatformImplBase {
-  /** Database name of this platform. */
-  public static final String DATABASENAME = "DB2";
-  /** The standard DB2 jdbc driver. */
-  public static final String JDBC_DRIVER = "com.ibm.db2.jcc.DB2Driver";
-  /** Older name for the jdbc driver. */
-  public static final String JDBC_DRIVER_OLD1 = "COM.ibm.db2.jdbc.app.DB2Driver";
-  /** Older name for the jdbc driver. */
-  public static final String JDBC_DRIVER_OLD2 = "COM.ibm.db2os390.sqlj.jdbc.DB2SQLJDriver";
-  /** The JTOpen JDBC Driver. */
-  public static final String JDBC_DRIVER_JTOPEN = "com.ibm.as400.access.AS400JDBCDriver";
-  /** The subprotocol used by the standard DB2 driver. */
-  public static final String JDBC_SUBPROTOCOL = "db2";
-  /** An alternative subprotocol used by the standard DB2 driver on OS/390. */
-  public static final String JDBC_SUBPROTOCOL_OS390_1 = "db2os390";
-  /** An alternative subprotocol used by the standard DB2 driver on OS/390. */
-  public static final String JDBC_SUBPROTOCOL_OS390_2 = "db2os390sqlj";
-  /** An alternative subprotocol used by the JTOpen driver on OS/400. */
-  public static final String JDBC_SUBPROTOCOL_JTOPEN = "as400";
-
-  /**
-   * Creates a new platform instance.
-   */
-  public Db2Platform() {
-    PlatformInfo info = getPlatformInfo();
-
-    info.setMaxIdentifierLength(18);
-
-    // the BINARY types are also handled by Db2Builder.getSqlType(Column)
-    info.addNativeTypeMapping(Types.ARRAY, "BLOB", Types.BLOB);
-    info.addNativeTypeMapping(Types.BINARY, "CHAR {0} FOR BIT DATA");
-    info.addNativeTypeMapping(Types.BIT, "SMALLINT", Types.SMALLINT);
-    info.addNativeTypeMapping(Types.FLOAT, "DOUBLE", Types.DOUBLE);
-    info.addNativeTypeMapping(Types.JAVA_OBJECT, "BLOB", Types.BLOB);
-    info.addNativeTypeMapping(Types.LONGVARBINARY, "LONG VARCHAR FOR BIT DATA");
-    info.addNativeTypeMapping(Types.LONGVARCHAR, "LONG VARCHAR");
-    info.addNativeTypeMapping(Types.NULL, "LONG VARCHAR FOR BIT DATA", Types.LONGVARBINARY);
-    info.addNativeTypeMapping(Types.NUMERIC, "DECIMAL", Types.DECIMAL);
-    info.addNativeTypeMapping(Types.OTHER, "BLOB", Types.BLOB);
-    info.addNativeTypeMapping(Types.STRUCT, "BLOB", Types.BLOB);
-    info.addNativeTypeMapping(Types.TINYINT, "SMALLINT", Types.SMALLINT);
-    info.addNativeTypeMapping(Types.VARBINARY, "VARCHAR {0} FOR BIT DATA");
-    info.addNativeTypeMapping("BOOLEAN", "SMALLINT", "SMALLINT");
-
-    info.setDefaultSize(Types.CHAR, 254);
-    info.setDefaultSize(Types.VARCHAR, 254);
-    info.setDefaultSize(Types.BINARY, 254);
-    info.setDefaultSize(Types.VARBINARY, 254);
-
-    setSqlBuilder(new Db2Builder(this));
-    setModelReader(new Db2ModelReader(this));
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getName() {
-    return DATABASENAME;
-  }
-}
--- a/src/org/apache/ddlutils/platform/db2/Db2v8Builder.java	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-package org.apache.ddlutils.platform.db2;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.ddlutils.Platform;
-
-/**
- * The SQL Builder for DB2 v8 and above.
- * 
- * @version $Revision: $
- */
-public class Db2v8Builder extends Db2Builder {
-  /**
-   * Creates a new builder instance.
-   * 
-   * @param platform
-   *          The plaftform this builder belongs to
-   */
-  public Db2v8Builder(Platform platform) {
-    super(platform);
-  }
-}
--- a/src/org/apache/ddlutils/platform/db2/Db2v8Platform.java	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-package org.apache.ddlutils.platform.db2;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * The DB2 platform implementation for DB2 v8 and above.
- * 
- * @version $Revision: $
- */
-public class Db2v8Platform extends Db2Platform {
-  /** Database name of this platform. */
-  public static final String DATABASENAME = "DB2v8";
-
-  /**
-   * Creates a new platform instance.
-   */
-  public Db2v8Platform() {
-    super();
-    // DB2 v8 has a maximum identifier length of 128 bytes for things like
-    // table names,
-    // stored procedure names etc., 30 bytes for column names and 18 bytes
-    // for foreign key names
-    // Note that we optimistically assume that number of characters = number
-    // of bytes
-    // If the name contains characters that are more than one byte in the
-    // database's
-    // encoding, then the db will report an error anyway, but we cannot
-    // really calculate
-    // the number of bytes
-    getPlatformInfo().setMaxIdentifierLength(128);
-    getPlatformInfo().setMaxColumnNameLength(30);
-    getPlatformInfo().setMaxConstraintNameLength(18);
-    getPlatformInfo().setMaxForeignKeyNameLength(18);
-    setSqlBuilder(new Db2v8Builder(this));
-  }
-}
--- a/src/org/apache/ddlutils/platform/db2/package.html	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-<html>
-<head>
-<!-- 
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-   <meta name="Author" content="Thomas Dudziak">
-</head>
-<body bgcolor="white">
-  <p>
-  	This package contains the platform implementation for the
-    <a href="http://www-128.ibm.com/developerworks/db2/products/udb/">DB2 UDB</a> database.
-  </p>
-</body>
-</html>
--- a/src/org/apache/ddlutils/platform/derby/DerbyBuilder.java	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,158 +0,0 @@
-package org.apache.ddlutils.platform.derby;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.IOException;
-import java.sql.Types;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.ddlutils.Platform;
-import org.apache.ddlutils.alteration.AddColumnChange;
-import org.apache.ddlutils.alteration.TableChange;
-import org.apache.ddlutils.model.Column;
-import org.apache.ddlutils.model.Database;
-import org.apache.ddlutils.model.Index;
-import org.apache.ddlutils.model.Table;
-import org.apache.ddlutils.model.TypeMap;
-import org.apache.ddlutils.model.ValueObject;
-import org.apache.ddlutils.platform.cloudscape.CloudscapeBuilder;
-import org.apache.ddlutils.util.Jdbc3Utils;
-
-/**
- * The SQL Builder for Derby.
- * 
- * @version $Revision: 279413 $
- */
-public class DerbyBuilder extends CloudscapeBuilder {
-  /**
-   * Creates a new builder instance.
-   * 
-   * @param platform
-   *          The plaftform this builder belongs to
-   */
-  public DerbyBuilder(Platform platform) {
-    super(platform);
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected String getNativeDefaultValue(ValueObject column) {
-    if ((column.getTypeCode() == Types.BIT)
-        || (Jdbc3Utils.supportsJava14JdbcTypes() && (column.getTypeCode() == Jdbc3Utils
-            .determineBooleanTypeCode()))) {
-      return getDefaultValueHelper().convert(column.getDefaultValue(), column.getTypeCode(),
-          Types.SMALLINT).toString();
-    } else {
-      return super.getNativeDefaultValue(column);
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected void writeColumnAutoIncrementStmt(Table table, Column column) throws IOException {
-    print("GENERATED BY DEFAULT AS IDENTITY");
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public void writeExternalIndexDropStmt(Table table, Index index) throws IOException {
-    // Index names in Derby are unique to a schema and hence Derby does not
-    // use the ON <tablename> clause
-    print("DROP INDEX ");
-    printIdentifier(getConstraintObjectName(index));
-    printEndOfStatement();
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected void writeCastExpression(Column sourceColumn, Column targetColumn) throws IOException {
-    String sourceNativeType = getBareNativeType(sourceColumn);
-    String targetNativeType = getBareNativeType(targetColumn);
-
-    if (sourceNativeType.equals(targetNativeType)) {
-      printIdentifier(getColumnName(sourceColumn));
-    } else {
-      // Derby currently has the limitation that it cannot convert numeric
-      // values
-      // to VARCHAR, though it can convert them to CHAR
-      if (TypeMap.isNumericType(sourceColumn.getTypeCode())
-          && "VARCHAR".equalsIgnoreCase(targetNativeType)) {
-        targetNativeType = "CHAR";
-      }
-
-      print(targetNativeType);
-      print("(");
-      printIdentifier(getColumnName(sourceColumn));
-      print(")");
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected void processTableStructureChanges(Database currentModel, Database desiredModel,
-      Table sourceTable, Table targetTable, Map parameters, List changes) throws IOException {
-    // Derby provides a way to alter the size of a column but it is limited
-    // (no pk or fk columns, only for VARCHAR columns), so we don't use it
-    for (Iterator changeIt = changes.iterator(); changeIt.hasNext();) {
-      TableChange change = (TableChange) changeIt.next();
-
-      if (change instanceof AddColumnChange) {
-        AddColumnChange addColumnChange = (AddColumnChange) change;
-
-        // Derby can only add not insert columns, and the columns
-        // cannot be identity columns
-        if (addColumnChange.isAtEnd() && !addColumnChange.getNewColumn().isAutoIncrement()) {
-          processChange(currentModel, desiredModel, addColumnChange);
-          changeIt.remove();
-        }
-      }
-    }
-    super.processTableStructureChanges(currentModel, desiredModel, sourceTable, targetTable,
-        parameters, changes);
-  }
-
-  /**
-   * Processes the addition of a column to a table.
-   * 
-   * @param currentModel
-   *          The current database schema
-   * @param desiredModel
-   *          The desired database schema
-   * @param change
-   *          The change object
-   */
-  protected void processChange(Database currentModel, Database desiredModel, AddColumnChange change)
-      throws IOException {
-    print("ALTER TABLE ");
-    printlnIdentifier(getStructureObjectName(change.getChangedTable()));
-    printIndent();
-    print("ADD COLUMN ");
-    writeColumn(change.getChangedTable(), change.getNewColumn());
-    printEndOfStatement();
-    change.apply(currentModel, getPlatform().isDelimitedIdentifierModeOn());
-  }
-}
--- a/src/org/apache/ddlutils/platform/derby/DerbyModelReader.java	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +0,0 @@
-package org.apache.ddlutils.platform.derby;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.sql.SQLException;
-import java.util.Map;
-
-import org.apache.ddlutils.Platform;
-import org.apache.ddlutils.model.Column;
-import org.apache.ddlutils.model.ForeignKey;
-import org.apache.ddlutils.model.Index;
-import org.apache.ddlutils.model.Table;
-import org.apache.ddlutils.model.TypeMap;
-import org.apache.ddlutils.platform.DatabaseMetaDataWrapper;
-import org.apache.ddlutils.platform.JdbcModelReader;
-
-/**
- * Reads a database model from a Derby database.
- * 
- * @version $Revision: $
- */
-public class DerbyModelReader extends JdbcModelReader {
-  /**
-   * Creates a new model reader for Derby databases.
-   * 
-   * @param platform
-   *          The platform that this model reader belongs to
-   */
-  public DerbyModelReader(Platform platform) {
-    super(platform);
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected Column readColumn(DatabaseMetaDataWrapper metaData, Map values) throws SQLException {
-    Column column = super.readColumn(metaData, values);
-    String defaultValue = column.getDefaultValue();
-
-    if (defaultValue != null) {
-      // we check for these strings
-      // GENERATED_BY_DEFAULT -> 'GENERATED BY DEFAULT AS IDENTITY'
-      // AUTOINCREMENT: start 1 increment 1 -> 'GENERATED ALWAYS AS
-      // IDENTITY'
-      if ("GENERATED_BY_DEFAULT".equals(defaultValue) || defaultValue.startsWith("AUTOINCREMENT:")) {
-        column.setDefaultValue(null);
-        column.setAutoIncrement(true);
-      } else if (TypeMap.isTextType(column.getTypeCode())) {
-        column.setDefaultValue(unescape(defaultValue, "'", "''"));
-      }
-    }
-    return column;
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected boolean isInternalForeignKeyIndex(DatabaseMetaDataWrapper metaData, Table table,
-      ForeignKey fk, Index index) {
-    return isInternalIndex(index);
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected boolean isInternalPrimaryKeyIndex(DatabaseMetaDataWrapper metaData, Table table,
-      Index index) {
-    return isInternalIndex(index);
-  }
-
-  /**
-   * Determines whether the index is an internal index, i.e. one created by Derby.
-   * 
-   * @param index
-   *          The index to check
-   * @return <code>true</code> if the index seems to be an internal one
-   */
-  private boolean isInternalIndex(Index index) {
-    String name = index.getName();
-
-    // Internal names normally have the form "SQL051228005030780"
-    if ((name != null) && name.startsWith("SQL")) {
-      try {
-        Long.parseLong(name.substring(3));
-        return true;
-      } catch (NumberFormatException ex) {
-        // we ignore it
-      }
-    }
-    return false;
-  }
-}
--- a/src/org/apache/ddlutils/platform/derby/DerbyPlatform.java	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,118 +0,0 @@
-package org.apache.ddlutils.platform.derby;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.SQLException;
-import java.sql.Types;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.apache.ddlutils.DatabaseOperationException;
-import org.apache.ddlutils.platform.cloudscape.CloudscapePlatform;
-
-/**
- * The platform implementation for Derby.
- * 
- * @version $Revision: 231306 $
- */
-public class DerbyPlatform extends CloudscapePlatform {
-  /** Database name of this platform. */
-  public static final String DATABASENAME = "Derby";
-  /** The derby jdbc driver for use as a client for a normal server. */
-  public static final String JDBC_DRIVER = "org.apache.derby.jdbc.ClientDriver";
-  /** The derby jdbc driver for use as an embedded database. */
-  public static final String JDBC_DRIVER_EMBEDDED = "org.apache.derby.jdbc.EmbeddedDriver";
-  /** The subprotocol used by the derby drivers. */
-  public static final String JDBC_SUBPROTOCOL = "derby";
-
-  /**
-   * Creates a new Derby platform instance.
-   */
-  public DerbyPlatform() {
-    super();
-    getPlatformInfo().addNativeTypeMapping(Types.DOUBLE, "DOUBLE");
-    getPlatformInfo().addNativeTypeMapping(Types.FLOAT, "DOUBLE", Types.DOUBLE);
-    setSqlBuilder(new DerbyBuilder(this));
-    setModelReader(new DerbyModelReader(this));
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getName() {
-    return DATABASENAME;
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public void createDatabase(String jdbcDriverClassName, String connectionUrl, String username,
-      String password, Map parameters) throws DatabaseOperationException,
-      UnsupportedOperationException {
-    // For Derby, you create databases by simply appending ";create=true" to
-    // the connection url
-    if (JDBC_DRIVER.equals(jdbcDriverClassName) || JDBC_DRIVER_EMBEDDED.equals(jdbcDriverClassName)) {
-      StringBuffer creationUrl = new StringBuffer();
-      Connection connection = null;
-
-      creationUrl.append(connectionUrl);
-      creationUrl.append(";create=true");
-      if ((parameters != null) && !parameters.isEmpty()) {
-        for (Iterator it = parameters.entrySet().iterator(); it.hasNext();) {
-          Map.Entry entry = (Map.Entry) it.next();
-
-          // no need to specify create twice (and create=false
-          // wouldn't help anyway)
-          if (!"create".equalsIgnoreCase(entry.getKey().toString())) {
-            creationUrl.append(";");
-            creationUrl.append(entry.getKey().toString());
-            creationUrl.append("=");
-            if (entry.getValue() != null) {
-              creationUrl.append(entry.getValue().toString());
-            }
-          }
-        }
-      }
-      if (getLog().isDebugEnabled()) {
-        getLog().debug("About to create database using this URL: " + creationUrl.toString());
-      }
-      try {
-        Class.forName(jdbcDriverClassName);
-
-        connection = DriverManager.getConnection(creationUrl.toString(), username, password);
-        logWarnings(connection);
-      } catch (Exception ex) {
-        throw new DatabaseOperationException("Error while trying to create a database", ex);
-      } finally {
-        if (connection != null) {
-          try {
-            connection.close();
-          } catch (SQLException ex) {
-          }
-        }
-      }
-    } else {
-      throw new UnsupportedOperationException("Unable to create a Derby database via the driver "
-          + jdbcDriverClassName);
-    }
-  }
-}
--- a/src/org/apache/ddlutils/platform/derby/package.html	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-<html>
-<head>
-<!-- 
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-   <meta name="Author" content="Thomas Dudziak">
-</head>
-<body bgcolor="white">
-  <p>
-  	This package contains the platform implementation for the
-    <a href="http://db.apache.org/derby/">Apache Derby</a> database.
-  </p>
-</body>
-</html>
--- a/src/org/apache/ddlutils/platform/firebird/FirebirdBuilder.java	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,337 +0,0 @@
-package org.apache.ddlutils.platform.firebird;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.IOException;
-import java.sql.Types;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.ddlutils.Platform;
-import org.apache.ddlutils.alteration.AddColumnChange;
-import org.apache.ddlutils.alteration.AddPrimaryKeyChange;
-import org.apache.ddlutils.alteration.RemoveColumnChange;
-import org.apache.ddlutils.alteration.TableChange;
-import org.apache.ddlutils.model.Column;
-import org.apache.ddlutils.model.Database;
-import org.apache.ddlutils.model.Index;
-import org.apache.ddlutils.model.Table;
-import org.apache.ddlutils.model.ValueObject;
-import org.apache.ddlutils.platform.SqlBuilder;
-import org.apache.ddlutils.util.Jdbc3Utils;
-
-/**
- * The SQL Builder for the FireBird database.
- * 
- * @version $Revision: 231306 $
- */
-public class FirebirdBuilder extends SqlBuilder {
-  /**
-   * Creates a new builder instance.
-   * 
-   * @param platform
-   *          The plaftform this builder belongs to
-   */
-  public FirebirdBuilder(Platform platform) {
-    super(platform);
-    addEscapedCharSequence("'", "''");
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public void createTable(Database database, Table table, Map parameters) throws IOException {
-    super.createTable(database, table, parameters);
-
-    // creating generator and trigger for auto-increment
-    Column[] columns = table.getAutoIncrementColumns();
-
-    for (int idx = 0; idx < columns.length; idx++) {
-      writeAutoIncrementCreateStmts(database, table, columns[idx]);
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public void dropTable(Table table) throws IOException {
-    // dropping generators for auto-increment
-    Column[] columns = table.getAutoIncrementColumns();
-
-    for (int idx = 0; idx < columns.length; idx++) {
-      writeAutoIncrementDropStmts(table, columns[idx]);
-    }
-    super.dropTable(table);
-  }
-
-  /**
-   * Writes the creation statements to make the given column an auto-increment column.
-   * 
-   * @param database
-   *          The database model
-   * @param table
-   *          The table
-   * @param column
-   *          The column to make auto-increment
-   */
-  private void writeAutoIncrementCreateStmts(Database database, Table table, Column column)
-      throws IOException {
-    print("CREATE GENERATOR ");
-    printIdentifier(getGeneratorName(table, column));
-    printEndOfStatement();
-
-    print("CREATE TRIGGER ");
-    printIdentifier(getConstraintName("trg", table, column.getName(), null));
-    print(" FOR ");
-    printlnIdentifier(getStructureObjectName(table));
-    println("ACTIVE BEFORE INSERT POSITION 0 AS");
-    print("BEGIN IF (NEW.");
-    printIdentifier(getColumnName(column));
-    print(" IS NULL) THEN NEW.");
-    printIdentifier(getColumnName(column));
-    print(" = GEN_ID(");
-    printIdentifier(getGeneratorName(table, column));
-    print(", 1); END");
-    printEndOfStatement();
-  }
-
-  /**
-   * Writes the statements to drop the auto-increment status for the given column.
-   * 
-   * @param table
-   *          The table
-   * @param column
-   *          The column to remove the auto-increment status for
-   */
-  private void writeAutoIncrementDropStmts(Table table, Column column) throws IOException {
-    print("DROP TRIGGER ");
-    printIdentifier(getConstraintName("trg", table, column.getName(), null));
-    printEndOfStatement();
-
-    print("DROP GENERATOR ");
-    printIdentifier(getGeneratorName(table, column));
-    printEndOfStatement();
-  }
-
-  /**
-   * Determines the name of the generator for an auto-increment column.
-   * 
-   * @param table
-   *          The table
-   * @param column
-   *          The auto-increment column
-   * @return The generator name
-   */
-  protected String getGeneratorName(Table table, Column column) {
-    return getConstraintName("gen", table, column.getName(), null);
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected void writeColumnAutoIncrementStmt(Table table, Column column) throws IOException {
-    // we're using a generator
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getSelectLastIdentityValues(Table table) {
-    Column[] columns = table.getAutoIncrementColumns();
-
-    if (columns.length == 0) {
-      return null;
-    } else {
-      StringBuffer result = new StringBuffer();
-
-      result.append("SELECT ");
-      for (int idx = 0; idx < columns.length; idx++) {
-        result.append("GEN_ID(");
-        result.append(getDelimitedIdentifier(getGeneratorName(table, columns[idx])));
-        result.append(", 0)");
-      }
-      result.append(" FROM RDB$DATABASE");
-      return result.toString();
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected String getNativeDefaultValue(ValueObject column) {
-    if ((column.getTypeCode() == Types.BIT)
-        || (Jdbc3Utils.supportsJava14JdbcTypes() && (column.getTypeCode() == Jdbc3Utils
-            .determineBooleanTypeCode()))) {
-      return getDefaultValueHelper().convert(column.getDefaultValue(), column.getTypeCode(),
-          Types.SMALLINT).toString();
-    } else {
-      return super.getNativeDefaultValue(column);
-    }
-  }
-
-  /**
-   * 
-   * {@inheritDoc}
-   */
-  public void createExternalForeignKeys(Database database) throws IOException {
-    for (int idx = 0; idx < database.getTableCount(); idx++) {
-      createExternalForeignKeys(database, database.getTable(idx));
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public void writeExternalIndexDropStmt(Table table, Index index) throws IOException {
-    // Index names in Firebird are unique to a schema and hence Firebird
-    // does not
-    // use the ON <tablename> clause
-    print("DROP INDEX ");
-    printIdentifier(getConstraintObjectName(index));
-    printEndOfStatement();
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected void processTableStructureChanges(Database currentModel, Database desiredModel,
-      Table sourceTable, Table targetTable, Map parameters, List changes) throws IOException {
-    // TODO: Dropping of primary keys is currently not supported because we
-    // cannot
-    // determine the pk constraint names and drop them in one go
-    // (We could used a stored procedure if Firebird would allow them to use
-    // DDL)
-    // This will be easier once named primary keys are supported
-    boolean pkColumnAdded = false;
-
-    for (Iterator changeIt = changes.iterator(); changeIt.hasNext();) {
-      TableChange change = (TableChange) changeIt.next();
-
-      if (change instanceof AddColumnChange) {
-        AddColumnChange addColumnChange = (AddColumnChange) change;
-
-        // TODO: we cannot add columns to the primary key this way
-        // because we would have to drop the pk first and then
-        // add a new one afterwards which is not supported yet
-        if (addColumnChange.getNewColumn().isPrimaryKey()) {
-          pkColumnAdded = true;
-        } else {
-          processChange(currentModel, desiredModel, addColumnChange);
-          changeIt.remove();
-        }
-      } else if (change instanceof RemoveColumnChange) {
-        RemoveColumnChange removeColumnChange = (RemoveColumnChange) change;
-
-        // TODO: we cannot drop primary key columns this way
-        // because we would have to drop the pk first and then
-        // add a new one afterwards which is not supported yet
-        if (!removeColumnChange.getColumn().isPrimaryKey()) {
-          processChange(currentModel, desiredModel, removeColumnChange);
-          changeIt.remove();
-        }
-      }
-    }
-    for (Iterator changeIt = changes.iterator(); changeIt.hasNext();) {
-      TableChange change = (TableChange) changeIt.next();
-
-      // we can only add a primary key if all columns are present in the
-      // table
-      // i.e. none was added during this alteration
-      if ((change instanceof AddPrimaryKeyChange) && !pkColumnAdded) {
-        processChange(currentModel, desiredModel, (AddPrimaryKeyChange) change);
-        changeIt.remove();
-      }
-    }
-  }
-
-  /**
-   * Processes the addition of a column to a table.
-   * 
-   * @param currentModel
-   *          The current database schema
-   * @param desiredModel
-   *          The desired database schema
-   * @param change
-   *          The change object
-   */
-  protected void processChange(Database currentModel, Database desiredModel, AddColumnChange change)
-      throws IOException {
-    print("ALTER TABLE ");
-    printlnIdentifier(getStructureObjectName(change.getChangedTable()));
-    printIndent();
-    print("ADD ");
-    writeColumn(change.getChangedTable(), change.getNewColumn());
-    printEndOfStatement();
-
-    Table curTable = currentModel.findTable(change.getChangedTable().getName(), getPlatform()
-        .isDelimitedIdentifierModeOn());
-
-    if (!change.isAtEnd()) {
-      Column prevColumn = change.getPreviousColumn();
-
-      if (prevColumn != null) {
-        // we need the corresponding column object from the current
-        // table
-        prevColumn = curTable.findColumn(prevColumn.getName(), getPlatform()
-            .isDelimitedIdentifierModeOn());
-      }
-      // Even though Firebird can only add columns, we can move them later
-      // on
-      print("ALTER TABLE ");
-      printlnIdentifier(getStructureObjectName(change.getChangedTable()));
-      printIndent();
-      print("ALTER ");
-      printIdentifier(getColumnName(change.getNewColumn()));
-      print(" POSITION ");
-      // column positions start at 1 in Firebird
-      print(prevColumn == null ? "1" : String.valueOf(curTable.getColumnIndex(prevColumn) + 2));
-      printEndOfStatement();
-    }
-    if (change.getNewColumn().isAutoIncrement()) {
-      writeAutoIncrementCreateStmts(currentModel, curTable, change.getNewColumn());
-    }
-    change.apply(currentModel, getPlatform().isDelimitedIdentifierModeOn());
-  }
-
-  /**
-   * Processes the removal of a column from a table.
-   * 
-   * @param currentModel
-   *          The current database schema
-   * @param desiredModel
-   *          The desired database schema
-   * @param change
-   *          The change object
-   */
-  protected void processChange(Database currentModel, Database desiredModel,
-      RemoveColumnChange change) throws IOException {
-    if (change.getColumn().isAutoIncrement()) {
-      writeAutoIncrementDropStmts(change.getChangedTable(), change.getColumn());
-    }
-    print("ALTER TABLE ");
-    printlnIdentifier(getStructureObjectName(change.getChangedTable()));
-    printIndent();
-    print("DROP ");
-    printIdentifier(getColumnName(change.getColumn()));
-    printEndOfStatement();
-    change.apply(currentModel, getPlatform().isDelimitedIdentifierModeOn());
-  }
-}
--- a/src/org/apache/ddlutils/platform/firebird/FirebirdModelReader.java	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,429 +0,0 @@
-package org.apache.ddlutils.platform.firebird;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.sql.Types;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.collections.map.ListOrderedMap;
-import org.apache.ddlutils.Platform;
-import org.apache.ddlutils.model.Column;
-import org.apache.ddlutils.model.ForeignKey;
-import org.apache.ddlutils.model.Index;
-import org.apache.ddlutils.model.Table;
-import org.apache.ddlutils.model.TypeMap;
-import org.apache.ddlutils.platform.DatabaseMetaDataWrapper;
-import org.apache.ddlutils.platform.JdbcModelReader;
-
-/**
- * The Jdbc Model Reader for Firebird.
- * 
- * @version $Revision: $
- */
-public class FirebirdModelReader extends JdbcModelReader {
-  /**
-   * Creates a new model reader for Firebird databases.
-   * 
-   * @param platform
-   *          The platform that this model reader belongs to
-   */
-  public FirebirdModelReader(Platform platform) {
-    super(platform);
-    setDefaultCatalogPattern(null);
-    setDefaultSchemaPattern(null);
-    setDefaultTablePattern("%");
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected Table readTable(DatabaseMetaDataWrapper metaData, Map values) throws SQLException {
-    Table table = super.readTable(metaData, values);
-
-    if (table != null) {
-      determineAutoIncrementColumns(table);
-    }
-
-    return table;
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected Collection readColumns(DatabaseMetaDataWrapper metaData, String tableName)
-      throws SQLException {
-    ResultSet columnData = null;
-
-    try {
-      List columns = new ArrayList();
-
-      if (getPlatform().isDelimitedIdentifierModeOn()) {
-        // Jaybird has a problem when delimited identifiers are used as
-        // it is not able to find the columns for the table
-        // So we have to filter manually below
-        columnData = metaData.getColumns(getDefaultTablePattern(), getDefaultColumnPattern());
-
-        while (columnData.next()) {
-          Map values = readColumns(columnData, getColumnsForColumn());
-
-          if (tableName.equals(values.get("TABLE_NAME"))) {
-            columns.add(readColumn(metaData, values));
-          }
-        }
-      } else {
-        columnData = metaData.getColumns(tableName, getDefaultColumnPattern());
-
-        while (columnData.next()) {
-          Map values = readColumns(columnData, getColumnsForColumn());
-
-          columns.add(readColumn(metaData, values));
-        }
-      }
-
-      return columns;
-    } finally {
-      if (columnData != null) {
-        columnData.close();
-      }
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected Column readColumn(DatabaseMetaDataWrapper metaData, Map values) throws SQLException {
-    Column column = super.readColumn(metaData, values);
-
-    if (column.getTypeCode() == Types.FLOAT) {
-      column.setTypeCode(Types.REAL);
-    } else if (TypeMap.isTextType(column.getTypeCode())) {
-      column.setDefaultValue(unescape(column.getDefaultValue(), "'", "''"));
-    }
-    return column;
-  }
-
-  /**
-   * Helper method that determines the auto increment status using Firebird's system tables.
-   * 
-   * @param table
-   *          The table
-   */
-  protected void determineAutoIncrementColumns(Table table) throws SQLException {
-    // Since for long table and column names, the generator name will be
-    // shortened
-    // we have to determine for each column whether there is a generator for
-    // it
-    FirebirdBuilder builder = (FirebirdBuilder) getPlatform().getSqlBuilder();
-    Column[] columns = table.getColumns();
-    HashMap names = new HashMap();
-    String name;
-
-    for (int idx = 0; idx < columns.length; idx++) {
-      name = builder.getGeneratorName(table, columns[idx]);
-      if (!getPlatform().isDelimitedIdentifierModeOn()) {
-        name = name.toUpperCase();
-      }
-      names.put(name, columns[idx]);
-    }
-
-    Statement stmt = getConnection().createStatement();
-
-    try {
-      ResultSet rs = stmt.executeQuery("SELECT RDB$GENERATOR_NAME FROM RDB$GENERATORS");
-
-      while (rs.next()) {
-        String generatorName = rs.getString(1).trim();
-        Column column = (Column) names.get(generatorName);
-
-        if (column != null) {
-          column.setAutoIncrement(true);
-        }
-      }
-      rs.close();
-    } finally {
-      stmt.close();
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected Collection readPrimaryKeyNames(DatabaseMetaDataWrapper metaData, String tableName)
-      throws SQLException {
-    List pks = new ArrayList();
-    ResultSet pkData = null;
-
-    try {
-      if (getPlatform().isDelimitedIdentifierModeOn()) {
-        // Jaybird has a problem when delimited identifiers are used as
-        // it is not able to find the primary key info for the table
-        // So we have to filter manually below
-        pkData = metaData.getPrimaryKeys(getDefaultTablePattern());
-        while (pkData.next()) {
-          Map values = readColumns(pkData, getColumnsForPK());
-
-          if (tableName.equals(values.get("TABLE_NAME"))) {
-            pks.add(readPrimaryKeyName(metaData, values));
-          }
-        }
-      } else {
-        pkData = metaData.getPrimaryKeys(tableName);
-        while (pkData.next()) {
-          Map values = readColumns(pkData, getColumnsForPK());
-
-          pks.add(readPrimaryKeyName(metaData, values));
-        }
-      }
-    } finally {
-      if (pkData != null) {
-        pkData.close();
-      }
-    }
-    return pks;
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected Collection readForeignKeys(DatabaseMetaDataWrapper metaData, String tableName)
-      throws SQLException {
-    Map fks = new ListOrderedMap();
-    ResultSet fkData = null;
-
-    try {
-      if (getPlatform().isDelimitedIdentifierModeOn()) {
-        // Jaybird has a problem when delimited identifiers are used as
-        // it is not able to find the foreign key info for the table
-        // So we have to filter manually below
-        fkData = metaData.getForeignKeys(getDefaultTablePattern());
-        while (fkData.next()) {
-          Map values = readColumns(fkData, getColumnsForFK());
-
-          if (tableName.equals(values.get("FKTABLE_NAME"))) {
-            readForeignKey(metaData, values, fks);
-          }
-        }
-      } else {
-        fkData = metaData.getForeignKeys(tableName);
-        while (fkData.next()) {
-          Map values = readColumns(fkData, getColumnsForFK());
-
-          readForeignKey(metaData, values, fks);
-        }
-      }
-    } finally {
-      if (fkData != null) {
-        fkData.close();
-      }
-    }
-    return fks.values();
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected Collection readIndices(DatabaseMetaDataWrapper metaData, String tableName)
-      throws SQLException {
-    // Jaybird is not able to read indices when delimited identifiers are
-    // turned on,
-    // so we gather the data manually using Firebird's system tables
-    Map indices = new ListOrderedMap();
-    StringBuffer query = new StringBuffer();
-
-    query
-        .append("SELECT a.RDB$INDEX_NAME INDEX_NAME, b.RDB$RELATION_NAME TABLE_NAME, b.RDB$UNIQUE_FLAG NON_UNIQUE,");
-    query
-        .append(" a.RDB$FIELD_POSITION ORDINAL_POSITION, a.RDB$FIELD_NAME COLUMN_NAME, 3 INDEX_TYPE");
-    query
-        .append(" FROM RDB$INDEX_SEGMENTS a, RDB$INDICES b WHERE a.RDB$INDEX_NAME=b.RDB$INDEX_NAME AND b.RDB$RELATION_NAME = ?");
-
-    PreparedStatement stmt = getConnection().prepareStatement(query.toString());
-    ResultSet indexData = null;
-
-    stmt.setString(1, getPlatform().isDelimitedIdentifierModeOn() ? tableName : tableName
-        .toUpperCase());
-
-    try {
-      indexData = stmt.executeQuery();
-
-      while (indexData.next()) {
-        Map values = readColumns(indexData, getColumnsForIndex());
-
-        // we have to reverse the meaning of the unique flag
-        values.put("NON_UNIQUE", Boolean.FALSE.equals(values.get("NON_UNIQUE")) ? Boolean.TRUE
-            : Boolean.FALSE);
-        // and trim the names
-        values.put("INDEX_NAME", ((String) values.get("INDEX_NAME")).trim());
-        values.put("TABLE_NAME", ((String) values.get("TABLE_NAME")).trim());
-        values.put("COLUMN_NAME", ((String) values.get("COLUMN_NAME")).trim());
-        readIndex(metaData, values, indices);
-      }
-    } finally {
-      if (indexData != null) {
-        indexData.close();
-      }
-    }
-    return indices.values();
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected boolean isInternalPrimaryKeyIndex(DatabaseMetaDataWrapper metaData, Table table,
-      Index index) throws SQLException {
-    String tableName = getPlatform().getSqlBuilder().getStructureObjectName(table);
-    String indexName = getPlatform().getSqlBuilder().getConstraintObjectName(index);
-    StringBuffer query = new StringBuffer();
-
-    query
-        .append("SELECT RDB$CONSTRAINT_NAME FROM RDB$RELATION_CONSTRAINTS where RDB$RELATION_NAME=? AND RDB$CONSTRAINT_TYPE=? AND RDB$INDEX_NAME=?");
-
-    PreparedStatement stmt = getConnection().prepareStatement(query.toString());
-
-    try {
-      stmt.setString(1, getPlatform().isDelimitedIdentifierModeOn() ? tableName : tableName
-          .toUpperCase());
-      stmt.setString(2, "PRIMARY KEY");
-      stmt.setString(3, indexName);
-
-      ResultSet resultSet = stmt.executeQuery();
-
-      return resultSet.next();
-    } finally {
-      if (stmt != null) {
-        stmt.close();
-      }
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected boolean isInternalForeignKeyIndex(DatabaseMetaDataWrapper metaData, Table table,
-      ForeignKey fk, Index index) throws SQLException {
-    String tableName = getPlatform().getSqlBuilder().getStructureObjectName(table);
-    String indexName = getPlatform().getSqlBuilder().getConstraintObjectName(index);
-    String fkName = getPlatform().getSqlBuilder().getForeignKeyName(table, fk);
-    StringBuffer query = new StringBuffer();
-
-    query
-        .append("SELECT RDB$CONSTRAINT_NAME FROM RDB$RELATION_CONSTRAINTS where RDB$RELATION_NAME=? AND RDB$CONSTRAINT_TYPE=? AND RDB$CONSTRAINT_NAME=? AND RDB$INDEX_NAME=?");
-
-    PreparedStatement stmt = getConnection().prepareStatement(query.toString());
-
-    try {
-      stmt.setString(1, getPlatform().isDelimitedIdentifierModeOn() ? tableName : tableName
-          .toUpperCase());
-      stmt.setString(2, "FOREIGN KEY");
-      stmt.setString(3, fkName);
-      stmt.setString(4, indexName);
-
-      ResultSet resultSet = stmt.executeQuery();
-
-      return resultSet.next();
-    } finally {
-      if (stmt != null) {
-        stmt.close();
-      }
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public String determineSchemaOf(Connection connection, String schemaPattern, Table table)
-      throws SQLException {
-    ResultSet tableData = null;
-    ResultSet columnData = null;
-
-    try {
-      DatabaseMetaDataWrapper metaData = new DatabaseMetaDataWrapper();
-
-      metaData.setMetaData(connection.getMetaData());
-      metaData.setCatalog(getDefaultCatalogPattern());
-      metaData.setSchemaPattern(schemaPattern == null ? getDefaultSchemaPattern() : schemaPattern);
-      metaData.setTableTypes(getDefaultTableTypes());
-
-      String tablePattern = table.getName();
-
-      if (getPlatform().isDelimitedIdentifierModeOn()) {
-        tablePattern = tablePattern.toUpperCase();
-      }
-
-      tableData = metaData.getTables(tablePattern);
-
-      boolean found = false;
-      String schema = null;
-
-      while (!found && tableData.next()) {
-        Map values = readColumns(tableData, getColumnsForTable());
-        String tableName = (String) values.get("TABLE_NAME");
-
-        if ((tableName != null) && (tableName.length() > 0)) {
-          schema = (String) values.get("TABLE_SCHEM");
-          found = true;
-
-          if (getPlatform().isDelimitedIdentifierModeOn()) {
-            // Jaybird has a problem when delimited identifiers are
-            // used as
-            // it is not able to find the columns for the table
-            // So we have to filter manually below
-            columnData = metaData.getColumns(getDefaultTablePattern(), getDefaultColumnPattern());
-          } else {
-            columnData = metaData.getColumns(tableName, getDefaultColumnPattern());
-          }
-
-          while (found && columnData.next()) {
-            values = readColumns(columnData, getColumnsForColumn());
-
-            if (getPlatform().isDelimitedIdentifierModeOn()
-                && !tableName.equals(values.get("TABLE_NAME"))) {
-              continue;
-            }
-
-            if (table.findColumn((String) values.get("COLUMN_NAME"), getPlatform()
-                .isDelimitedIdentifierModeOn()) == null) {
-              found = false;
-            }
-          }
-          columnData.close();
-          columnData = null;
-        }
-      }
-      return found ? schema : null;
-    } finally {
-      if (columnData != null) {
-        columnData.close();
-      }
-      if (tableData != null) {
-        tableData.close();
-      }
-    }
-  }
-}
--- a/src/org/apache/ddlutils/platform/firebird/FirebirdPlatform.java	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-package org.apache.ddlutils.platform.firebird;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.sql.Types;
-
-import org.apache.ddlutils.PlatformInfo;
-import org.apache.ddlutils.platform.PlatformImplBase;
-
-/**
- * The platform implementation for the Firebird database. It is assumed that the database is
- * configured with sql dialect 3!
- * 
- * @version $Revision: 231306 $
- */
-public class FirebirdPlatform extends PlatformImplBase {
-  /** Database name of this platform. */
-  public static final String DATABASENAME = "Firebird";
-  /** The standard Firebird jdbc driver. */
-  public static final String JDBC_DRIVER = "org.firebirdsql.jdbc.FBDriver";
-  /** The subprotocol used by the standard Firebird driver. */
-  public static final String JDBC_SUBPROTOCOL = "firebirdsql";
-
-  /**
-   * Creates a new Firebird platform instance.
-   */
-  public FirebirdPlatform() {
-    PlatformInfo info = getPlatformInfo();
-
-    info.setMaxIdentifierLength(31);
-    info.setSystemForeignKeyIndicesAlwaysNonUnique(true);
-    info.setCommentPrefix("/*");
-    info.setCommentSuffix("*/");
-
-    info.addNativeTypeMapping(Types.ARRAY, "BLOB", Types.LONGVARBINARY);
-    info.addNativeTypeMapping(Types.BINARY, "BLOB", Types.LONGVARBINARY);
-    info.addNativeTypeMapping(Types.BIT, "SMALLINT", Types.SMALLINT);
-    info.addNativeTypeMapping(Types.CLOB, "BLOB SUB_TYPE TEXT", Types.LONGVARCHAR);
-    info.addNativeTypeMapping(Types.DISTINCT, "BLOB", Types.LONGVARBINARY);
-    info.addNativeTypeMapping(Types.BLOB, "BLOB", Types.LONGVARBINARY);
-    info.addNativeTypeMapping(Types.DOUBLE, "DOUBLE PRECISION");
-    info.addNativeTypeMapping(Types.FLOAT, "DOUBLE PRECISION", Types.DOUBLE);
-    info.addNativeTypeMapping(Types.JAVA_OBJECT, "BLOB", Types.LONGVARBINARY);
-    info.addNativeTypeMapping(Types.LONGVARBINARY, "BLOB", Types.LONGVARBINARY);
-    info.addNativeTypeMapping(Types.LONGVARCHAR, "BLOB SUB_TYPE TEXT");
-    info.addNativeTypeMapping(Types.NULL, "BLOB", Types.LONGVARBINARY);
-    info.addNativeTypeMapping(Types.OTHER, "BLOB", Types.LONGVARBINARY);
-    // This is back-mapped to REAL in the model reader
-    info.addNativeTypeMapping(Types.REAL, "FLOAT");
-    info.addNativeTypeMapping(Types.REF, "BLOB", Types.LONGVARBINARY);
-    info.addNativeTypeMapping(Types.STRUCT, "BLOB", Types.LONGVARBINARY);
-    info.addNativeTypeMapping(Types.TINYINT, "SMALLINT", Types.SMALLINT);
-    info.addNativeTypeMapping(Types.VARBINARY, "BLOB", Types.LONGVARBINARY);
-
-    info.addNativeTypeMapping("BOOLEAN", "SMALLINT", "SMALLINT");
-    info.addNativeTypeMapping("DATALINK", "BLOB", "LONGVARBINARY");
-
-    info.setDefaultSize(Types.VARCHAR, 254);
-    info.setDefaultSize(Types.CHAR, 254);
-
-    setSqlBuilder(new FirebirdBuilder(this));
-    setModelReader(new FirebirdModelReader(this));
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getName() {
-    return DATABASENAME;
-  }
-}
--- a/src/org/apache/ddlutils/platform/firebird/package.html	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-<html>
-<head>
-<!-- 
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-   <meta name="Author" content="Thomas Dudziak">
-</head>
-<body bgcolor="white">
-  <p>
-  	This package contains the platform implementation for the
-    <a href="http://www.firebirdsql.org/">Firebird</a> database.
-  </p>
-</body>
-</html>
--- a/src/org/apache/ddlutils/platform/hsqldb/HsqlDbBuilder.java	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,166 +0,0 @@
-package org.apache.ddlutils.platform.hsqldb;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-
-import org.apache.ddlutils.Platform;
-import org.apache.ddlutils.alteration.AddColumnChange;
-import org.apache.ddlutils.alteration.RemoveColumnChange;
-import org.apache.ddlutils.alteration.TableChange;
-import org.apache.ddlutils.model.Database;
-import org.apache.ddlutils.model.Table;
-import org.apache.ddlutils.platform.SqlBuilder;
-
-/**
- * The SQL Builder for the HsqlDb database.
- * 
- * @version $Revision: 518485 $
- */
-public class HsqlDbBuilder extends SqlBuilder {
-  /**
-   * Creates a new builder instance.
-   * 
-   * @param platform
-   *          The plaftform this builder belongs to
-   */
-  public HsqlDbBuilder(Platform platform) {
-    super(platform);
-    addEscapedCharSequence("'", "''");
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public void dropTable(Table table) throws IOException {
-    print("DROP TABLE ");
-    printIdentifier(getStructureObjectName(table));
-    print(" IF EXISTS");
-    printEndOfStatement();
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getSelectLastIdentityValues(Table table) {
-    return "CALL IDENTITY()";
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected void processTableStructureChanges(Database currentModel, Database desiredModel,
-      Table sourceTable, Table targetTable, Map parameters, List changes) throws IOException {
-    // HsqlDb can only drop columns that are not part of a primary key
-    for (Iterator changeIt = changes.iterator(); changeIt.hasNext();) {
-      TableChange change = (TableChange) changeIt.next();
-
-      if ((change instanceof RemoveColumnChange)
-          && ((RemoveColumnChange) change).getColumn().isPrimaryKey()) {
-        return;
-      }
-    }
-
-    // in order to utilize the ALTER TABLE ADD COLUMN BEFORE statement
-    // we have to apply the add column changes in the correct order
-    // thus we first gather all add column changes and then execute them
-    // Since we get them in target table column order, we can simply
-    // iterate backwards
-    ArrayList addColumnChanges = new ArrayList();
-
-    for (Iterator changeIt = changes.iterator(); changeIt.hasNext();) {
-      TableChange change = (TableChange) changeIt.next();
-
-      if (change instanceof AddColumnChange) {
-        addColumnChanges.add(change);
-        changeIt.remove();
-      }
-    }
-    for (ListIterator changeIt = addColumnChanges.listIterator(addColumnChanges.size()); changeIt
-        .hasPrevious();) {
-      AddColumnChange addColumnChange = (AddColumnChange) changeIt.previous();
-
-      processChange(currentModel, desiredModel, addColumnChange);
-      changeIt.remove();
-    }
-
-    for (Iterator changeIt = changes.iterator(); changeIt.hasNext();) {
-      TableChange change = (TableChange) changeIt.next();
-
-      if (change instanceof RemoveColumnChange) {
-        RemoveColumnChange removeColumnChange = (RemoveColumnChange) change;
-
-        processChange(currentModel, desiredModel, removeColumnChange);
-        changeIt.remove();
-      }
-    }
-  }
-
-  /**
-   * Processes the addition of a column to a table.
-   * 
-   * @param currentModel
-   *          The current database schema
-   * @param desiredModel
-   *          The desired database schema
-   * @param change
-   *          The change object
-   */
-  protected void processChange(Database currentModel, Database desiredModel, AddColumnChange change)
-      throws IOException {
-    print("ALTER TABLE ");
-    printlnIdentifier(getStructureObjectName(change.getChangedTable()));
-    printIndent();
-    print("ADD COLUMN ");
-    writeColumn(change.getChangedTable(), change.getNewColumn());
-    if (change.getNextColumn() != null) {
-      print(" BEFORE ");
-      printIdentifier(getColumnName(change.getNextColumn()));
-    }
-    printEndOfStatement();
-    change.apply(currentModel, getPlatform().isDelimitedIdentifierModeOn());
-  }
-
-  /**
-   * Processes the removal of a column from a table.
-   * 
-   * @param currentModel
-   *          The current database schema
-   * @param desiredModel
-   *          The desired database schema
-   * @param change
-   *          The change object
-   */
-  protected void processChange(Database currentModel, Database desiredModel,
-      RemoveColumnChange change) throws IOException {
-    print("ALTER TABLE ");
-    printlnIdentifier(getStructureObjectName(change.getChangedTable()));
-    printIndent();
-    print("DROP COLUMN ");
-    printIdentifier(getColumnName(change.getColumn()));
-    printEndOfStatement();
-    change.apply(currentModel, getPlatform().isDelimitedIdentifierModeOn());
-  }
-}
--- a/src/org/apache/ddlutils/platform/hsqldb/HsqlDbModelReader.java	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-package org.apache.ddlutils.platform.hsqldb;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.sql.SQLException;
-import java.util.Map;
-
-import org.apache.ddlutils.Platform;
-import org.apache.ddlutils.model.Column;
-import org.apache.ddlutils.model.ForeignKey;
-import org.apache.ddlutils.model.Index;
-import org.apache.ddlutils.model.Table;
-import org.apache.ddlutils.model.TypeMap;
-import org.apache.ddlutils.platform.DatabaseMetaDataWrapper;
-import org.apache.ddlutils.platform.JdbcModelReader;
-
-/**
- * Reads a database model from a HsqlDb database.
- * 
- * @version $Revision: $
- */
-public class HsqlDbModelReader extends JdbcModelReader {
-  /**
-   * Creates a new model reader for HsqlDb databases.
-   * 
-   * @param platform
-   *          The platform that this model reader belongs to
-   */
-  public HsqlDbModelReader(Platform platform) {
-    super(platform);
-    setDefaultCatalogPattern(null);
-    setDefaultSchemaPattern(null);
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected Table readTable(DatabaseMetaDataWrapper metaData, Map values) throws SQLException {
-    Table table = super.readTable(metaData, values);
-
-    if (table != null) {
-      // For at least version 1.7.2 we have to determine the
-      // auto-increment columns
-      // from a result set meta data because the database does not put
-      // this info
-      // into the database metadata
-      // Since Hsqldb only allows IDENTITY for primary key columns, we
-      // restrict
-      // our search to those columns
-      determineAutoIncrementFromResultSetMetaData(table, table.getPrimaryKeyColumns());
-    }
-
-    return table;
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected Column readColumn(DatabaseMetaDataWrapper metaData, Map values) throws SQLException {
-    Column column = super.readColumn(metaData, values);
-
-    if (TypeMap.isTextType(column.getTypeCode()) && (column.getDefaultValue() != null)) {
-      column.setDefaultValue(unescape(column.getDefaultValue(), "'", "''"));
-    }
-    return column;
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected boolean isInternalForeignKeyIndex(DatabaseMetaDataWrapper metaData, Table table,
-      ForeignKey fk, Index index) {
-    String name = index.getName();
-
-    return (name != null) && name.startsWith("SYS_IDX_");
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected boolean isInternalPrimaryKeyIndex(DatabaseMetaDataWrapper metaData, Table table,
-      Index index) {
-    String name = index.getName();
-
-    return (name != null) && (name.startsWith("SYS_PK_") || name.startsWith("SYS_IDX_"));
-  }
-}
--- a/src/org/apache/ddlutils/platform/hsqldb/HsqlDbPlatform.java	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,101 +0,0 @@
-package org.apache.ddlutils.platform.hsqldb;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.sql.Types;
-
-import org.apache.ddlutils.DdlUtilsException;
-import org.apache.ddlutils.PlatformInfo;
-import org.apache.ddlutils.platform.PlatformImplBase;
-
-/**
- * The platform implementation for the HsqlDb database.
- * 
- * @version $Revision: 231306 $
- */
-public class HsqlDbPlatform extends PlatformImplBase {
-  /** Database name of this platform. */
-  public static final String DATABASENAME = "HsqlDb";
-  /** The standard Hsqldb jdbc driver. */
-  public static final String JDBC_DRIVER = "org.hsqldb.jdbcDriver";
-  /** The subprotocol used by the standard Hsqldb driver. */
-  public static final String JDBC_SUBPROTOCOL = "hsqldb";
-
-  /**
-   * Creates a new instance of the Hsqldb platform.
-   */
-  public HsqlDbPlatform() {
-    PlatformInfo info = getPlatformInfo();
-
-    info.setNonPKIdentityColumnsSupported(false);
-    info.setIdentityOverrideAllowed(false);
-    info.setSystemForeignKeyIndicesAlwaysNonUnique(true);
-
-    info.addNativeTypeMapping(Types.ARRAY, "LONGVARBINARY", Types.LONGVARBINARY);
-    info.addNativeTypeMapping(Types.BLOB, "LONGVARBINARY", Types.LONGVARBINARY);
-    info.addNativeTypeMapping(Types.CLOB, "LONGVARCHAR", Types.LONGVARCHAR);
-    info.addNativeTypeMapping(Types.DISTINCT, "LONGVARBINARY", Types.LONGVARBINARY);
-    info.addNativeTypeMapping(Types.FLOAT, "DOUBLE", Types.DOUBLE);
-    info.addNativeTypeMapping(Types.JAVA_OBJECT, "OBJECT");
-    info.addNativeTypeMapping(Types.NULL, "LONGVARBINARY", Types.LONGVARBINARY);
-    info.addNativeTypeMapping(Types.REF, "LONGVARBINARY", Types.LONGVARBINARY);
-    info.addNativeTypeMapping(Types.STRUCT, "LONGVARBINARY", Types.LONGVARBINARY);
-    // JDBC's TINYINT requires a value range of -255 to 255, but HsqlDb's is
-    // only -128 to 127
-    info.addNativeTypeMapping(Types.TINYINT, "SMALLINT", Types.SMALLINT);
-
-    info.addNativeTypeMapping("BIT", "BOOLEAN", "BOOLEAN");
-    info.addNativeTypeMapping("DATALINK", "LONGVARBINARY", "LONGVARBINARY");
-
-    info.setDefaultSize(Types.CHAR, Integer.MAX_VALUE);
-    info.setDefaultSize(Types.VARCHAR, Integer.MAX_VALUE);
-    info.setDefaultSize(Types.BINARY, Integer.MAX_VALUE);
-    info.setDefaultSize(Types.VARBINARY, Integer.MAX_VALUE);
-
-    setSqlBuilder(new HsqlDbBuilder(this));
-    setModelReader(new HsqlDbModelReader(this));
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getName() {
-    return DATABASENAME;
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public void shutdownDatabase(Connection connection) {
-    Statement stmt = null;
-
-    try {
-      stmt = connection.createStatement();
-      stmt.executeUpdate("SHUTDOWN");
-    } catch (SQLException ex) {
-      throw new DdlUtilsException(ex);
-    } finally {
-      closeStatement(stmt);
-    }
-  }
-}
--- a/src/org/apache/ddlutils/platform/hsqldb/package.html	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-<html>
-<head>
-<!-- 
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-   <meta name="Author" content="Thomas Dudziak">
-</head>
-<body bgcolor="white">
-  <p>
-  	This package contains the platform implementation for the
-    <a href="http://www.hsqldb.org/">HSQLDB</a> database.
-  </p>
-</body>
-</html>
--- a/src/org/apache/ddlutils/platform/interbase/InterbaseBuilder.java	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,339 +0,0 @@
-package org.apache.ddlutils.platform.interbase;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.IOException;
-import java.sql.Types;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.ddlutils.Platform;
-import org.apache.ddlutils.alteration.AddColumnChange;
-import org.apache.ddlutils.alteration.AddPrimaryKeyChange;
-import org.apache.ddlutils.alteration.RemoveColumnChange;
-import org.apache.ddlutils.alteration.TableChange;
-import org.apache.ddlutils.model.Column;
-import org.apache.ddlutils.model.Database;
-import org.apache.ddlutils.model.Index;
-import org.apache.ddlutils.model.Table;
-import org.apache.ddlutils.model.ValueObject;
-import org.apache.ddlutils.platform.SqlBuilder;
-import org.apache.ddlutils.util.Jdbc3Utils;
-
-/**
- * The SQL Builder for the Interbase database.
- * 
- * @version $Revision: 231306 $
- */
-public class InterbaseBuilder extends SqlBuilder {
-  /**
-   * Creates a new builder instance.
-   * 
-   * @param platform
-   *          The plaftform this builder belongs to
-   */
-  public InterbaseBuilder(Platform platform) {
-    super(platform);
-    addEscapedCharSequence("'", "''");
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public void createTable(Database database, Table table, Map parameters) throws IOException {
-    super.createTable(database, table, parameters);
-
-    // creating generator and trigger for auto-increment
-    Column[] columns = table.getAutoIncrementColumns();
-
-    for (int idx = 0; idx < columns.length; idx++) {
-      writeAutoIncrementCreateStmts(database, table, columns[idx]);
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected String getNativeDefaultValue(ValueObject column) {
-    if ((column.getTypeCode() == Types.BIT)
-        || (Jdbc3Utils.supportsJava14JdbcTypes() && (column.getTypeCode() == Jdbc3Utils
-            .determineBooleanTypeCode()))) {
-      return getDefaultValueHelper().convert(column.getDefaultValue(), column.getTypeCode(),
-          Types.SMALLINT).toString();
-    } else {
-      return super.getNativeDefaultValue(column);
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public void dropTable(Table table) throws IOException {
-    // dropping generators for auto-increment
-    Column[] columns = table.getAutoIncrementColumns();
-
-    for (int idx = 0; idx < columns.length; idx++) {
-      writeAutoIncrementDropStmts(table, columns[idx]);
-    }
-    super.dropTable(table);
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public void writeExternalIndexDropStmt(Table table, Index index) throws IOException {
-    // Index names in Interbase are unique to a schema and hence we do not
-    // need the ON <tablename> clause
-    print("DROP INDEX ");
-    printIdentifier(getConstraintObjectName(index));
-    printEndOfStatement();
-  }
-
-  /**
-   * Writes the creation statements to make the given column an auto-increment column.
-   * 
-   * @param database
-   *          The database model
-   * @param table
-   *          The table
-   * @param column
-   *          The column to make auto-increment
-   */
-  private void writeAutoIncrementCreateStmts(Database database, Table table, Column column)
-      throws IOException {
-    print("CREATE GENERATOR ");
-    printIdentifier(getGeneratorName(table, column));
-    printEndOfStatement();
-
-    print("CREATE TRIGGER ");
-    printIdentifier(getTriggerName(table, column));
-    print(" FOR ");
-    printlnIdentifier(getStructureObjectName(table));
-    println("ACTIVE BEFORE INSERT POSITION 0 AS");
-    print("BEGIN IF (NEW.");
-    printIdentifier(getColumnName(column));
-    print(" IS NULL) THEN NEW.");
-    printIdentifier(getColumnName(column));
-    print(" = GEN_ID(");
-    printIdentifier(getGeneratorName(table, column));
-    print(", 1); END");
-    printEndOfStatement();
-  }
-
-  /**
-   * Writes the statements to drop the auto-increment status for the given column.
-   * 
-   * @param table
-   *          The table
-   * @param column
-   *          The column to remove the auto-increment status for
-   */
-  private void writeAutoIncrementDropStmts(Table table, Column column) throws IOException {
-    print("DROP TRIGGER ");
-    printIdentifier(getTriggerName(table, column));
-    printEndOfStatement();
-
-    print("DROP GENERATOR ");
-    printIdentifier(getGeneratorName(table, column));
-    printEndOfStatement();
-  }
-
-  /**
-   * Determines the name of the trigger for an auto-increment column.
-   * 
-   * @param table
-   *          The table
-   * @param column
-   *          The auto-increment column
-   * @return The trigger name
-   */
-  protected String getTriggerName(Table table, Column column) {
-    return getConstraintName("trg", table, column.getName(), null);
-  }
-
-  /**
-   * Determines the name of the generator for an auto-increment column.
-   * 
-   * @param table
-   *          The table
-   * @param column
-   *          The auto-increment column
-   * @return The generator name
-   */
-  protected String getGeneratorName(Table table, Column column) {
-    return getConstraintName("gen", table, column.getName(), null);
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected void writeColumnAutoIncrementStmt(Table table, Column column) throws IOException {
-    // we're using a generator
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getSelectLastIdentityValues(Table table) {
-    Column[] columns = table.getAutoIncrementColumns();
-
-    if (columns.length == 0) {
-      return null;
-    } else {
-      StringBuffer result = new StringBuffer();
-
-      result.append("SELECT ");
-      for (int idx = 0; idx < columns.length; idx++) {
-        result.append("GEN_ID(");
-        result.append(getDelimitedIdentifier(getGeneratorName(table, columns[idx])));
-        result.append(", 0)");
-      }
-      result.append(" FROM RDB$DATABASE");
-      return result.toString();
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected void processTableStructureChanges(Database currentModel, Database desiredModel,
-      Table sourceTable, Table targetTable, Map parameters, List changes) throws IOException {
-    // TODO: Dropping of primary keys is currently not supported because we
-    // cannot
-    // determine the pk constraint names and drop them in one go
-    // (We could used a stored procedure if Interbase would allow them to
-    // use DDL)
-    // This will be easier once named primary keys are supported
-    boolean pkColumnAdded = false;
-
-    for (Iterator changeIt = changes.iterator(); changeIt.hasNext();) {
-      TableChange change = (TableChange) changeIt.next();
-
-      if (change instanceof AddColumnChange) {
-        AddColumnChange addColumnChange = (AddColumnChange) change;
-
-        // TODO: we cannot add columns to the primary key this way
-        // because we would have to drop the pk first and then
-        // add a new one afterwards which is not supported yet
-        if (addColumnChange.getNewColumn().isPrimaryKey()) {
-          pkColumnAdded = true;
-        } else {
-          processChange(currentModel, desiredModel, addColumnChange);
-          changeIt.remove();
-        }
-      } else if (change instanceof RemoveColumnChange) {
-        RemoveColumnChange removeColumnChange = (RemoveColumnChange) change;
-
-        // TODO: we cannot drop primary key columns this way
-        // because we would have to drop the pk first and then
-        // add a new one afterwards which is not supported yet
-        if (!removeColumnChange.getColumn().isPrimaryKey()) {
-          processChange(currentModel, desiredModel, removeColumnChange);
-          changeIt.remove();
-        }
-      }
-    }
-    for (Iterator changeIt = changes.iterator(); changeIt.hasNext();) {
-      TableChange change = (TableChange) changeIt.next();
-
-      // we can only add a primary key if all columns are present in the
-      // table
-      // i.e. none was added during this alteration
-      if ((change instanceof AddPrimaryKeyChange) && !pkColumnAdded) {
-        processChange(currentModel, desiredModel, (AddPrimaryKeyChange) change);
-        changeIt.remove();
-      }
-    }
-  }
-
-  /**
-   * Processes the addition of a column to a table.
-   * 
-   * @param currentModel
-   *          The current database schema
-   * @param desiredModel
-   *          The desired database schema
-   * @param change
-   *          The change object
-   */
-  protected void processChange(Database currentModel, Database desiredModel, AddColumnChange change)
-      throws IOException {
-    print("ALTER TABLE ");
-    printlnIdentifier(getStructureObjectName(change.getChangedTable()));
-    printIndent();
-    print("ADD ");
-    writeColumn(change.getChangedTable(), change.getNewColumn());
-    printEndOfStatement();
-
-    Table curTable = currentModel.findTable(change.getChangedTable().getName(), getPlatform()
-        .isDelimitedIdentifierModeOn());
-
-    if (!change.isAtEnd()) {
-      Column prevColumn = change.getPreviousColumn();
-
-      if (prevColumn != null) {
-        // we need the corresponding column object from the current
-        // table
-        prevColumn = curTable.findColumn(prevColumn.getName(), getPlatform()
-            .isDelimitedIdentifierModeOn());
-      }
-      // Even though Interbase can only add columns, we can move them
-      // later on
-      print("ALTER TABLE ");
-      printlnIdentifier(getStructureObjectName(change.getChangedTable()));
-      printIndent();
-      print("ALTER ");
-      printIdentifier(getColumnName(change.getNewColumn()));
-      print(" POSITION ");
-      // column positions start at 1 in Interbase
-      print(prevColumn == null ? "1" : String.valueOf(curTable.getColumnIndex(prevColumn) + 2));
-      printEndOfStatement();
-    }
-    if (change.getNewColumn().isAutoIncrement()) {
-      writeAutoIncrementCreateStmts(currentModel, curTable, change.getNewColumn());
-    }
-    change.apply(currentModel, getPlatform().isDelimitedIdentifierModeOn());
-  }
-
-  /**
-   * Processes the removal of a column from a table.
-   * 
-   * @param currentModel
-   *          The current database schema
-   * @param desiredModel
-   *          The desired database schema
-   * @param change
-   *          The change object
-   */
-  protected void processChange(Database currentModel, Database desiredModel,
-      RemoveColumnChange change) throws IOException {
-    if (change.getColumn().isAutoIncrement()) {
-      writeAutoIncrementDropStmts(change.getChangedTable(), change.getColumn());
-    }
-    print("ALTER TABLE ");
-    printlnIdentifier(getStructureObjectName(change.getChangedTable()));
-    printIndent();
-    print("DROP ");
-    printIdentifier(getColumnName(change.getColumn()));
-    printEndOfStatement();
-    change.apply(currentModel, getPlatform().isDelimitedIdentifierModeOn());
-  }
-}
--- a/src/org/apache/ddlutils/platform/interbase/InterbaseModelReader.java	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,459 +0,0 @@
-package org.apache.ddlutils.platform.interbase;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.sql.Types;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.collections.map.ListOrderedMap;
-import org.apache.ddlutils.Platform;
-import org.apache.ddlutils.model.Column;
-import org.apache.ddlutils.model.ForeignKey;
-import org.apache.ddlutils.model.Index;
-import org.apache.ddlutils.model.Table;
-import org.apache.ddlutils.model.TypeMap;
-import org.apache.ddlutils.platform.DatabaseMetaDataWrapper;
-import org.apache.ddlutils.platform.JdbcModelReader;
-
-/**
- * The Jdbc Model Reader for Interbase.
- * 
- * @version $Revision: $
- */
-public class InterbaseModelReader extends JdbcModelReader {
-  /**
-   * Creates a new model reader for Interbase databases.
-   * 
-   * @param platform
-   *          The platform that this model reader belongs to
-   */
-  public InterbaseModelReader(Platform platform) {
-    super(platform);
-    setDefaultCatalogPattern(null);
-    setDefaultSchemaPattern(null);
-    setDefaultTablePattern("%");
-    setDefaultColumnPattern("%");
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected Table readTable(DatabaseMetaDataWrapper metaData, Map values) throws SQLException {
-    Table table = super.readTable(metaData, values);
-
-    if (table != null) {
-      determineExtraColumnInfo(table);
-      determineAutoIncrementColumns(table);
-      adjustColumns(table);
-    }
-
-    return table;
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected Collection readColumns(DatabaseMetaDataWrapper metaData, String tableName)
-      throws SQLException {
-    ResultSet columnData = null;
-
-    try {
-      List columns = new ArrayList();
-
-      if (getPlatform().isDelimitedIdentifierModeOn()) {
-        // Jaybird has a problem when delimited identifiers are used as
-        // it is not able to find the columns for the table
-        // So we have to filter manually below
-        columnData = metaData.getColumns(getDefaultTablePattern(), getDefaultColumnPattern());
-
-        while (columnData.next()) {
-          Map values = readColumns(columnData, getColumnsForColumn());
-
-          if (tableName.equals(values.get("TABLE_NAME"))) {
-            columns.add(readColumn(metaData, values));
-          }
-        }
-      } else {
-        columnData = metaData.getColumns(tableName, getDefaultColumnPattern());
-
-        while (columnData.next()) {
-          Map values = readColumns(columnData, getColumnsForColumn());
-
-          columns.add(readColumn(metaData, values));
-        }
-      }
-
-      return columns;
-    } finally {
-      if (columnData != null) {
-        columnData.close();
-      }
-    }
-  }
-
-  /**
-   * Helper method that determines extra column info from the system tables: default value,
-   * precision, scale.
-   * 
-   * @param table
-   *          The table
-   */
-  protected void determineExtraColumnInfo(Table table) throws SQLException {
-    StringBuffer query = new StringBuffer();
-
-    query
-        .append("SELECT a.RDB$FIELD_NAME, a.RDB$DEFAULT_SOURCE, b.RDB$FIELD_PRECISION, b.RDB$FIELD_SCALE,");
-    query
-        .append(" b.RDB$FIELD_TYPE, b.RDB$FIELD_SUB_TYPE FROM RDB$RELATION_FIELDS a, RDB$FIELDS b");
-    query.append(" WHERE a.RDB$RELATION_NAME=? AND a.RDB$FIELD_SOURCE=b.RDB$FIELD_NAME");
-
-    PreparedStatement prepStmt = getConnection().prepareStatement(query.toString());
-
-    try {
-      prepStmt.setString(1, getPlatform().isDelimitedIdentifierModeOn() ? table.getName() : table
-          .getName().toUpperCase());
-
-      ResultSet rs = prepStmt.executeQuery();
-
-      while (rs.next()) {
-        String columnName = rs.getString(1).trim();
-        Column column = table.findColumn(columnName, getPlatform().isDelimitedIdentifierModeOn());
-
-        if (column != null) {
-          String defaultValue = rs.getString(2);
-
-          if (!rs.wasNull() && (defaultValue != null)) {
-            defaultValue = defaultValue.trim();
-            if (defaultValue.startsWith("DEFAULT ")) {
-              defaultValue = defaultValue.substring("DEFAULT ".length());
-            }
-            column.setDefaultValue(defaultValue);
-          }
-
-          short precision = rs.getShort(3);
-          boolean precisionSpecified = !rs.wasNull();
-          short scale = rs.getShort(4);
-          boolean scaleSpecified = !rs.wasNull();
-
-          if (precisionSpecified) {
-            // for some reason, Interbase stores the negative scale
-            column.setSizeAndScale(precision, new Integer(scaleSpecified ? -scale : 0));
-          }
-
-          short dbType = rs.getShort(5);
-          short blobSubType = rs.getShort(6);
-
-          // CLOBs are returned by the driver as VARCHAR
-          if (!rs.wasNull() && (dbType == 261) && (blobSubType == 1)) {
-            column.setTypeCode(Types.CLOB);
-          }
-        }
-      }
-      rs.close();
-    } finally {
-      prepStmt.close();
-    }
-  }
-
-  /**
-   * Helper method that determines the auto increment status using Interbase's system tables.
-   * 
-   * @param table
-   *          The table
-   */
-  protected void determineAutoIncrementColumns(Table table) throws SQLException {
-    // Since for long table and column names, the generator name will be
-    // shortened
-    // we have to determine for each column whether there is a generator for
-    // it
-    InterbaseBuilder builder = (InterbaseBuilder) getPlatform().getSqlBuilder();
-    Column[] columns = table.getColumns();
-    HashMap names = new HashMap();
-    String name;
-
-    for (int idx = 0; idx < columns.length; idx++) {
-      name = builder.getGeneratorName(table, columns[idx]);
-      if (!getPlatform().isDelimitedIdentifierModeOn()) {
-        name = name.toUpperCase();
-      }
-      names.put(name, columns[idx]);
-    }
-
-    Statement stmt = getConnection().createStatement();
-
-    try {
-      ResultSet rs = stmt.executeQuery("SELECT RDB$GENERATOR_NAME FROM RDB$GENERATORS");
-
-      while (rs.next()) {
-        String generatorName = rs.getString(1).trim();
-        Column column = (Column) names.get(generatorName);
-
-        if (column != null) {
-          column.setAutoIncrement(true);
-        }
-      }
-      rs.close();
-    } finally {
-      stmt.close();
-    }
-  }
-
-  /**
-   * Adjusts the columns in the table by fixing types and default values.
-   * 
-   * @param table
-   *          The table
-   */
-  protected void adjustColumns(Table table) {
-    Column[] columns = table.getColumns();
-
-    for (int idx = 0; idx < columns.length; idx++) {
-      if (columns[idx].getTypeCode() == Types.FLOAT) {
-        columns[idx].setTypeCode(Types.REAL);
-      } else if ((columns[idx].getTypeCode() == Types.NUMERIC)
-          || (columns[idx].getTypeCode() == Types.DECIMAL)) {
-        if ((columns[idx].getTypeCode() == Types.NUMERIC) && (columns[idx].getSizeAsInt() == 18)
-            && (columns[idx].getScaleAsInt() == 0)) {
-          columns[idx].setTypeCode(Types.BIGINT);
-        }
-      } else if (TypeMap.isTextType(columns[idx].getTypeCode())) {
-        columns[idx].setDefaultValue(unescape(columns[idx].getDefaultValue(), "'", "''"));
-      }
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected Collection readPrimaryKeyNames(DatabaseMetaDataWrapper metaData, String tableName)
-      throws SQLException {
-    List pks = new ArrayList();
-    ResultSet pkData = null;
-
-    try {
-      if (getPlatform().isDelimitedIdentifierModeOn()) {
-        // Jaybird has a problem when delimited identifiers are used as
-        // it is not able to find the primary key info for the table
-        // So we have to filter manually below
-        pkData = metaData.getPrimaryKeys(getDefaultTablePattern());
-        while (pkData.next()) {
-          Map values = readColumns(pkData, getColumnsForPK());
-
-          if (tableName.equals(values.get("TABLE_NAME"))) {
-            pks.add(readPrimaryKeyName(metaData, values));
-          }
-        }
-      } else {
-        pkData = metaData.getPrimaryKeys(tableName);
-        while (pkData.next()) {
-          Map values = readColumns(pkData, getColumnsForPK());
-
-          pks.add(readPrimaryKeyName(metaData, values));
-        }
-      }
-    } finally {
-      if (pkData != null) {
-        pkData.close();
-      }
-    }
-    return pks;
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected Collection readForeignKeys(DatabaseMetaDataWrapper metaData, String tableName)
-      throws SQLException {
-    Map fks = new ListOrderedMap();
-    ResultSet fkData = null;
-
-    try {
-      if (getPlatform().isDelimitedIdentifierModeOn()) {
-        // Jaybird has a problem when delimited identifiers are used as
-        // it is not able to find the foreign key info for the table
-        // So we have to filter manually below
-        fkData = metaData.getForeignKeys(getDefaultTablePattern());
-        while (fkData.next()) {
-          Map values = readColumns(fkData, getColumnsForFK());
-
-          if (tableName.equals(values.get("FKTABLE_NAME"))) {
-            readForeignKey(metaData, values, fks);
-          }
-        }
-      } else {
-        fkData = metaData.getForeignKeys(tableName);
-        while (fkData.next()) {
-          Map values = readColumns(fkData, getColumnsForFK());
-
-          readForeignKey(metaData, values, fks);
-        }
-      }
-    } finally {
-      if (fkData != null) {
-        fkData.close();
-      }
-    }
-    return fks.values();
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected boolean isInternalPrimaryKeyIndex(DatabaseMetaDataWrapper metaData, Table table,
-      Index index) throws SQLException {
-    String tableName = getPlatform().getSqlBuilder().getStructureObjectName(table);
-    String indexName = getPlatform().getSqlBuilder().getConstraintObjectName(index);
-    StringBuffer query = new StringBuffer();
-
-    query
-        .append("SELECT RDB$CONSTRAINT_NAME FROM RDB$RELATION_CONSTRAINTS where RDB$RELATION_NAME=? AND RDB$CONSTRAINT_TYPE=? AND RDB$INDEX_NAME=?");
-
-    PreparedStatement stmt = getConnection().prepareStatement(query.toString());
-
-    try {
-      stmt.setString(1, getPlatform().isDelimitedIdentifierModeOn() ? tableName : tableName
-          .toUpperCase());
-      stmt.setString(2, "PRIMARY KEY");
-      stmt.setString(3, indexName);
-
-      ResultSet resultSet = stmt.executeQuery();
-
-      return resultSet.next();
-    } finally {
-      if (stmt != null) {
-        stmt.close();
-      }
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected boolean isInternalForeignKeyIndex(DatabaseMetaDataWrapper metaData, Table table,
-      ForeignKey fk, Index index) throws SQLException {
-    String tableName = getPlatform().getSqlBuilder().getStructureObjectName(table);
-    String indexName = getPlatform().getSqlBuilder().getConstraintObjectName(index);
-    String fkName = getPlatform().getSqlBuilder().getForeignKeyName(table, fk);
-    StringBuffer query = new StringBuffer();
-
-    query
-        .append("SELECT RDB$CONSTRAINT_NAME FROM RDB$RELATION_CONSTRAINTS where RDB$RELATION_NAME=? AND RDB$CONSTRAINT_TYPE=? AND RDB$CONSTRAINT_NAME=? AND RDB$INDEX_NAME=?");
-
-    PreparedStatement stmt = getConnection().prepareStatement(query.toString());
-
-    try {
-      stmt.setString(1, getPlatform().isDelimitedIdentifierModeOn() ? tableName : tableName
-          .toUpperCase());
-      stmt.setString(2, "FOREIGN KEY");
-      stmt.setString(3, fkName);
-      stmt.setString(4, indexName);
-
-      ResultSet resultSet = stmt.executeQuery();
-
-      return resultSet.next();
-    } finally {
-      if (stmt != null) {
-        stmt.close();
-      }
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public String determineSchemaOf(Connection connection, String schemaPattern, Table table)
-      throws SQLException {
-    ResultSet tableData = null;
-    ResultSet columnData = null;
-
-    try {
-      DatabaseMetaDataWrapper metaData = new DatabaseMetaDataWrapper();
-
-      metaData.setMetaData(connection.getMetaData());
-      metaData.setCatalog(getDefaultCatalogPattern());
-      metaData.setSchemaPattern(schemaPattern == null ? getDefaultSchemaPattern() : schemaPattern);
-      metaData.setTableTypes(getDefaultTableTypes());
-
-      String tablePattern = table.getName();
-
-      if (getPlatform().isDelimitedIdentifierModeOn()) {
-        tablePattern = tablePattern.toUpperCase();
-      }
-
-      tableData = metaData.getTables(tablePattern);
-
-      boolean found = false;
-      String schema = null;
-
-      while (!found && tableData.next()) {
-        Map values = readColumns(tableData, getColumnsForTable());
-        String tableName = (String) values.get("TABLE_NAME");
-
-        if ((tableName != null) && (tableName.length() > 0)) {
-          schema = (String) values.get("TABLE_SCHEM");
-          found = true;
-
-          if (getPlatform().isDelimitedIdentifierModeOn()) {
-            // Jaybird has a problem when delimited identifiers are
-            // used as
-            // it is not able to find the columns for the table
-            // So we have to filter manually below
-            columnData = metaData.getColumns(getDefaultTablePattern(), getDefaultColumnPattern());
-          } else {
-            columnData = metaData.getColumns(tableName, getDefaultColumnPattern());
-          }
-
-          while (found && columnData.next()) {
-            values = readColumns(columnData, getColumnsForColumn());
-
-            if (getPlatform().isDelimitedIdentifierModeOn()
-                && !tableName.equals(values.get("TABLE_NAME"))) {
-              continue;
-            }
-
-            if (table.findColumn((String) values.get("COLUMN_NAME"), getPlatform()
-                .isDelimitedIdentifierModeOn()) == null) {
-              found = false;
-            }
-          }
-          columnData.close();
-          columnData = null;
-        }
-      }
-      return found ? schema : null;
-    } finally {
-      if (columnData != null) {
-        columnData.close();
-      }
-      if (tableData != null) {
-        tableData.close();
-      }
-    }
-  }
-}
--- a/src/org/apache/ddlutils/platform/interbase/InterbasePlatform.java	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,167 +0,0 @@
-package org.apache.ddlutils.platform.interbase;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.BufferedInputStream;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Types;
-
-import org.apache.ddlutils.DdlUtilsException;
-import org.apache.ddlutils.PlatformInfo;
-import org.apache.ddlutils.platform.PlatformImplBase;
-
-/**
- * The platform implementation for the Interbase database.
- * 
- * @version $Revision: 231306 $
- */
-public class InterbasePlatform extends PlatformImplBase {
-  /** Database name of this platform. */
-  public static final String DATABASENAME = "Interbase";
-  /** The interbase jdbc driver. */
-  public static final String JDBC_DRIVER = "interbase.interclient.Driver";
-  /** The subprotocol used by the interbase driver. */
-  public static final String JDBC_SUBPROTOCOL = "interbase";
-
-  /**
-   * Creates a new platform instance.
-   */
-  public InterbasePlatform() {
-    PlatformInfo info = getPlatformInfo();
-
-    info.setMaxIdentifierLength(31);
-    info.setCommentPrefix("/*");
-    info.setCommentSuffix("*/");
-    info.setSystemForeignKeyIndicesAlwaysNonUnique(true);
-
-    // BINARY and VARBINARY are also handled by the
-    // InterbaseBuilder.getSqlType method
-    info.addNativeTypeMapping(Types.ARRAY, "BLOB", Types.LONGVARBINARY);
-    info.addNativeTypeMapping(Types.BIGINT, "NUMERIC(18,0)");
-    // Theoretically we could use (VAR)CHAR CHARACTER SET OCTETS but the
-    // JDBC driver is not
-    // able to handle that properly (the byte[]/BinaryStream accessors do
-    // not work)
-    info.addNativeTypeMapping(Types.BINARY, "BLOB", Types.LONGVARBINARY);
-    info.addNativeTypeMapping(Types.BIT, "SMALLINT", Types.SMALLINT);
-    info.addNativeTypeMapping(Types.BLOB, "BLOB", Types.LONGVARBINARY);
-    info.addNativeTypeMapping(Types.CLOB, "BLOB SUB_TYPE TEXT");
-    info.addNativeTypeMapping(Types.DISTINCT, "BLOB", Types.LONGVARBINARY);
-    info.addNativeTypeMapping(Types.DOUBLE, "DOUBLE PRECISION");
-    info.addNativeTypeMapping(Types.FLOAT, "DOUBLE PRECISION", Types.DOUBLE);
-    info.addNativeTypeMapping(Types.JAVA_OBJECT, "BLOB", Types.LONGVARBINARY);
-    info.addNativeTypeMapping(Types.LONGVARBINARY, "BLOB", Types.LONGVARBINARY);
-    info.addNativeTypeMapping(Types.LONGVARCHAR, "BLOB SUB_TYPE TEXT", Types.CLOB);
-    info.addNativeTypeMapping(Types.NULL, "BLOB", Types.LONGVARBINARY);
-    info.addNativeTypeMapping(Types.OTHER, "BLOB", Types.LONGVARBINARY);
-    info.addNativeTypeMapping(Types.REAL, "FLOAT");
-    info.addNativeTypeMapping(Types.REF, "BLOB", Types.LONGVARBINARY);
-    info.addNativeTypeMapping(Types.STRUCT, "BLOB", Types.LONGVARBINARY);
-    info.addNativeTypeMapping(Types.TINYINT, "SMALLINT", Types.SMALLINT);
-    info.addNativeTypeMapping(Types.VARBINARY, "BLOB", Types.LONGVARBINARY);
-    info.addNativeTypeMapping("BOOLEAN", "SMALLINT", "SMALLINT");
-    info.addNativeTypeMapping("DATALINK", "BLOB", "LONGVARBINARY");
-
-    info.setDefaultSize(Types.CHAR, 254);
-    info.setDefaultSize(Types.VARCHAR, 254);
-    info.setHasSize(Types.BINARY, false);
-    info.setHasSize(Types.VARBINARY, false);
-
-    setSqlBuilder(new InterbaseBuilder(this));
-    setModelReader(new InterbaseModelReader(this));
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getName() {
-    return DATABASENAME;
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected void setStatementParameterValue(PreparedStatement statement, int sqlIndex,
-      int typeCode, Object value) throws SQLException {
-    if (value != null) {
-      if ((value instanceof byte[])
-          && ((typeCode == Types.BINARY) || (typeCode == Types.VARBINARY) || (typeCode == Types.BLOB))) {
-        byte[] bytes = (byte[]) value;
-        ByteArrayInputStream stream = new ByteArrayInputStream(bytes);
-
-        statement.setBinaryStream(sqlIndex, stream, bytes.length);
-        return;
-      } else if ((value instanceof String)
-          && ((typeCode == Types.CLOB) || (typeCode == Types.LONGVARCHAR))) {
-        // Clob is not supported directly
-        statement.setString(sqlIndex, (String) value);
-        return;
-      }
-    }
-    super.setStatementParameterValue(statement, sqlIndex, typeCode, value);
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected Object extractColumnValue(ResultSet resultSet, String columnName, int columnIdx,
-      int jdbcType) throws SQLException {
-    boolean useIdx = (columnName == null);
-
-    switch (jdbcType) {
-    case Types.BINARY:
-    case Types.VARBINARY:
-    case Types.BLOB:
-      try {
-        BufferedInputStream input = new BufferedInputStream(useIdx ? resultSet
-            .getBinaryStream(columnIdx) : resultSet.getBinaryStream(columnName));
-
-        if (resultSet.wasNull()) {
-          return null;
-        }
-
-        ByteArrayOutputStream buffer = new ByteArrayOutputStream(1024);
-        byte[] data = new byte[1024];
-        int numRead;
-
-        while ((numRead = input.read(data, 0, data.length)) != -1) {
-          buffer.write(data, 0, numRead);
-        }
-        input.close();
-        return buffer.toByteArray();
-      } catch (IOException ex) {
-        throw new DdlUtilsException(ex);
-      }
-    case Types.LONGVARCHAR:
-    case Types.CLOB:
-      String value = useIdx ? resultSet.getString(columnIdx) : resultSet.getString(columnName);
-
-      return resultSet.wasNull() ? null : value;
-    default:
-      return super.extractColumnValue(resultSet, columnName, columnIdx, jdbcType);
-    }
-  }
-
-}
--- a/src/org/apache/ddlutils/platform/interbase/package.html	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-<html>
-<head>
-<!-- 
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-   <meta name="Author" content="Thomas Dudziak">
-</head>
-<body bgcolor="white">
-  <p>
-  	This package contains the platform implementation for the
-    <a href="http://info.borland.com/techpubs/interbase/">Interbase</a> database.
-  </p>
-</body>
-</html>
--- a/src/org/apache/ddlutils/platform/maxdb/MaxDbBuilder.java	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-package org.apache.ddlutils.platform.maxdb;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.IOException;
-
-import org.apache.ddlutils.Platform;
-import org.apache.ddlutils.model.Column;
-import org.apache.ddlutils.model.Database;
-import org.apache.ddlutils.model.ForeignKey;
-import org.apache.ddlutils.model.Table;
-import org.apache.ddlutils.platform.sapdb.SapDbBuilder;
-
-/**
- * The SQL Builder for MaxDB.
- * 
- * @version $Revision: $
- */
-public class MaxDbBuilder extends SapDbBuilder {
-  /**
-   * Creates a new builder instance.
-   * 
-   * @param platform
-   *          The plaftform this builder belongs to
-   */
-  public MaxDbBuilder(Platform platform) {
-    super(platform);
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected void writeExternalPrimaryKeysCreateStmt(Table table, Column[] primaryKeyColumns)
-      throws IOException {
-    if ((primaryKeyColumns.length > 0) && shouldGeneratePrimaryKeys(primaryKeyColumns)) {
-      print("ALTER TABLE ");
-      printlnIdentifier(getStructureObjectName(table));
-      printIndent();
-      print("ADD CONSTRAINT ");
-      printIdentifier(getConstraintName(null, table, "PK", null));
-      print(" ");
-      writePrimaryKeyStmt(table, primaryKeyColumns);
-      printEndOfStatement();
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected void writeExternalForeignKeyCreateStmt(Database database, Table table, ForeignKey key)
-      throws IOException {
-    if (key.getForeignTableName() == null) {
-      _log.warn("Foreign key table is null for key " + key);
-    } else {
-      writeTableAlterStmt(table);
-
-      print("ADD CONSTRAINT ");
-      printIdentifier(getForeignKeyName(table, key));
-      print(" FOREIGN KEY (");
-      writeLocalReferences(key);
-      print(") REFERENCES ");
-      printIdentifier(getStructureObjectName(database.findTable(key.getForeignTableName())));
-      print(" (");
-      writeForeignReferences(key);
-      print(")");
-      printEndOfStatement();
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected void writeExternalForeignKeyDropStmt(Table table, ForeignKey foreignKey)
-      throws IOException {
-    writeTableAlterStmt(table);
-    print("DROP CONSTRAINT ");
-    printIdentifier(getForeignKeyName(table, foreignKey));
-    printEndOfStatement();
-  }
-}
--- a/src/org/apache/ddlutils/platform/maxdb/MaxDbModelReader.java	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-package org.apache.ddlutils.platform.maxdb;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.sql.SQLException;
-import java.sql.Types;
-import java.util.Map;
-
-import org.apache.ddlutils.Platform;
-import org.apache.ddlutils.model.Column;
-import org.apache.ddlutils.platform.DatabaseMetaDataWrapper;
-import org.apache.ddlutils.platform.JdbcModelReader;
-
-/**
- * Reads a database model from a MaxDb database.
- * 
- * @version $Revision: $
- */
-public class MaxDbModelReader extends JdbcModelReader {
-  /**
-   * Creates a new model reader for MaxDb databases.
-   * 
-   * @param platform
-   *          The platform that this model reader belongs to
-   */
-  public MaxDbModelReader(Platform platform) {
-    super(platform);
-    setDefaultCatalogPattern(null);
-    setDefaultSchemaPattern(null);
-    setDefaultTablePattern("%");
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected Column readColumn(DatabaseMetaDataWrapper metaData, Map values) throws SQLException {
-    Column column = super.readColumn(metaData, values);
-
-    if (column.getDefaultValue() != null) {
-      // SapDb pads the default value with spaces
-      column.setDefaultValue(column.getDefaultValue().trim());
-      // SapDb uses the default value for the auto-increment specification
-      if (column.getDefaultValue().startsWith("DEFAULT SERIAL")) {
-        column.setAutoIncrement(true);
-        column.setDefaultValue(null);
-      }
-    }
-    if (column.getTypeCode() == Types.DECIMAL) {
-      // For some reason, the size will be reported with 2 byte more, e.g.
-      // 17 instead of 15
-      // So we have to adjust the size here
-      if (column.getSizeAsInt() > 2) {
-        column.setSizeAndScale(column.getSizeAsInt() - 2, column.getScale());
-      }
-      // We also perform back-mapping to BIGINT
-      if ((column.getSizeAsInt() == 38) && (column.getScaleAsInt() == 0)) {
-        column.setTypeCode(Types.BIGINT);
-      }
-    }
-    return column;
-  }
-}
--- a/src/org/apache/ddlutils/platform/maxdb/MaxDbPlatform.java	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-package org.apache.ddlutils.platform.maxdb;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.ddlutils.platform.sapdb.SapDbPlatform;
-
-/**
- * The platform implementation for MaxDB. It is currently identical to the SapDB implementation as
- * there is no difference in the functionality we're using. Note that DdlUtils is currently not able
- * to distinguish them based on the jdbc driver or subprotocol as they are identical.
- * 
- * @version $Revision: 231306 $
- */
-public class MaxDbPlatform extends SapDbPlatform {
-  /** Database name of this platform. */
-  public static final String DATABASENAME = "MaxDB";
-
-  /**
-   * Creates a new platform instance.
-   */
-  public MaxDbPlatform() {
-    super();
-    setSqlBuilder(new MaxDbBuilder(this));
-    setModelReader(new MaxDbModelReader(this));
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getName() {
-    return DATABASENAME;
-  }
-}
--- a/src/org/apache/ddlutils/platform/maxdb/package.html	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-<html>
-<head>
-<!-- 
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-   <meta name="Author" content="Thomas Dudziak">
-</head>
-<body bgcolor="white">
-  <p>
-  	This package contains the platform implementation for the
-    <a href="http://www.mysql.com/products/maxdb/">MaxDB</a> database.
-  </p>
-</body>
-</html>
--- a/src/org/apache/ddlutils/platform/mckoi/MckoiBuilder.java	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,268 +0,0 @@
-package org.apache.ddlutils.platform.mckoi;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.ddlutils.Platform;
-import org.apache.ddlutils.alteration.AddColumnChange;
-import org.apache.ddlutils.alteration.ColumnAutoIncrementChange;
-import org.apache.ddlutils.alteration.RemoveColumnChange;
-import org.apache.ddlutils.alteration.TableChange;
-import org.apache.ddlutils.model.Column;
-import org.apache.ddlutils.model.Database;
-import org.apache.ddlutils.model.ModelException;
-import org.apache.ddlutils.model.Table;
-import org.apache.ddlutils.platform.SqlBuilder;
-
-/**
- * The SQL Builder for the Mckoi database.
- * 
- * @version $Revision: 463757 $
- */
-public class MckoiBuilder extends SqlBuilder {
-  /**
-   * Creates a new builder instance.
-   * 
-   * @param platform
-   *          The plaftform this builder belongs to
-   */
-  public MckoiBuilder(Platform platform) {
-    super(platform);
-    // we need to handle the backslash first otherwise the other
-    // already escaped sequence would be affected
-    addEscapedCharSequence("\\", "\\\\");
-    addEscapedCharSequence("'", "\\'");
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public void createTable(Database database, Table table, Map parameters) throws IOException {
-    // we use sequences instead of the UNIQUEKEY function because this way
-    // we can read their values back
-    Column[] columns = table.getAutoIncrementColumns();
-
-    for (int idx = 0; idx < columns.length; idx++) {
-      createAutoIncrementSequence(table, columns[idx]);
-    }
-
-    super.createTable(database, table, parameters);
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public void dropTable(Table table) throws IOException {
-    print("DROP TABLE IF EXISTS ");
-    printIdentifier(getStructureObjectName(table));
-    printEndOfStatement();
-
-    Column[] columns = table.getAutoIncrementColumns();
-
-    for (int idx = 0; idx < columns.length; idx++) {
-      dropAutoIncrementSequence(table, columns[idx]);
-    }
-  }
-
-  /**
-   * Creates the sequence necessary for the auto-increment of the given column.
-   * 
-   * @param table
-   *          The table
-   * @param column
-   *          The column
-   */
-  protected void createAutoIncrementSequence(Table table, Column column) throws IOException {
-    print("CREATE SEQUENCE ");
-    printIdentifier(getConstraintName("seq", table, column.getName(), null));
-    printEndOfStatement();
-  }
-
-  /**
-   * Drops the sequence used for the auto-increment of the given column.
-   * 
-   * @param table
-   *          The table
-   * @param column
-   *          The column
-   */
-  protected void dropAutoIncrementSequence(Table table, Column column) throws IOException {
-    print("DROP SEQUENCE ");
-    printIdentifier(getConstraintName("seq", table, column.getName(), null));
-    printEndOfStatement();
-  }
-
-  /**
-   * Outputs the DDL for the specified column.
-   * 
-   * @param table
-   *          The table containing the column
-   * @param column
-   *          The column
-   */
-  protected void writeColumn(Table table, Column column) throws IOException {
-    // see comments in columnsDiffer about null/"" defaults
-    printIdentifier(getColumnName(column));
-    print(" ");
-    print(getSqlType(column));
-    writeColumnDefaultValueStmt(table, column);
-    if (column.isRequired()) {
-      print(" ");
-      writeColumnNotNullableStmt();
-    } else if (getPlatformInfo().isNullAsDefaultValueRequired()
-        && getPlatformInfo().hasNullDefault(column.getTypeCode())) {
-      print(" ");
-      writeColumnNullableStmt();
-    }
-    if (column.isAutoIncrement()) {
-      if (!getPlatformInfo().isNonPKIdentityColumnsSupported() && !column.isPrimaryKey()) {
-        throw new ModelException(
-            "Column "
-                + column.getName()
-                + " in table "
-                + table.getName()
-                + " is auto-incrementing but not a primary key column, which is not supported by the platform");
-      }
-      print(" ");
-      writeColumnAutoIncrementStmt(table, column);
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected void writeColumnDefaultValueStmt(Table table, Column column) throws IOException {
-    if (column.isDefaultFunction()) {
-      print(" DEFAULT ");
-      print(getNativeFunction(column.getDefaultValue(), column.getTypeCode()));
-    } else {
-      Object parsedDefault = column.getParsedDefaultValue();
-      if (parsedDefault == null && column.isAutoIncrement()) {
-        print(" DEFAULT ");
-        writeColumnDefaultValue(table, column);
-      } else {
-        String value = getDefaultValue(column);
-        if (value != null) {
-          print(" DEFAULT ");
-          print(value);
-        }
-      }
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected void writeColumnDefaultValue(Table table, Column column) throws IOException {
-    if (column.isAutoIncrement()) {
-      // we start at value 1 to avoid issues with jdbc
-      print("NEXTVAL('");
-      print(getConstraintName("seq", table, column.getName(), null));
-      print("')");
-    } else {
-      print(getDefaultValue(getNativeDefaultValue(column), column.getTypeCode()));
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getSelectLastIdentityValues(Table table) {
-    Column[] columns = table.getAutoIncrementColumns();
-
-    if (columns.length > 0) {
-      StringBuffer result = new StringBuffer();
-
-      result.append("SELECT ");
-      for (int idx = 0; idx < columns.length; idx++) {
-        if (idx > 0) {
-          result.append(",");
-        }
-        result.append("CURRVAL('");
-        result.append(getConstraintName("seq", table, columns[idx].getName(), null));
-        result.append("')");
-      }
-      return result.toString();
-    } else {
-      return null;
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected void processTableStructureChanges(Database currentModel, Database desiredModel,
-      Table sourceTable, Table targetTable, Map parameters, List changes) throws IOException {
-    // McKoi has this nice ALTER CREATE TABLE statement which saves us a lot
-    // of work
-    // We only have to handle auto-increment changes manually
-    for (Iterator it = changes.iterator(); it.hasNext();) {
-      TableChange change = (TableChange) it.next();
-
-      if (change instanceof ColumnAutoIncrementChange) {
-        Column column = ((ColumnAutoIncrementChange) change).getColumn();
-
-        // we have to defer removal of the sequences until they are no
-        // longer used
-        if (!column.isAutoIncrement()) {
-          ColumnAutoIncrementChange autoIncrChange = (ColumnAutoIncrementChange) change;
-
-          createAutoIncrementSequence(autoIncrChange.getChangedTable(), autoIncrChange.getColumn());
-        }
-      } else if (change instanceof AddColumnChange) {
-        AddColumnChange addColumnChange = (AddColumnChange) change;
-
-        if (addColumnChange.getNewColumn().isAutoIncrement()) {
-          createAutoIncrementSequence(addColumnChange.getChangedTable(), addColumnChange
-              .getNewColumn());
-        }
-      }
-    }
-
-    print("ALTER ");
-    super.createTable(desiredModel, targetTable, parameters);
-
-    for (Iterator it = changes.iterator(); it.hasNext();) {
-      TableChange change = (TableChange) it.next();
-
-      if (change instanceof ColumnAutoIncrementChange) {
-        Column column = ((ColumnAutoIncrementChange) change).getColumn();
-
-        if (column.isAutoIncrement()) {
-          ColumnAutoIncrementChange autoIncrChange = (ColumnAutoIncrementChange) change;
-
-          dropAutoIncrementSequence(autoIncrChange.getChangedTable(), autoIncrChange.getColumn());
-        }
-      } else if (change instanceof RemoveColumnChange) {
-        RemoveColumnChange removeColumnChange = (RemoveColumnChange) change;
-
-        if (removeColumnChange.getColumn().isAutoIncrement()) {
-          dropAutoIncrementSequence(removeColumnChange.getChangedTable(), removeColumnChange
-              .getColumn());
-        }
-      }
-    }
-    changes.clear();
-  }
-}
--- a/src/org/apache/ddlutils/platform/mckoi/MckoiModelReader.java	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +0,0 @@
-package org.apache.ddlutils.platform.mckoi;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.commons.collections.map.ListOrderedMap;
-import org.apache.ddlutils.Platform;
-import org.apache.ddlutils.model.Column;
-import org.apache.ddlutils.model.Table;
-import org.apache.ddlutils.model.TypeMap;
-import org.apache.ddlutils.platform.DatabaseMetaDataWrapper;
-import org.apache.ddlutils.platform.JdbcModelReader;
-
-/**
- * Reads a database model from a Mckoi database.
- * 
- * @version $Revision: $
- */
-public class MckoiModelReader extends JdbcModelReader {
-  /**
-   * Creates a new model reader for Mckoi databases.
-   * 
-   * @param platform
-   *          The platform that this model reader belongs to
-   */
-  public MckoiModelReader(Platform platform) {
-    super(platform);
-    setDefaultCatalogPattern(null);
-    setDefaultSchemaPattern(null);
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected Table readTable(DatabaseMetaDataWrapper metaData, Map values) throws SQLException {
-    Table table = super.readTable(metaData, values);
-
-    if (table != null) {
-      // Mckoi does not currently return unique indices in the metadata so
-      // we have to query
-      // internal tables to get this info
-      StringBuffer query = new StringBuffer();
-
-      query.append("SELECT uniqueColumns.column, uniqueColumns.seq_no, uniqueInfo.name");
-      query
-          .append(" FROM SYS_INFO.sUSRUniqueColumns uniqueColumns, SYS_INFO.sUSRUniqueInfo uniqueInfo");
-      query.append(" WHERE uniqueColumns.un_id = uniqueInfo.id AND uniqueInfo.table = '");
-      query.append(table.getName());
-      if (table.getSchema() != null) {
-        query.append("' AND uniqueInfo.schema = '");
-        query.append(table.getSchema());
-      }
-      query.append("'");
-
-      Statement stmt = getConnection().createStatement();
-      ResultSet resultSet = stmt.executeQuery(query.toString());
-      Map indices = new ListOrderedMap();
-      Map indexValues = new HashMap();
-
-      indexValues.put("NON_UNIQUE", Boolean.FALSE);
-      while (resultSet.next()) {
-        indexValues.put("COLUMN_NAME", resultSet.getString(1));
-        indexValues.put("ORDINAL_POSITION", new Short(resultSet.getShort(2)));
-        indexValues.put("INDEX_NAME", resultSet.getString(3));
-
-        readIndex(metaData, indexValues, indices);
-      }
-      resultSet.close();
-
-      table.addIndices(indices.values());
-    }
-
-    return table;
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected Column readColumn(DatabaseMetaDataWrapper metaData, Map values) throws SQLException {
-    Column column = super.readColumn(metaData, values);
-
-    if (column.getSize() != null) {
-      if (column.getSizeAsInt() <= 0) {
-        column.setSize(null);
-      }
-    }
-
-    String defaultValue = column.getDefaultValue();
-
-    if (defaultValue != null) {
-      if (defaultValue.toLowerCase().startsWith("nextval('")
-          || defaultValue.toLowerCase().startsWith("uniquekey('")) {
-        column.setDefaultValue(null);
-        column.setAutoIncrement(true);
-      } else if (TypeMap.isTextType(column.getTypeCode())) {
-        column.setDefaultValue(unescape(column.getDefaultValue(), "'", "\\'"));
-      }
-    }
-    return column;
-  }
-}
--- a/src/org/apache/ddlutils/platform/mckoi/MckoiPlatform.java	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,138 +0,0 @@
-package org.apache.ddlutils.platform.mckoi;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.SQLException;
-import java.sql.Types;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.apache.ddlutils.DatabaseOperationException;
-import org.apache.ddlutils.PlatformInfo;
-import org.apache.ddlutils.platform.PlatformImplBase;
-
-/**
- * The Mckoi database platform implementation.
- * 
- * @version $Revision: 231306 $
- */
-public class MckoiPlatform extends PlatformImplBase {
-  /** Database name of this platform. */
-  public static final String DATABASENAME = "McKoi";
-  /** The standard McKoi jdbc driver. */
-  public static final String JDBC_DRIVER = "com.mckoi.JDBCDriver";
-  /** The subprotocol used by the standard McKoi driver. */
-  public static final String JDBC_SUBPROTOCOL = "mckoi";
-
-  /**
-   * Creates a new platform instance.
-   */
-  public MckoiPlatform() {
-    PlatformInfo info = getPlatformInfo();
-
-    info.setIndicesSupported(false);
-    info.setIndicesEmbedded(true);
-    info.setAutoCommitModeForLastIdentityValueReading(false);
-
-    info.addNativeTypeMapping(Types.ARRAY, "BLOB", Types.BLOB);
-    info.addNativeTypeMapping(Types.DISTINCT, "BLOB", Types.BLOB);
-    info.addNativeTypeMapping(Types.FLOAT, "DOUBLE", Types.DOUBLE);
-    info.addNativeTypeMapping(Types.NULL, "BLOB", Types.BLOB);
-    info.addNativeTypeMapping(Types.OTHER, "BLOB", Types.BLOB);
-    info.addNativeTypeMapping(Types.REF, "BLOB", Types.BLOB);
-    info.addNativeTypeMapping(Types.STRUCT, "BLOB", Types.BLOB);
-    info.addNativeTypeMapping("BIT", "BOOLEAN", "BOOLEAN");
-    info.addNativeTypeMapping("DATALINK", "BLOB", "BLOB");
-
-    info.setDefaultSize(Types.CHAR, 1024);
-    info.setDefaultSize(Types.VARCHAR, 1024);
-    info.setDefaultSize(Types.BINARY, 1024);
-    info.setDefaultSize(Types.VARBINARY, 1024);
-
-    setSqlBuilder(new MckoiBuilder(this));
-    setModelReader(new MckoiModelReader(this));
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getName() {
-    return DATABASENAME;
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public void createDatabase(String jdbcDriverClassName, String connectionUrl, String username,
-      String password, Map parameters) throws DatabaseOperationException,
-      UnsupportedOperationException {
-    // For McKoi, you create databases by simply appending "?create=true" to
-    // the connection url
-    if (JDBC_DRIVER.equals(jdbcDriverClassName)) {
-      StringBuffer creationUrl = new StringBuffer();
-      Connection connection = null;
-
-      creationUrl.append(connectionUrl);
-      // TODO: It might be safer to parse the URN and check whethere there
-      // is already a parameter there
-      // (in which case e'd have to use '&' instead)
-      creationUrl.append("?create=true");
-      if ((parameters != null) && !parameters.isEmpty()) {
-        for (Iterator it = parameters.entrySet().iterator(); it.hasNext();) {
-          Map.Entry entry = (Map.Entry) it.next();
-
-          // no need to specify create twice (and create=false
-          // wouldn't help anyway)
-          if (!"create".equalsIgnoreCase(entry.getKey().toString())) {
-            creationUrl.append("&");
-            creationUrl.append(entry.getKey().toString());
-            creationUrl.append("=");
-            if (entry.getValue() != null) {
-              creationUrl.append(entry.getValue().toString());
-            }
-          }
-        }
-      }
-      if (getLog().isDebugEnabled()) {
-        getLog().debug("About to create database using this URL: " + creationUrl.toString());
-      }
-      try {
-        Class.forName(jdbcDriverClassName);
-
-        connection = DriverManager.getConnection(creationUrl.toString(), username, password);
-        logWarnings(connection);
-      } catch (Exception ex) {
-        throw new DatabaseOperationException("Error while trying to create a database", ex);
-      } finally {
-        if (connection != null) {
-          try {
-            connection.close();
-          } catch (SQLException ex) {
-          }
-        }
-      }
-    } else {
-      throw new UnsupportedOperationException("Unable to create a Derby database via the driver "
-          + jdbcDriverClassName);
-    }
-  }
-}
--- a/src/org/apache/ddlutils/platform/mckoi/package.html	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-<html>
-<head>
-<!-- 
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-   <meta name="Author" content="Thomas Dudziak">
-</head>
-<body bgcolor="white">
-  <p>
-  	This package contains the platform implementation for the
-    <a href="http://www.mckoi.com/database/">Mckoi</a> database.
-  </p>
-</body>
-</html>
--- a/src/org/apache/ddlutils/platform/mssql/MSSqlBuilder.java	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,705 +0,0 @@
-package org.apache.ddlutils.platform.mssql;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.IOException;
-import java.sql.Types;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.ddlutils.Platform;
-import org.apache.ddlutils.alteration.AddColumnChange;
-import org.apache.ddlutils.alteration.AddForeignKeyChange;
-import org.apache.ddlutils.alteration.AddIndexChange;
-import org.apache.ddlutils.alteration.AddPrimaryKeyChange;
-import org.apache.ddlutils.alteration.ColumnAutoIncrementChange;
-import org.apache.ddlutils.alteration.ColumnChange;
-import org.apache.ddlutils.alteration.ColumnDataTypeChange;
-import org.apache.ddlutils.alteration.ColumnSizeChange;
-import org.apache.ddlutils.alteration.PrimaryKeyChange;
-import org.apache.ddlutils.alteration.RemoveColumnChange;
-import org.apache.ddlutils.alteration.RemoveForeignKeyChange;
-import org.apache.ddlutils.alteration.RemoveIndexChange;
-import org.apache.ddlutils.alteration.RemovePrimaryKeyChange;
-import org.apache.ddlutils.alteration.TableChange;
-import org.apache.ddlutils.model.Column;
-import org.apache.ddlutils.model.Database;
-import org.apache.ddlutils.model.ForeignKey;
-import org.apache.ddlutils.model.Index;
-import org.apache.ddlutils.model.Table;
-import org.apache.ddlutils.model.ValueObject;
-import org.apache.ddlutils.platform.CreationParameters;
-import org.apache.ddlutils.platform.SqlBuilder;
-import org.apache.ddlutils.util.Jdbc3Utils;
-
-/**
- * The SQL Builder for the Microsoft SQL Server.
- * 
- * @version $Revision: 504014 $
- */
-public class MSSqlBuilder extends SqlBuilder {
-  /** We use a generic date format. */
-  private DateFormat _genericDateFormat = new SimpleDateFormat("yyyy-MM-dd");
-  /** We use a generic date format. */
-  private DateFormat _genericTimeFormat = new SimpleDateFormat("HH:mm:ss");
-
-  /**
-   * Creates a new builder instance.
-   * 
-   * @param platform
-   *          The plaftform this builder belongs to
-   */
-  public MSSqlBuilder(Platform platform) {
-    super(platform);
-    addEscapedCharSequence("'", "''");
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public void createTable(Database database, Table table, Map parameters) throws IOException {
-    writeQuotationOnStatement();
-    super.createTable(database, table, parameters);
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public void dropTable(Table table) throws IOException {
-    String tableName = getStructureObjectName(table);
-    String tableNameVar = "tn" + createUniqueIdentifier();
-    String constraintNameVar = "cn" + createUniqueIdentifier();
-
-    writeQuotationOnStatement();
-    print("IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = ");
-    printAlwaysSingleQuotedIdentifier(tableName);
-    println(")");
-    println("BEGIN");
-    println("  DECLARE @" + tableNameVar + " nvarchar(256), @" + constraintNameVar
-        + " nvarchar(256)");
-    println("  DECLARE refcursor CURSOR FOR");
-    println("  SELECT object_name(objs.parent_obj) tablename, objs.name constraintname");
-    println("    FROM sysobjects objs JOIN sysconstraints cons ON objs.id = cons.constid");
-    print("    WHERE objs.xtype != 'PK' AND object_name(objs.parent_obj) = ");
-    printAlwaysSingleQuotedIdentifier(tableName);
-    println("  OPEN refcursor");
-    println("  FETCH NEXT FROM refcursor INTO @" + tableNameVar + ", @" + constraintNameVar);
-    println("  WHILE @@FETCH_STATUS = 0");
-    println("    BEGIN");
-    println("      EXEC ('ALTER TABLE '+@" + tableNameVar + "+' DROP CONSTRAINT '+@"
-        + constraintNameVar + ")");
-    println("      FETCH NEXT FROM refcursor INTO @" + tableNameVar + ", @" + constraintNameVar);
-    println("    END");
-    println("  CLOSE refcursor");
-    println("  DEALLOCATE refcursor");
-    print("  DROP TABLE ");
-    printlnIdentifier(tableName);
-    print("END");
-    printEndOfStatement();
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public void dropExternalForeignKeys(Table table) throws IOException {
-    writeQuotationOnStatement();
-    super.dropExternalForeignKeys(table);
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected DateFormat getValueDateFormat() {
-    return _genericDateFormat;
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected DateFormat getValueTimeFormat() {
-    return _genericTimeFormat;
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected String getValueAsString(Column column, Object value) {
-    if (value == null) {
-      return "NULL";
-    }
-
-    StringBuffer result = new StringBuffer();
-
-    switch (column.getTypeCode()) {
-    case Types.REAL:
-    case Types.NUMERIC:
-    case Types.FLOAT:
-    case Types.DOUBLE:
-    case Types.DECIMAL:
-      // SQL Server does not want quotes around the value
-      if (!(value instanceof String) && (getValueNumberFormat() != null)) {
-        result.append(getValueNumberFormat().format(value));
-      } else {
-        result.append(value.toString());
-      }
-      break;
-    case Types.DATE:
-      result.append("CAST(");
-      result.append(getPlatformInfo().getValueQuoteToken());
-      result.append(value instanceof String ? (String) value : getValueDateFormat().format(value));
-      result.append(getPlatformInfo().getValueQuoteToken());
-      result.append(" AS datetime)");
-      break;
-    case Types.TIME:
-      result.append("CAST(");
-      result.append(getPlatformInfo().getValueQuoteToken());
-      result.append(value instanceof String ? (String) value : getValueTimeFormat().format(value));
-      result.append(getPlatformInfo().getValueQuoteToken());
-      result.append(" AS datetime)");
-      break;
-    case Types.TIMESTAMP:
-      result.append("CAST(");
-      result.append(getPlatformInfo().getValueQuoteToken());
-      result.append(value.toString());
-      result.append(getPlatformInfo().getValueQuoteToken());
-      result.append(" AS datetime)");
-      break;
-    }
-    return super.getValueAsString(column, value);
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected String getNativeDefaultValue(ValueObject column) {
-    // Sql Server wants BIT default values as 0 or 1
-    if ((column.getTypeCode() == Types.BIT)
-        || (Jdbc3Utils.supportsJava14JdbcTypes() && (column.getTypeCode() == Jdbc3Utils
-            .determineBooleanTypeCode()))) {
-      return getDefaultValueHelper().convert(column.getDefaultValue(), column.getTypeCode(),
-          Types.SMALLINT).toString();
-    } else {
-      return super.getNativeDefaultValue(column);
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected void writeColumnAutoIncrementStmt(Table table, Column column) throws IOException {
-    print("IDENTITY (1,1) ");
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public void writeExternalIndexDropStmt(Table table, Index index) throws IOException {
-    print("DROP INDEX ");
-    printIdentifier(getStructureObjectName(table));
-    print(".");
-    printIdentifier(getConstraintObjectName(index));
-    printEndOfStatement();
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected void writeExternalForeignKeyDropStmt(Table table, ForeignKey foreignKey)
-      throws IOException {
-    String constraintName = getForeignKeyName(table, foreignKey);
-
-    print("IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'F' AND name = ");
-    printAlwaysSingleQuotedIdentifier(constraintName);
-    println(")");
-    printIndent();
-    print("ALTER TABLE ");
-    printIdentifier(getStructureObjectName(table));
-    print(" DROP CONSTRAINT ");
-    printIdentifier(constraintName);
-    printEndOfStatement();
-  }
-
-  /**
-   * Returns the statement that turns on the ability to write delimited identifiers.
-   * 
-   * @return The quotation-on statement
-   */
-  private String getQuotationOnStatement() {
-    if (getPlatform().isDelimitedIdentifierModeOn()) {
-      return "SET quoted_identifier on" + getPlatformInfo().getSqlCommandDelimiter() + "\n";
-    } else {
-      return "";
-    }
-  }
-
-  /**
-   * Writes the statement that turns on the ability to write delimited identifiers.
-   */
-  private void writeQuotationOnStatement() throws IOException {
-    print(getQuotationOnStatement());
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getSelectLastIdentityValues(Table table) {
-    return "SELECT @@IDENTITY";
-  }
-
-  /**
-   * Returns the SQL to enable identity override mode.
-   * 
-   * @param table
-   *          The table to enable the mode for
-   * @return The SQL
-   */
-  protected String getEnableIdentityOverrideSql(Table table) {
-    StringBuffer result = new StringBuffer();
-
-    result.append(getQuotationOnStatement());
-    result.append("SET IDENTITY_INSERT ");
-    result.append(getDelimitedIdentifier(getStructureObjectName(table)));
-    result.append(" ON");
-    result.append(getPlatformInfo().getSqlCommandDelimiter());
-
-    return result.toString();
-  }
-
-  /**
-   * Returns the SQL to disable identity override mode.
-   * 
-   * @param table
-   *          The table to disable the mode for
-   * @return The SQL
-   */
-  protected String getDisableIdentityOverrideSql(Table table) {
-    StringBuffer result = new StringBuffer();
-
-    result.append(getQuotationOnStatement());
-    result.append("SET IDENTITY_INSERT ");
-    result.append(getDelimitedIdentifier(getStructureObjectName(table)));
-    result.append(" OFF");
-    result.append(getPlatformInfo().getSqlCommandDelimiter());
-
-    return result.toString();
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getDeleteSql(Table table, Map pkValues, boolean genPlaceholders) {
-    return getQuotationOnStatement() + super.getDeleteSql(table, pkValues, genPlaceholders);
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getInsertSql(Table table, Map columnValues, boolean genPlaceholders) {
-    return getQuotationOnStatement() + super.getInsertSql(table, columnValues, genPlaceholders);
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getUpdateSql(Table table, Map columnValues, boolean genPlaceholders) {
-    return getQuotationOnStatement() + super.getUpdateSql(table, columnValues, genPlaceholders);
-  }
-
-  /**
-   * Prints the given identifier with enforced single quotes around it regardless of whether
-   * delimited identifiers are turned on or not.
-   * 
-   * @param identifier
-   *          The identifier
-   */
-  private void printAlwaysSingleQuotedIdentifier(String identifier) throws IOException {
-    print("'");
-    print(identifier);
-    print("'");
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected void writeCopyDataStatement(Table sourceTable, Table targetTable) throws IOException {
-    // Sql Server per default does not allow us to insert values explicitly
-    // into
-    // identity columns. However, we can change this behavior
-    boolean hasIdentityColumns = targetTable.getAutoIncrementColumns().length > 0;
-
-    if (hasIdentityColumns) {
-      print("SET IDENTITY_INSERT ");
-      printIdentifier(getStructureObjectName(targetTable));
-      print(" ON");
-      printEndOfStatement();
-    }
-    super.writeCopyDataStatement(sourceTable, targetTable);
-    // We have to turn it off ASAP because it can be on only for one table
-    // per session
-    if (hasIdentityColumns) {
-      print("SET IDENTITY_INSERT ");
-      printIdentifier(getStructureObjectName(targetTable));
-      print(" OFF");
-      printEndOfStatement();
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected void processChanges(Database currentModel, Database desiredModel, List changes,
-      CreationParameters params) throws IOException {
-    if (!changes.isEmpty()) {
-      writeQuotationOnStatement();
-    }
-    // For column data type and size changes, we need to drop and then
-    // re-create indexes
-    // and foreign keys using the column, as well as any primary keys
-    // containg
-    // these columns
-    // However, if the index/foreign key/primary key is already slated for
-    // removal or
-    // change, then we don't want to generate change duplication
-    HashSet removedIndexes = new HashSet();
-    HashSet removedForeignKeys = new HashSet();
-    HashSet removedPKs = new HashSet();
-
-    for (Iterator changeIt = changes.iterator(); changeIt.hasNext();) {
-      Object change = changeIt.next();
-
-      if (change instanceof RemoveIndexChange) {
-        removedIndexes.add(((RemoveIndexChange) change).getIndex());
-      } else if (change instanceof RemoveForeignKeyChange) {
-        removedForeignKeys.add(((RemoveForeignKeyChange) change).getForeignKey());
-      } else if (change instanceof RemovePrimaryKeyChange) {
-        removedPKs.add(((RemovePrimaryKeyChange) change).getChangedTable());
-      }
-    }
-
-    ArrayList additionalChanges = new ArrayList();
-
-    for (Iterator changeIt = changes.iterator(); changeIt.hasNext();) {
-      Object change = changeIt.next();
-
-      if ((change instanceof ColumnDataTypeChange) || (change instanceof ColumnSizeChange)) {
-        Column column = ((ColumnChange) change).getChangedColumn();
-        Table table = ((ColumnChange) change).getChangedTable();
-
-        if (column.isPrimaryKey() && !removedPKs.contains(table)) {
-          Column[] pk = table.getPrimaryKeyColumns();
-
-          additionalChanges.add(new RemovePrimaryKeyChange(table, pk));
-          additionalChanges.add(new AddPrimaryKeyChange(table, table.getPrimaryKey(), pk));
-          removedPKs.add(table);
-        }
-        for (int idx = 0; idx < table.getIndexCount(); idx++) {
-          Index index = table.getIndex(idx);
-
-          if (index.hasColumn(column) && !removedIndexes.contains(index)) {
-            additionalChanges.add(new RemoveIndexChange(table, index));
-            additionalChanges.add(new AddIndexChange(table, index));
-            removedIndexes.add(index);
-          }
-        }
-        for (int tableIdx = 0; tableIdx < currentModel.getTableCount(); tableIdx++) {
-          Table curTable = currentModel.getTable(tableIdx);
-
-          for (int fkIdx = 0; fkIdx < curTable.getForeignKeyCount(); fkIdx++) {
-            ForeignKey curFk = curTable.getForeignKey(fkIdx);
-
-            if ((curFk.hasLocalColumn(column) || curFk.hasForeignColumn(column))
-                && !removedForeignKeys.contains(curFk)) {
-              additionalChanges.add(new RemoveForeignKeyChange(curTable, curFk));
-              additionalChanges.add(new AddForeignKeyChange(curTable, curFk));
-              removedForeignKeys.add(curFk);
-            }
-          }
-        }
-      }
-    }
-    changes.addAll(additionalChanges);
-    super.processChanges(currentModel, desiredModel, changes, params, true);
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected void processTableStructureChanges(Database currentModel, Database desiredModel,
-      Table sourceTable, Table targetTable, Map parameters, List changes) throws IOException {
-    // First we drop primary keys as necessary
-    for (Iterator changeIt = changes.iterator(); changeIt.hasNext();) {
-      TableChange change = (TableChange) changeIt.next();
-
-      if (change instanceof RemovePrimaryKeyChange) {
-        processChange(currentModel, desiredModel, (RemovePrimaryKeyChange) change);
-        changeIt.remove();
-      } else if (change instanceof PrimaryKeyChange) {
-        PrimaryKeyChange pkChange = (PrimaryKeyChange) change;
-        RemovePrimaryKeyChange removePkChange = new RemovePrimaryKeyChange(
-            pkChange.getChangedTable(), pkChange.getOldPrimaryKeyColumns());
-
-        processChange(currentModel, desiredModel, removePkChange);
-      }
-    }
-
-    ArrayList columnChanges = new ArrayList();
-
-    // Next we add/remove columns
-    for (Iterator changeIt = changes.iterator(); changeIt.hasNext();) {
-      TableChange change = (TableChange) changeIt.next();
-
-      if (change instanceof AddColumnChange) {
-        AddColumnChange addColumnChange = (AddColumnChange) change;
-
-        // Sql Server can only add not insert columns
-        if (addColumnChange.isAtEnd()) {
-          processChange(currentModel, desiredModel, addColumnChange);
-          changeIt.remove();
-        }
-      } else if (change instanceof RemoveColumnChange) {
-        processChange(currentModel, desiredModel, (RemoveColumnChange) change);
-        changeIt.remove();
-      } else if (change instanceof ColumnAutoIncrementChange) {
-        // Sql Server has no way of adding or removing an IDENTITY
-        // constraint
-        // Thus we have to rebuild the table anyway and can ignore all
-        // the other
-        // column changes
-        columnChanges = null;
-      } else if ((change instanceof ColumnChange) && (columnChanges != null)) {
-        // we gather all changed columns because we can use the ALTER
-        // TABLE ALTER COLUMN
-        // statement for them
-        columnChanges.add(change);
-      }
-    }
-    if (columnChanges != null) {
-      HashSet processedColumns = new HashSet();
-
-      for (Iterator changeIt = columnChanges.iterator(); changeIt.hasNext();) {
-        ColumnChange change = (ColumnChange) changeIt.next();
-        Column sourceColumn = change.getChangedColumn();
-        Column targetColumn = targetTable.findColumn(sourceColumn.getName(), getPlatform()
-            .isDelimitedIdentifierModeOn());
-
-        if (!processedColumns.contains(targetColumn)) {
-          processColumnChange(sourceTable, targetTable, sourceColumn, targetColumn,
-              (change instanceof ColumnDataTypeChange) || (change instanceof ColumnSizeChange));
-          processedColumns.add(targetColumn);
-        }
-        changes.remove(change);
-        change.apply(currentModel, getPlatform().isDelimitedIdentifierModeOn());
-      }
-    }
-    // Finally we add primary keys
-    for (Iterator changeIt = changes.iterator(); changeIt.hasNext();) {
-      TableChange change = (TableChange) changeIt.next();
-
-      if (change instanceof AddPrimaryKeyChange) {
-        processChange(currentModel, desiredModel, (AddPrimaryKeyChange) change);
-        changeIt.remove();
-      } else if (change instanceof PrimaryKeyChange) {
-        PrimaryKeyChange pkChange = (PrimaryKeyChange) change;
-        AddPrimaryKeyChange addPkChange = new AddPrimaryKeyChange(pkChange.getChangedTable(),
-            pkChange.getNewName(), pkChange.getNewPrimaryKeyColumns());
-
-        processChange(currentModel, desiredModel, addPkChange);
-        changeIt.remove();
-      }
-    }
-  }
-
-  /**
-   * Processes the addition of a column to a table.
-   * 
-   * @param currentModel
-   *          The current database schema
-   * @param desiredModel
-   *          The desired database schema
-   * @param change
-   *          The change object
-   */
-  protected void processChange(Database currentModel, Database desiredModel, AddColumnChange change)
-      throws IOException {
-    print("ALTER TABLE ");
-    printlnIdentifier(getStructureObjectName(change.getChangedTable()));
-    printIndent();
-    print("ADD ");
-    writeColumn(change.getChangedTable(), change.getNewColumn());
-    printEndOfStatement();
-    change.apply(currentModel, getPlatform().isDelimitedIdentifierModeOn());
-  }
-
-  /**
-   * Processes the removal of a column from a table.
-   * 
-   * @param currentModel
-   *          The current database schema
-   * @param desiredModel
-   *          The desired database schema
-   * @param change
-   *          The change object
-   */
-  protected void processChange(Database currentModel, Database desiredModel,
-      RemoveColumnChange change) throws IOException {
-    print("ALTER TABLE ");
-    printlnIdentifier(getStructureObjectName(change.getChangedTable()));
-    printIndent();
-    print("DROP COLUMN ");
-    printIdentifier(getColumnName(change.getColumn()));
-    printEndOfStatement();
-    change.apply(currentModel, getPlatform().isDelimitedIdentifierModeOn());
-  }
-
-  /**
-   * Processes the removal of a primary key from a table.
-   * 
-   * @param currentModel
-   *          The current database schema
-   * @param desiredModel
-   *          The desired database schema
-   * @param change
-   *          The change object
-   */
-  protected void processChange(Database currentModel, Database desiredModel,
-      RemovePrimaryKeyChange change) throws IOException {
-    // TODO: this would be easier when named primary keys are supported
-    // because then we can use ALTER TABLE DROP
-    String tableName = getStructureObjectName(change.getChangedTable());
-    String tableNameVar = "tn" + createUniqueIdentifier();
-    String constraintNameVar = "cn" + createUniqueIdentifier();
-
-    println("BEGIN");
-    println("  DECLARE @" + tableNameVar + " nvarchar(256), @" + constraintNameVar
-        + " nvarchar(256)");
-    println("  DECLARE refcursor CURSOR FOR");
-    println("  SELECT object_name(objs.parent_obj) tablename, objs.name constraintname");
-    println("    FROM sysobjects objs JOIN sysconstraints cons ON objs.id = cons.constid");
-    print("    WHERE objs.xtype = 'PK' AND object_name(objs.parent_obj) = ");
-    printAlwaysSingleQuotedIdentifier(tableName);
-    println("  OPEN refcursor");
-    println("  FETCH NEXT FROM refcursor INTO @" + tableNameVar + ", @" + constraintNameVar);
-    println("  WHILE @@FETCH_STATUS = 0");
-    println("    BEGIN");
-    println("      EXEC ('ALTER TABLE '+@" + tableNameVar + "+' DROP CONSTRAINT '+@"
-        + constraintNameVar + ")");
-    println("      FETCH NEXT FROM refcursor INTO @" + tableNameVar + ", @" + constraintNameVar);
-    println("    END");
-    println("  CLOSE refcursor");
-    println("  DEALLOCATE refcursor");
-    print("END");
-    printEndOfStatement();
-    change.apply(currentModel, getPlatform().isDelimitedIdentifierModeOn());
-  }
-
-  /**
-   * Processes a change to a column.
-   * 
-   * @param sourceTable
-   *          The current table
-   * @param targetTable
-   *          The desired table
-   * @param sourceColumn
-   *          The current column
-   * @param targetColumn
-   *          The desired column
-   * @param typeChange
-   *          Whether this is a type change
-   */
-  protected void processColumnChange(Table sourceTable, Table targetTable, Column sourceColumn,
-      Column targetColumn, boolean typeChange) throws IOException {
-    boolean hasDefault = sourceColumn.getParsedDefaultValue() != null;
-    boolean shallHaveDefault = targetColumn.getParsedDefaultValue() != null;
-    String newDefault = targetColumn.getDefaultValue();
-
-    // Sql Server does not like it if there is a default spec in the ALTER
-    // TABLE ALTER COLUMN
-    // statement; thus we have to change the default manually
-    if (newDefault != null) {
-      targetColumn.setDefaultValue(null);
-    }
-    if (hasDefault) {
-      // we're dropping the old default
-      String tableName = getStructureObjectName(sourceTable);
-      String columnName = getColumnName(sourceColumn);
-      String tableNameVar = "tn" + createUniqueIdentifier();
-      String constraintNameVar = "cn" + createUniqueIdentifier();
-
-      println("BEGIN");
-      println("  DECLARE @" + tableNameVar + " nvarchar(256), @" + constraintNameVar
-          + " nvarchar(256)");
-      println("  DECLARE refcursor CURSOR FOR");
-      println("  SELECT object_name(objs.parent_obj) tablename, objs.name constraintname");
-      println("    FROM sysobjects objs JOIN sysconstraints cons ON objs.id = cons.constid");
-      println("    WHERE objs.xtype = 'D' AND");
-      print("          cons.colid = (SELECT colid FROM syscolumns WHERE id = object_id(");
-      printAlwaysSingleQuotedIdentifier(tableName);
-      print(") AND name = ");
-      printAlwaysSingleQuotedIdentifier(columnName);
-      println(") AND");
-      print("          object_name(objs.parent_obj) = ");
-      printAlwaysSingleQuotedIdentifier(tableName);
-      println("  OPEN refcursor");
-      println("  FETCH NEXT FROM refcursor INTO @" + tableNameVar + ", @" + constraintNameVar);
-      println("  WHILE @@FETCH_STATUS = 0");
-      println("    BEGIN");
-      println("      EXEC ('ALTER TABLE '+@" + tableNameVar + "+' DROP CONSTRAINT '+@"
-          + constraintNameVar + ")");
-      println("      FETCH NEXT FROM refcursor INTO @" + tableNameVar + ", @" + constraintNameVar);
-      println("    END");
-      println("  CLOSE refcursor");
-      println("  DEALLOCATE refcursor");
-      print("END");
-      printEndOfStatement();
-    }
-
-    print("ALTER TABLE ");
-    printlnIdentifier(getStructureObjectName(sourceTable));
-    printIndent();
-    print("ALTER COLUMN ");
-    writeColumn(sourceTable, targetColumn);
-    printEndOfStatement();
-
-    if (shallHaveDefault) {
-      targetColumn.setDefaultValue(newDefault);
-
-      // if the column shall have a default, then we have to add it as a
-      // constraint
-      print("ALTER TABLE ");
-      printlnIdentifier(getStructureObjectName(sourceTable));
-      printIndent();
-      print("ADD CONSTRAINT ");
-      printIdentifier(getConstraintName("DF", sourceTable, sourceColumn.getName(), null));
-      String value = getDefaultValue(targetColumn);
-      if (value != null) {
-        print(" DEFAULT ");
-        print(value);
-      }
-      print(" FOR ");
-      printIdentifier(getColumnName(sourceColumn));
-      printEndOfStatement();
-    }
-  }
-}
--- a/src/org/apache/ddlutils/platform/mssql/MSSqlModelReader.java	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,209 +0,0 @@
-package org.apache.ddlutils.platform.mssql;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.sql.Date;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Time;
-import java.sql.Timestamp;
-import java.sql.Types;
-import java.util.Map;
-
-import org.apache.ddlutils.DdlUtilsException;
-import org.apache.ddlutils.Platform;
-import org.apache.ddlutils.model.Column;
-import org.apache.ddlutils.model.Index;
-import org.apache.ddlutils.model.Table;
-import org.apache.ddlutils.model.TypeMap;
-import org.apache.ddlutils.platform.DatabaseMetaDataWrapper;
-import org.apache.ddlutils.platform.JdbcModelReader;
-import org.apache.oro.text.regex.MalformedPatternException;
-import org.apache.oro.text.regex.Pattern;
-import org.apache.oro.text.regex.PatternCompiler;
-import org.apache.oro.text.regex.PatternMatcher;
-import org.apache.oro.text.regex.Perl5Compiler;
-import org.apache.oro.text.regex.Perl5Matcher;
-
-/**
- * Reads a database model from a Microsoft Sql Server database.
- * 
- * @version $Revision: $
- */
-public class MSSqlModelReader extends JdbcModelReader {
-  /**
-   * Known system tables that Sql Server creates (e.g. automatic maintenance).
-   */
-  private static final String[] KNOWN_SYSTEM_TABLES = { "dtproperties" };
-  /** The regular expression pattern for the ISO dates. */
-  private Pattern _isoDatePattern;
-  /** The regular expression pattern for the ISO times. */
-  private Pattern _isoTimePattern;
-
-  /**
-   * Creates a new model reader for Microsoft Sql Server databases.
-   * 
-   * @param platform
-   *          The platform that this model reader belongs to
-   */
-  public MSSqlModelReader(Platform platform) {
-    super(platform);
-    setDefaultCatalogPattern(null);
-    setDefaultSchemaPattern(null);
-    setDefaultTablePattern("%");
-
-    PatternCompiler compiler = new Perl5Compiler();
-
-    try {
-      _isoDatePattern = compiler.compile("'(\\d{4}\\-\\d{2}\\-\\d{2})'");
-      _isoTimePattern = compiler.compile("'(\\d{2}:\\d{2}:\\d{2})'");
-    } catch (MalformedPatternException ex) {
-      throw new DdlUtilsException(ex);
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected Table readTable(DatabaseMetaDataWrapper metaData, Map values) throws SQLException {
-    String tableName = (String) values.get("TABLE_NAME");
-
-    for (int idx = 0; idx < KNOWN_SYSTEM_TABLES.length; idx++) {
-      if (KNOWN_SYSTEM_TABLES[idx].equals(tableName)) {
-        return null;
-      }
-    }
-
-    Table table = super.readTable(metaData, values);
-
-    if (table != null) {
-      // Sql Server does not return the auto-increment status via the
-      // database metadata
-      determineAutoIncrementFromResultSetMetaData(table, table.getColumns());
-
-      // TODO: Replace this manual filtering using named pks once they are
-      // available
-      // This is then probably of interest to every platform
-      for (int idx = 0; idx < table.getIndexCount();) {
-        Index index = table.getIndex(idx);
-
-        if (index.isUnique() && existsPKWithName(metaData, table, index.getName())) {
-          table.removeIndex(idx);
-        } else {
-          idx++;
-        }
-      }
-    }
-    return table;
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected boolean isInternalPrimaryKeyIndex(DatabaseMetaDataWrapper metaData, Table table,
-      Index index) {
-    // Sql Server generates an index "PK__[table name]__[hex number]"
-    StringBuffer pkIndexName = new StringBuffer();
-
-    pkIndexName.append("PK__");
-    pkIndexName.append(table.getName());
-    pkIndexName.append("__");
-
-    return index.getName().toUpperCase().startsWith(pkIndexName.toString().toUpperCase());
-  }
-
-  /**
-   * Determines whether there is a pk for the table with the given name.
-   * 
-   * @param metaData
-   *          The database metadata
-   * @param table
-   *          The table
-   * @param name
-   *          The pk name
-   * @return <code>true</code> if there is such a pk
-   */
-  private boolean existsPKWithName(DatabaseMetaDataWrapper metaData, Table table, String name) {
-    try {
-      ResultSet pks = metaData.getPrimaryKeys(table.getName());
-      boolean found = false;
-
-      while (pks.next() && !found) {
-        if (name.equals(pks.getString("PK_NAME"))) {
-          found = true;
-        }
-      }
-      pks.close();
-      return found;
-    } catch (SQLException ex) {
-      throw new DdlUtilsException(ex);
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected Column readColumn(DatabaseMetaDataWrapper metaData, Map values) throws SQLException {
-    Column column = super.readColumn(metaData, values);
-    String defaultValue = column.getDefaultValue();
-
-    // Sql Server tends to surround the returned default value with one or
-    // two sets of parentheses
-    if (defaultValue != null) {
-      while (defaultValue.startsWith("(") && defaultValue.endsWith(")")) {
-        defaultValue = defaultValue.substring(1, defaultValue.length() - 1);
-      }
-
-      if (column.getTypeCode() == Types.TIMESTAMP) {
-        // Sql Server maintains the default values for DATE/TIME jdbc
-        // types, so we have to
-        // migrate the default value to TIMESTAMP
-        PatternMatcher matcher = new Perl5Matcher();
-        Timestamp timestamp = null;
-
-        if (matcher.matches(defaultValue, _isoDatePattern)) {
-          timestamp = new Timestamp(Date.valueOf(matcher.getMatch().group(1)).getTime());
-        } else if (matcher.matches(defaultValue, _isoTimePattern)) {
-          timestamp = new Timestamp(Time.valueOf(matcher.getMatch().group(1)).getTime());
-        }
-        if (timestamp != null) {
-          defaultValue = timestamp.toString();
-        }
-      } else if (column.getTypeCode() == Types.DECIMAL) {
-        // For some reason, Sql Server 2005 always returns DECIMAL
-        // default values with a dot
-        // even if the scale is 0, so we remove the dot
-        if ((column.getScaleAsInt() == 0) && defaultValue.endsWith(".")) {
-          defaultValue = defaultValue.substring(0, defaultValue.length() - 1);
-        }
-      } else if (TypeMap.isTextType(column.getTypeCode())) {
-        defaultValue = unescape(defaultValue, "'", "''");
-      }
-
-      column.setDefaultValue(defaultValue);
-    }
-    if ((column.getTypeCode() == Types.DECIMAL) && (column.getSizeAsInt() == 19)
-        && (column.getScaleAsInt() == 0)) {
-      column.setTypeCode(Types.BIGINT);
-    }
-
-    return column;
-  }
-}
--- a/src/org/apache/ddlutils/platform/mssql/MSSqlPlatform.java	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,144 +0,0 @@
-package org.apache.ddlutils.platform.mssql;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.sql.Types;
-
-import org.apache.ddlutils.PlatformInfo;
-import org.apache.ddlutils.model.Table;
-import org.apache.ddlutils.platform.PlatformImplBase;
-
-/**
- * The platform implementation for the Microsoft SQL Server database.
- * 
- * @version $Revision: 231306 $
- */
-public class MSSqlPlatform extends PlatformImplBase {
-  /** Database name of this platform. */
-  public static final String DATABASENAME = "MsSql";
-  /** The standard SQLServer jdbc driver. */
-  public static final String JDBC_DRIVER = "com.microsoft.jdbc.sqlserver.SQLServerDriver";
-  /**
-   * The new SQLServer 2005 jdbc driver which can also be used for SQL Server 2000.
-   */
-  public static final String JDBC_DRIVER_NEW = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
-  /** The subprotocol used by the standard SQL Server driver. */
-  public static final String JDBC_SUBPROTOCOL = "microsoft:sqlserver";
-  /** The subprotocol recommended for the newer SQL Server 2005 driver. */
-  public static final String JDBC_SUBPROTOCOL_NEW = "sqlserver";
-  /** The subprotocol internally returned by the newer SQL Server 2005 driver. */
-  public static final String JDBC_SUBPROTOCOL_INTERNAL = "sqljdbc";
-
-  /**
-   * Creates a new platform instance.
-   */
-  public MSSqlPlatform() {
-    PlatformInfo info = getPlatformInfo();
-
-    info.setMaxIdentifierLength(128);
-
-    info.addNativeTypeMapping(Types.ARRAY, "IMAGE", Types.LONGVARBINARY);
-    // BIGINT will be mapped back to BIGINT by the model reader
-    info.addNativeTypeMapping(Types.BIGINT, "DECIMAL(19,0)");
-    info.addNativeTypeMapping(Types.BLOB, "IMAGE", Types.LONGVARBINARY);
-    info.addNativeTypeMapping(Types.CLOB, "TEXT", Types.LONGVARCHAR);
-    info.addNativeTypeMapping(Types.DATE, "DATETIME", Types.TIMESTAMP);
-    info.addNativeTypeMapping(Types.DISTINCT, "IMAGE", Types.LONGVARBINARY);
-    info.addNativeTypeMapping(Types.DOUBLE, "FLOAT", Types.FLOAT);
-    info.addNativeTypeMapping(Types.INTEGER, "INT");
-    info.addNativeTypeMapping(Types.JAVA_OBJECT, "IMAGE", Types.LONGVARBINARY);
-    info.addNativeTypeMapping(Types.LONGVARBINARY, "IMAGE");
-    info.addNativeTypeMapping(Types.LONGVARCHAR, "TEXT");
-    info.addNativeTypeMapping(Types.NULL, "IMAGE", Types.LONGVARBINARY);
-    info.addNativeTypeMapping(Types.OTHER, "IMAGE", Types.LONGVARBINARY);
-    info.addNativeTypeMapping(Types.REF, "IMAGE", Types.LONGVARBINARY);
-    info.addNativeTypeMapping(Types.STRUCT, "IMAGE", Types.LONGVARBINARY);
-    info.addNativeTypeMapping(Types.TIME, "DATETIME", Types.TIMESTAMP);
-    info.addNativeTypeMapping(Types.TIMESTAMP, "DATETIME");
-    info.addNativeTypeMapping(Types.TINYINT, "SMALLINT", Types.SMALLINT);
-    info.addNativeTypeMapping("BOOLEAN", "BIT", "BIT");
-    info.addNativeTypeMapping("DATALINK", "IMAGE", "LONGVARBINARY");
-
-    info.setDefaultSize(Types.CHAR, 254);
-    info.setDefaultSize(Types.VARCHAR, 254);
-    info.setDefaultSize(Types.BINARY, 254);
-    info.setDefaultSize(Types.VARBINARY, 254);
-
-    setSqlBuilder(new MSSqlBuilder(this));
-    setModelReader(new MSSqlModelReader(this));
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getName() {
-    return DATABASENAME;
-  }
-
-  /**
-   * Determines whether we need to use identity override mode for the given table.
-   * 
-   * @param table
-   *          The table
-   * @return <code>true</code> if identity override mode is needed
-   */
-  private boolean useIdentityOverrideFor(Table table) {
-    return isIdentityOverrideOn() && getPlatformInfo().isIdentityOverrideAllowed()
-        && (table.getAutoIncrementColumns().length > 0);
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected void beforeInsert(Connection connection, Table table) throws SQLException {
-    if (useIdentityOverrideFor(table)) {
-      MSSqlBuilder builder = (MSSqlBuilder) getSqlBuilder();
-
-      connection.createStatement().execute(builder.getEnableIdentityOverrideSql(table));
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected void afterInsert(Connection connection, Table table) throws SQLException {
-    if (useIdentityOverrideFor(table)) {
-      MSSqlBuilder builder = (MSSqlBuilder) getSqlBuilder();
-
-      connection.createStatement().execute(builder.getDisableIdentityOverrideSql(table));
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected void beforeUpdate(Connection connection, Table table) throws SQLException {
-    beforeInsert(connection, table);
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected void afterUpdate(Connection connection, Table table) throws SQLException {
-    afterInsert(connection, table);
-  }
-}
--- a/src/org/apache/ddlutils/platform/mssql/package.html	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-<html>
-<head>
-<!-- 
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-   <meta name="Author" content="Thomas Dudziak">
-</head>
-<body bgcolor="white">
-  <p>
-  	This package contains the platform implementation for the
-    <a href="http://www.microsoft.com/sql/">Sql Server</a> database.
-  </p>
-</body>
-</html>
--- a/src/org/apache/ddlutils/platform/mysql/MySql50ModelReader.java	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-package org.apache.ddlutils.platform.mysql;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.sql.SQLException;
-import java.util.Map;
-
-import org.apache.ddlutils.Platform;
-import org.apache.ddlutils.model.Column;
-import org.apache.ddlutils.platform.DatabaseMetaDataWrapper;
-
-/**
- * Reads a database model from a MySql 5 database.
- * 
- * @version $Revision: $
- */
-public class MySql50ModelReader extends MySqlModelReader {
-  /**
-   * Creates a new model reader for MySql 5 databases.
-   * 
-   * @param platform
-   *          The platform that this model reader belongs to
-   */
-  public MySql50ModelReader(Platform platform) {
-    super(platform);
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected Column readColumn(DatabaseMetaDataWrapper metaData, Map values) throws SQLException {
-    Column column = super.readColumn(metaData, values);
-
-    // make sure the defaultvalue is null when an empty is returned.
-    if ("".equals(column.getDefaultValue())) {
-      column.setDefaultValue(null);
-    }
-    return column;
-  }
-}
--- a/src/org/apache/ddlutils/platform/mysql/MySql50Platform.java	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-package org.apache.ddlutils.platform.mysql;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.ddlutils.PlatformInfo;
-
-/**
- * The platform implementation for MySQL 5 and above.
- * 
- * @version $Revision: 231306 $
- */
-public class MySql50Platform extends MySqlPlatform {
-  /** Database name of this platform. */
-  public static final String DATABASENAME = "MySQL5";
-
-  /**
-   * Creates a new platform instance.
-   */
-  public MySql50Platform() {
-    super();
-
-    PlatformInfo info = getPlatformInfo();
-
-    // MySql 5.0 returns an empty string for default values for pk columns
-    // which is different from the MySql 4 behaviour
-    info.setSyntheticDefaultValueForRequiredReturned(false);
-
-    setModelReader(new MySql50ModelReader(this));
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getName() {
-    return DATABASENAME;
-  }
-}
--- a/src/org/apache/ddlutils/platform/mysql/MySqlBuilder.java	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,328 +0,0 @@
-package org.apache.ddlutils.platform.mysql;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.collections.set.ListOrderedSet;
-import org.apache.ddlutils.Platform;
-import org.apache.ddlutils.alteration.AddColumnChange;
-import org.apache.ddlutils.alteration.AddPrimaryKeyChange;
-import org.apache.ddlutils.alteration.ColumnChange;
-import org.apache.ddlutils.alteration.PrimaryKeyChange;
-import org.apache.ddlutils.alteration.RemoveColumnChange;
-import org.apache.ddlutils.alteration.RemovePrimaryKeyChange;
-import org.apache.ddlutils.alteration.TableChange;
-import org.apache.ddlutils.model.Column;
-import org.apache.ddlutils.model.Database;
-import org.apache.ddlutils.model.ForeignKey;
-import org.apache.ddlutils.model.Table;
-import org.apache.ddlutils.platform.SqlBuilder;
-
-/**
- * The SQL Builder for MySQL.
- * 
- * @version $Revision: 518498 $
- */
-public class MySqlBuilder extends SqlBuilder {
-  /**
-   * Creates a new builder instance.
-   * 
-   * @param platform
-   *          The plaftform this builder belongs to
-   */
-  public MySqlBuilder(Platform platform) {
-    super(platform);
-    // we need to handle the backslash first otherwise the other
-    // already escaped sequences would be affected
-    addEscapedCharSequence("\\", "\\\\");
-    addEscapedCharSequence("\0", "\\0");
-    addEscapedCharSequence("'", "\\'");
-    addEscapedCharSequence("\"", "\\\"");
-    addEscapedCharSequence("\b", "\\b");
-    addEscapedCharSequence("\n", "\\n");
-    addEscapedCharSequence("\r", "\\r");
-    addEscapedCharSequence("\t", "\\t");
-    addEscapedCharSequence("\u001A", "\\Z");
-    addEscapedCharSequence("%", "\\%");
-    addEscapedCharSequence("_", "\\_");
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public void dropTable(Table table) throws IOException {
-    print("DROP TABLE IF EXISTS ");
-    printIdentifier(getStructureObjectName(table));
-    printEndOfStatement();
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected void writeColumnAutoIncrementStmt(Table table, Column column) throws IOException {
-    print("AUTO_INCREMENT");
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected boolean shouldGeneratePrimaryKeys(Column[] primaryKeyColumns) {
-    // mySQL requires primary key indication for autoincrement key columns
-    // I'm not sure why the default skips the pk statement if all are
-    // identity
-    return true;
-  }
-
-  /**
-   * {@inheritDoc} Normally mysql will return the LAST_INSERT_ID as the column name for the inserted
-   * id. Since ddlutils expects the real column name of the field that is autoincrementing, the
-   * column has an alias of that column name.
-   */
-  public String getSelectLastIdentityValues(Table table) {
-    String autoIncrementKeyName = "";
-    if (table.getAutoIncrementColumns().length > 0) {
-      autoIncrementKeyName = table.getAutoIncrementColumns()[0].getName();
-    }
-    return "SELECT LAST_INSERT_ID() " + autoIncrementKeyName;
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected void writeTableCreationStmtEnding(Table table, Map parameters) throws IOException {
-    if (parameters != null) {
-      print(" ");
-      // MySql supports additional table creation options which are
-      // appended
-      // at the end of the CREATE TABLE statement
-      for (Iterator it = parameters.entrySet().iterator(); it.hasNext();) {
-        Map.Entry entry = (Map.Entry) it.next();
-
-        print(entry.getKey().toString());
-        if (entry.getValue() != null) {
-          print("=");
-          print(entry.getValue().toString());
-        }
-        if (it.hasNext()) {
-          print(" ");
-        }
-      }
-    }
-    super.writeTableCreationStmtEnding(table, parameters);
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected void writeExternalForeignKeyDropStmt(Table table, ForeignKey foreignKey)
-      throws IOException {
-    writeTableAlterStmt(table);
-    print("DROP FOREIGN KEY ");
-    printIdentifier(getForeignKeyName(table, foreignKey));
-    printEndOfStatement();
-
-    if (foreignKey.isAutoIndexPresent()) {
-      writeTableAlterStmt(table);
-      print("DROP INDEX ");
-      printIdentifier(getForeignKeyName(table, foreignKey));
-      printEndOfStatement();
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected void processTableStructureChanges(Database currentModel, Database desiredModel,
-      Table sourceTable, Table targetTable, Map parameters, List changes) throws IOException {
-    // in order to utilize the ALTER TABLE ADD COLUMN AFTER statement
-    // we have to apply the add column changes in the correct order
-    // thus we first gather all add column changes and then execute them
-    ArrayList addColumnChanges = new ArrayList();
-
-    for (Iterator changeIt = changes.iterator(); changeIt.hasNext();) {
-      TableChange change = (TableChange) changeIt.next();
-
-      if (change instanceof AddColumnChange) {
-        addColumnChanges.add((AddColumnChange) change);
-        changeIt.remove();
-      }
-    }
-    for (Iterator changeIt = addColumnChanges.iterator(); changeIt.hasNext();) {
-      AddColumnChange addColumnChange = (AddColumnChange) changeIt.next();
-
-      processChange(currentModel, desiredModel, addColumnChange);
-      changeIt.remove();
-    }
-
-    ListOrderedSet changedColumns = new ListOrderedSet();
-
-    // we don't have to care about the order because the comparator will
-    // have ensured
-    // that a add primary key change comes after all necessary columns are
-    // present
-    for (Iterator changeIt = changes.iterator(); changeIt.hasNext();) {
-      TableChange change = (TableChange) changeIt.next();
-
-      if (change instanceof RemoveColumnChange) {
-        processChange(currentModel, desiredModel, (RemoveColumnChange) change);
-        changeIt.remove();
-      } else if (change instanceof AddPrimaryKeyChange) {
-        processChange(currentModel, desiredModel, (AddPrimaryKeyChange) change);
-        changeIt.remove();
-      } else if (change instanceof PrimaryKeyChange) {
-        processChange(currentModel, desiredModel, (PrimaryKeyChange) change);
-        changeIt.remove();
-      } else if (change instanceof RemovePrimaryKeyChange) {
-        processChange(currentModel, desiredModel, (RemovePrimaryKeyChange) change);
-        changeIt.remove();
-      } else if (change instanceof ColumnChange) {
-        // we gather all changed columns because we can use the ALTER
-        // TABLE MODIFY COLUMN
-        // statement for them
-        changedColumns.add(((ColumnChange) change).getChangedColumn());
-        changeIt.remove();
-      }
-    }
-    for (Iterator columnIt = changedColumns.iterator(); columnIt.hasNext();) {
-      Column sourceColumn = (Column) columnIt.next();
-      Column targetColumn = targetTable.findColumn(sourceColumn.getName(), getPlatform()
-          .isDelimitedIdentifierModeOn());
-
-      processColumnChange(sourceTable, targetTable, sourceColumn, targetColumn);
-    }
-  }
-
-  /**
-   * Processes the addition of a column to a table.
-   * 
-   * @param currentModel
-   *          The current database schema
-   * @param desiredModel
-   *          The desired database schema
-   * @param change
-   *          The change object
-   */
-  protected void processChange(Database currentModel, Database desiredModel, AddColumnChange change)
-      throws IOException {
-    print("ALTER TABLE ");
-    printlnIdentifier(getStructureObjectName(change.getChangedTable()));
-    printIndent();
-    print("ADD COLUMN ");
-    writeColumn(change.getChangedTable(), change.getNewColumn());
-    if (change.getPreviousColumn() != null) {
-      print(" AFTER ");
-      printIdentifier(getColumnName(change.getPreviousColumn()));
-    } else {
-      print(" FIRST");
-    }
-    printEndOfStatement();
-    change.apply(currentModel, getPlatform().isDelimitedIdentifierModeOn());
-  }
-
-  /**
-   * Processes the removal of a column from a table.
-   * 
-   * @param currentModel
-   *          The current database schema
-   * @param desiredModel
-   *          The desired database schema
-   * @param change
-   *          The change object
-   */
-  protected void processChange(Database currentModel, Database desiredModel,
-      RemoveColumnChange change) throws IOException {
-    print("ALTER TABLE ");
-    printlnIdentifier(getStructureObjectName(change.getChangedTable()));
-    printIndent();
-    print("DROP COLUMN ");
-    printIdentifier(getColumnName(change.getColumn()));
-    printEndOfStatement();
-    change.apply(currentModel, getPlatform().isDelimitedIdentifierModeOn());
-  }
-
-  /**
-   * Processes the removal of a primary key from a table.
-   * 
-   * @param currentModel
-   *          The current database schema
-   * @param desiredModel
-   *          The desired database schema
-   * @param change
-   *          The change object
-   */
-  protected void processChange(Database currentModel, Database desiredModel,
-      RemovePrimaryKeyChange change) throws IOException {
-    print("ALTER TABLE ");
-    printlnIdentifier(getStructureObjectName(change.getChangedTable()));
-    printIndent();
-    print("DROP PRIMARY KEY");
-    printEndOfStatement();
-    change.apply(currentModel, getPlatform().isDelimitedIdentifierModeOn());
-  }
-
-  /**
-   * Processes the change of the primary key of a table.
-   * 
-   * @param currentModel
-   *          The current database schema
-   * @param desiredModel
-   *          The desired database schema
-   * @param change
-   *          The change object
-   */
-  protected void processChange(Database currentModel, Database desiredModel, PrimaryKeyChange change)
-      throws IOException {
-    print("ALTER TABLE ");
-    printlnIdentifier(getStructureObjectName(change.getChangedTable()));
-    printIndent();
-    print("DROP PRIMARY KEY");
-    printEndOfStatement();
-    writeExternalPrimaryKeysCreateStmt(change.getChangedTable(), change.getNewName(),
-        change.getNewPrimaryKeyColumns());
-    change.apply(currentModel, getPlatform().isDelimitedIdentifierModeOn());
-  }
-
-  /**
-   * Processes a change to a column.
-   * 
-   * @param sourceTable
-   *          The current table
-   * @param targetTable
-   *          The desired table
-   * @param sourceColumn
-   *          The current column
-   * @param targetColumn
-   *          The desired column
-   */
-  protected void processColumnChange(Table sourceTable, Table targetTable, Column sourceColumn,
-      Column targetColumn) throws IOException {
-    print("ALTER TABLE ");
-    printlnIdentifier(getStructureObjectName(sourceTable));
-    printIndent();
-    print("MODIFY COLUMN ");
-    writeColumn(targetTable, targetColumn);
-    printEndOfStatement();
-  }
-}
--- a/src/org/apache/ddlutils/platform/mysql/MySqlModelReader.java	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-package org.apache.ddlutils.platform.mysql;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.sql.SQLException;
-import java.sql.Types;
-import java.util.Map;
-
-import org.apache.ddlutils.Platform;
-import org.apache.ddlutils.model.Column;
-import org.apache.ddlutils.model.ForeignKey;
-import org.apache.ddlutils.model.Index;
-import org.apache.ddlutils.model.Table;
-import org.apache.ddlutils.platform.DatabaseMetaDataWrapper;
-import org.apache.ddlutils.platform.JdbcModelReader;
-
-/**
- * Reads a database model from a MySql database.
- * 
- * @version $Revision: $
- */
-public class MySqlModelReader extends JdbcModelReader {
-  /**
-   * Creates a new model reader for MySql databases.
-   * 
-   * @param platform
-   *          The platform that this model reader belongs to
-   */
-  public MySqlModelReader(Platform platform) {
-    super(platform);
-    setDefaultCatalogPattern(null);
-    setDefaultSchemaPattern(null);
-    setDefaultTablePattern(null);
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected Table readTable(DatabaseMetaDataWrapper metaData, Map values) throws SQLException {
-    // TODO This needs some more work, since table names can be case
-    // sensitive or lowercase
-    // depending on the platform (really cute).
-    // See http://dev.mysql.com/doc/refman/4.1/en/name-case-sensitivity.html
-    // for more info.
-
-    Table table = super.readTable(metaData, values);
-
-    if (table != null) {
-      determineAutoIncrementFromResultSetMetaData(table, table.getPrimaryKeyColumns());
-    }
-    return table;
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected Column readColumn(DatabaseMetaDataWrapper metaData, Map values) throws SQLException {
-    Column column = super.readColumn(metaData, values);
-
-    // MySQL converts illegal date/time/timestamp values to
-    // "0000-00-00 00:00:00", but this
-    // is an illegal ISO value, so we replace it with NULL
-    if ((column.getTypeCode() == Types.TIMESTAMP)
-        && "0000-00-00 00:00:00".equals(column.getDefaultValue())) {
-      column.setDefaultValue(null);
-    }
-    return column;
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected boolean isInternalPrimaryKeyIndex(DatabaseMetaDataWrapper metaData, Table table,
-      Index index) {
-    // MySql defines a unique index "PRIMARY" for primary keys
-    return "PRIMARY".equals(index.getName());
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected boolean isInternalForeignKeyIndex(DatabaseMetaDataWrapper metaData, Table table,
-      ForeignKey fk, Index index) {
-    // MySql defines a non-unique index of the same name as the fk
-    return getPlatform().getSqlBuilder().getForeignKeyName(table, fk).equals(index.getName());
-  }
-}
--- a/src/org/apache/ddlutils/platform/mysql/MySqlPlatform.java	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-package org.apache.ddlutils.platform.mysql;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.sql.Types;
-
-import org.apache.ddlutils.PlatformInfo;
-import org.apache.ddlutils.platform.PlatformImplBase;
-
-/**
- * The platform implementation for MySQL.
- * 
- * @version $Revision: 231306 $
- */
-public class MySqlPlatform extends PlatformImplBase {
-  /** Database name of this platform. */
-  public static final String DATABASENAME = "MySQL";
-  /** The standard MySQL jdbc driver. */
-  public static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";
-  /** The old MySQL jdbc driver. */
-  public static final String JDBC_DRIVER_OLD = "org.gjt.mm.mysql.Driver";
-  /** The subprotocol used by the standard MySQL driver. */
-  public static final String JDBC_SUBPROTOCOL = "mysql";
-
-  /**
-   * Creates a new platform instance.
-   */
-  public MySqlPlatform() {
-    PlatformInfo info = getPlatformInfo();
-
-    info.setMaxIdentifierLength(64);
-    info.setNullAsDefaultValueRequired(true);
-    info.setDefaultValuesForLongTypesSupported(false);
-    // see
-    // http://dev.mysql.com/doc/refman/4.1/en/example-auto-increment.html
-    info.setNonPKIdentityColumnsSupported(false);
-    // MySql returns synthetic default values for pk columns
-    info.setSyntheticDefaultValueForRequiredReturned(true);
-    info.setCommentPrefix("#");
-    // Double quotes are only allowed for delimiting identifiers if the
-    // server SQL mode includes ANSI_QUOTES
-    info.setDelimiterToken("`");
-
-    info.addNativeTypeMapping(Types.ARRAY, "LONGBLOB", Types.LONGVARBINARY);
-    info.addNativeTypeMapping(Types.BIT, "TINYINT(1)");
-    info.addNativeTypeMapping(Types.BLOB, "LONGBLOB", Types.LONGVARBINARY);
-    info.addNativeTypeMapping(Types.CLOB, "LONGTEXT", Types.LONGVARCHAR);
-    info.addNativeTypeMapping(Types.DISTINCT, "LONGBLOB", Types.LONGVARBINARY);
-    info.addNativeTypeMapping(Types.FLOAT, "DOUBLE", Types.DOUBLE);
-    info.addNativeTypeMapping(Types.JAVA_OBJECT, "LONGBLOB", Types.LONGVARBINARY);
-    info.addNativeTypeMapping(Types.LONGVARBINARY, "MEDIUMBLOB");
-    info.addNativeTypeMapping(Types.LONGVARCHAR, "MEDIUMTEXT");
-    info.addNativeTypeMapping(Types.NULL, "MEDIUMBLOB", Types.LONGVARBINARY);
-    info.addNativeTypeMapping(Types.NUMERIC, "DECIMAL", Types.DECIMAL);
-    info.addNativeTypeMapping(Types.OTHER, "LONGBLOB", Types.LONGVARBINARY);
-    info.addNativeTypeMapping(Types.REAL, "FLOAT");
-    info.addNativeTypeMapping(Types.REF, "MEDIUMBLOB", Types.LONGVARBINARY);
-    info.addNativeTypeMapping(Types.STRUCT, "LONGBLOB", Types.LONGVARBINARY);
-    // Since TIMESTAMP is not a stable datatype yet, and does not support a
-    // higher precision
-    // than DATETIME (year to seconds) as of MySQL 5, we map the JDBC type
-    // here to DATETIME
-    // TODO: Make this configurable
-    info.addNativeTypeMapping(Types.TIMESTAMP, "DATETIME");
-    // In MySql, TINYINT has only a range of -128 to 127
-    info.addNativeTypeMapping(Types.TINYINT, "SMALLINT", Types.SMALLINT);
-    info.addNativeTypeMapping("BOOLEAN", "TINYINT(1)", "BIT");
-    info.addNativeTypeMapping("DATALINK", "MEDIUMBLOB", "LONGVARBINARY");
-
-    info.setDefaultSize(Types.CHAR, 254);
-    info.setDefaultSize(Types.VARCHAR, 254);
-    info.setDefaultSize(Types.BINARY, 254);
-    info.setDefaultSize(Types.VARBINARY, 254);
-
-    setSqlBuilder(new MySqlBuilder(this));
-    setModelReader(new MySqlModelReader(this));
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getName() {
-    return DATABASENAME;
-  }
-}
--- a/src/org/apache/ddlutils/platform/mysql/package.html	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-<html>
-<head>
-<!-- 
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-   <meta name="Author" content="Thomas Dudziak">
-</head>
-<body bgcolor="white">
-  <p>
-  	This package contains the platform implementation for the
-    <a href="http://dev.mysql.com/">MySQL</a> database.
-  </p>
-</body>
-</html>
--- a/src/org/apache/ddlutils/platform/oracle/Oracle10Builder.java	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-package org.apache.ddlutils.platform.oracle;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.IOException;
-
-import org.apache.ddlutils.Platform;
-import org.apache.ddlutils.model.Column;
-import org.apache.ddlutils.model.Table;
-
-/**
- * The SQL builder for Oracle 10.
- * 
- * @version $Revision: $
- */
-public class Oracle10Builder extends Oracle8Builder {
-  /**
-   * Creates a new builder instance.
-   * 
-   * @param platform
-   *          The plaftform this builder belongs to
-   */
-  public Oracle10Builder(Platform platform) {
-    super(platform);
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public void dropTable(Table table) throws IOException {
-    // The only difference to the Oracle 8/9 variant is the purge which
-    // prevents the
-    // table from being moved to the recycle bin (which is new in Oracle 10)
-    Column[] columns = table.getAutoIncrementColumns();
-
-    for (int idx = 0; idx < columns.length; idx++) {
-      dropAutoIncrementTrigger(table, columns[idx]);
-      dropAutoIncrementSequence(table, columns[idx]);
-    }
-
-    print("DROP TABLE ");
-    printIdentifier(getStructureObjectName(table));
-    print(" CASCADE CONSTRAINTS PURGE");
-    printEndOfStatement();
-  }
-}
--- a/src/org/apache/ddlutils/platform/oracle/Oracle10ModelReader.java	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-package org.apache.ddlutils.platform.oracle;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.Map;
-
-import org.apache.ddlutils.Platform;
-import org.apache.ddlutils.model.Table;
-import org.apache.ddlutils.platform.DatabaseMetaDataWrapper;
-
-/**
- * Reads a database model from an Oracle 10 database.
- * 
- * @version $Revision: $
- */
-public class Oracle10ModelReader extends Oracle8ModelReader {
-  /**
-   * Creates a new model reader for Oracle 10 databases.
-   * 
-   * @param platform
-   *          The platform that this model reader belongs to
-   */
-  public Oracle10ModelReader(Platform platform) {
-    super(platform);
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  protected Table readTable(DatabaseMetaDataWrapper metaData, Map values) throws SQLException {
-    // Oracle 10 added the recycle bin which contains dropped database
-    // objects not yet purged
-    // Since we don't want entries from the recycle bin, we filter them out
-    PreparedStatement stmt = null;
-    boolean deletedObj = false;
-
-    try {
-      stmt = getConnection().prepareStatement("SELECT * FROM RECYCLEBIN WHERE OBJECT_NAME=?");
-      stmt.setString(1, (String) values.get("TABLE_NAME"));
-
-      ResultSet rs = stmt.executeQuery();
-
-      if (rs.next()) {
-        // we found the table in the recycle bin, so its a deleted one
-        // which we ignore
-        deletedObj = true;
-      }
-      rs.close();
-    } finally {
-      if (stmt != null) {
-        stmt.close();
-      }
-    }
-
-    return deletedObj ? null : super.readTable(metaData, values);
-  }
-
-}
--- a/src/org/apache/ddlutils/platform/oracle/Oracle10Platform.java	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-package org.apache.ddlutils.platform.oracle;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * The platform for Oracle 10.
- * 
- * @version $Revision: 231306 $
- */
-public class Oracle10Platform extends Oracle9Platform {
-  /** Database name of this platform. */
-  public static final String DATABASENAME = "Oracle10";
-
-  /**
-   * Creates a new platform instance.
-   */
-  public Oracle10Platform() {
-    super();
-    setSqlBuilder(new Oracle10Builder(this));
-    setModelReader(new Oracle10ModelReader(this));
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  public String getName() {
-    return DATABASENAME;
-  }
-}
--- a/src/org/apache/ddlutils/platform/oracle/Oracle8Builder.java	Thu Oct 19 10:11:00 2017 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1215 +0,0 @@
-package org.apache.ddlutils.platform.oracle;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.IOException;
-import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Types;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.ddlutils.DdlUtilsException;
-import org.apache.ddlutils.Platform;
-import org.apache.ddlutils.alteration.AddColumnChange;
-import org.apache.ddlutils.alteration.ColumnChange;
-import org.apache.ddlutils.alteration.ColumnDataTypeChange;
-import org.apache.ddlutils.alteration.ColumnDefaultValueChange;
-import org.apache.ddlutils.alteration.ColumnRequiredChange;
-import org.apache.ddlutils.alteration.ColumnSizeChange;
-import org.apache.ddlutils.alteration.RemoveCheckChange;
-import org.apache.ddlutils.alteration.RemoveIndexChange;
-import org.apache.ddlutils.alteration.RemovePrimaryKeyChange;
-import org.apache.ddlutils.alteration.RemoveTriggerChange;
-import org.apache.ddlutils.model.Check;
-import org.apache.ddlutils.model.Column;
-import org.apache.ddlutils.model.Database;
-import org.apache.ddlutils.model.ForeignKey;
-import org.apache.ddlutils.model.Index;
-import org.apache.ddlutils.model.IndexColumn;
-import org.apache.ddlutils.model.Table;
-import org.apache.ddlutils.model.Trigger;
-import org.apache.ddlutils.model.TypeMap;
-import org.apache.ddlutils.model.Unique;
-import org.apache.ddlutils.model.ValueObject;
-import org.apache.ddlutils.model.View;
-import org.apache.ddlutils.platform.SqlBuilder;
-import org.apache.ddlutils.util.Jdbc3Utils;
-import org.apache.oro.text.regex.MalformedPatternException;
-import org.apache.oro.text.regex.Pattern;
-import org.apache.oro.text.regex.PatternCompiler;
-import org.apache.oro.text.regex.Perl5Compiler;
-import org.apache.oro.text.regex.Perl5Matcher;
-import org.openbravo.ddlutils.util.DBSMContants;
-
-/**
- * The SQL Builder for Oracle.
- * 
- * @version $Revision: 517050 $
- */
-public class Oracle8Builder extends SqlBuilder {
-  /** The regular expression pattern for ISO dates, i.e. 'YYYY-MM-DD'. */
-  private Pattern _isoDatePattern;
-  /** The regular expression pattern for ISO times, i.e. 'HH:MI:SS'. */
-  private Pattern _isoTimePattern;
-  /**
-   * The regular expression pattern for ISO timestamps, i.e. 'YYYY-MM-DD HH:MI:SS.fffffffff'.
-   */
-  private Pattern _isoTimestampPattern;
-
-  private Map<String, String> _onCreateDefaultColumns;
-  private Map<String, String> _columnsWithUpdatedComments;
-  private Map<String, String> _tablesWithUpdatedComments;
-
-  /**
-   * Creates a new builder instance.
-   * 
-   * @param platform
-   *          The plaftform this builder belongs to
-   */
-  public Oracle8Builder(Platform platform) {
-    super(platform);
-    addEscapedCharSequence("'", "''");
-
-    PatternCompiler compiler = new Perl5Compiler();
-
-    try {
-      _isoDatePattern = compiler.compile("\\d{4}\\-\\d{2}\\-\\d{2}");
-      _isoTimePattern = compiler.compile("\\d{2}:\\d{2}:\\d{2}");
-      _isoTimestampPattern = compiler
-          .compile("\\d{4}\\-\\d{2}\\-\\d{2} \\d{2}:\\d{2}:\\d{2}[\\.\\d{1,8}]?");
-    } catch (MalformedPatternException ex) {
-      throw new DdlUtilsException(ex);
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public void createTable(Database database, Table table, Map parameters) throws IOException {
-    // lets create any sequences
-    Column[] columns = table.getAutoIncrementColumns();
-
-    for (int idx = 0; idx < columns.length; idx++) {
-      createAutoIncrementSequence(table, columns[idx]);
-    }
-
-    super.createTable(database, table, parameters);
-
-    writeTableCommentsStmt(database, table);
-    for (int idx = 0; idx < columns.length; idx++) {
-      createAutoIncrementTrigger(table, columns[idx]);
-    }
-  }
-
-  @Override
-  protected void writeFollows(List<String> follows) throws IOException {
-    if (!follows.isEmpty()) {
-      print(" FOLLOWS");
-      Iterator<String> triggersToFollow = follows.iterator();
-      while (triggersToFollow.hasNext()) {
-        print(" " + triggersToFollow.next());
-        if (triggersToFollow.hasNext()) {
-          print(", ");
-        }
-      }
-      println();
-    }
-  }
-
-  @Override
-  public void writeTableCommentsStmt(Database database, Table table) throws IOException {
-    // Create comments for onCreateDefault
-    for (int idx = 0; idx < table.getColumnCount(); idx++) {
-      Column column = table.getColumn(idx);
-      writeColumnCommentStmt(database, table, column, false);
-    }
-  }
-
-  @Override
-  public void writeColumnCommentStmt(Database database, Table table, Column column,
-      boolean keepComments) throws IOException {
-    String comment = "";
-    if (column.getOnCreateDefault() != null && !column.getOnCreateDefault().equals("")) {
-      String oncreatedefaultp = column.getOnCreateDefault();
-      String oncreatedefault = "";
-      int lengthoncreate = oncreatedefaultp.length();
-      // Parse oncreatedefault
-      for (int i = 0; i < lengthoncreate; i++) {
-        String tchar = oncreatedefaultp.substring(0, 1);
-        oncreatedefaultp = oncreatedefaultp.substring(1);
-        if (tchar.equals("'"))
-          oncreatedefault += "''";
-        else
-          oncreatedefault += tchar;
-      }
-      comment += "--OBTG:ONCREATEDEFAULT:" + oncreatedefault + "--$";
-    }
-    // keep the columns which have changes on their on create default statement, to prevent losing
-    // the related comment if new partial indexes comments are added later to these columns
-    if (_onCreateDefaultColumns == null) {
-      _onCreateDefaultColumns = new HashMap<String, String>();
-    }
-    _onCreateDefaultColumns.put(table.getName() + "." + column.getName(), comment);
-    if (keepComments) {
-      // Retrieve existing column comments from database
-      String commentFromDatabase = getCommentOfColumn(table.getName(), column.getName());
-      if (commentFromDatabase != null) {
-        comment += transformInOracleComment(commentFromDatabase);
-      }
-    }
-    println("COMMENT ON COLUMN " + table.getName() + "." + column.getName() + " IS '" + comment
-        + "'");
-    printEndOfStatement();
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public void dropTable(Table table) throws IOException {
-    Column[] columns = table.getAutoIncrementColumns();
-
-    for (int idx = 0; idx < columns.length; idx++) {
-      dropAutoIncrementTrigger(table, columns[idx]);
-      dropAutoIncrementSequence(table, columns[idx]);
-    }
-
-    printStartOfStatement("TABLE", getStructureObjectName(table));
-    print("DROP TABLE ");
-    printIdentifier(getStructureObjectName(table));
-    print(" CASCADE CONSTRAINTS");
-    printEndOfStatement(getStructureObjectName(table));
-
-  }
-
-  /**
-   * Creates the sequence necessary for the auto-increment of the given column.
-   * 
-   * @param table
-   *          The table
-   * @param column
-   *          The column
-   */
-  protected void createAutoIncrementSequence(Table table, Column column) throws IOException {
-    print("CREATE SEQUENCE ");
-    printIdentifier(getConstraintName("seq", table, column.getName(), null));
-    printEndOfStatement();
-  }
-
-  /**
-   * Creates the trigger necessary for the auto-increment of the given column.
-   * 
-   * @param table
-   *          The table
-   * @param column
-   *          The column
-   */
-  protected void createAutoIncrementTrigger(Table table, Column column) throws IOException {
-    String columnName = getColumnName(column);
-    String triggerName = getConstraintName("trg", table, column.getName(), null);
-
-    if (getPlatform().isScriptModeOn()) {
-      // For the script, we output a more nicely formatted version
-      print("CREATE OR REPLACE TRIGGER ");
-      printlnIdentifier(triggerName);
-      print("BEFORE INSERT ON ");
-      printlnIdentifier(getStructureObjectName(table));
-      print("FOR EACH ROW WHEN (new.");
-      printIdentifier(columnName);
-      println(" IS NULL)");
-      println("BEGIN");
-      print("  SELECT ");
-      printIdentifier(getConstraintName("seq", table, column.getName(), null));
-      print(".nextval INTO :new.");
-      printIdentifier(columnName);
-      print(" FROM dual");
-      println(getPlatformInfo().getSqlCommandDelimiter());
-      print("END");
-      println(getPlatformInfo().getSqlCommandDelimiter());
-      println("/");
-      println();
-    } else {
-      // note that the BEGIN ... SELECT ... END; is all in one line and
-      // does
-      // not contain a semicolon except for the END-one
-      // this way, the tokenizer will not split the statement before the
-      // END
-      print("CREATE OR REPLACE TRIGGER ");
-      printIdentifier(triggerName);
-      print(" BEFORE INSERT ON ");
-      printIdentifier(getStructureObjectName(table));
-      print(" FOR EACH ROW WHEN (new.");
-      printIdentifier(columnName);
-      println(" IS NULL)");
-      print("BEGIN SELECT ");
-      printIdentifier(getConstraintName("seq", table, column.getName(), null));
-      print(".nextval INTO :new.");
-      printIdentifier(columnName);
-      print(" FROM dual");
-      print(getPlatformInfo().getSqlCommandDelimiter());
-      print(" END");
-      // It is important that there is a semicolon at the end of the
-      // statement (or more
-      // precisely, at the end of the PL/SQL block), and thus we put two
-      // semicolons here
-      // because the tokenizer will remove the one at the end
-      print(getPlatformInfo().getSqlCommandDelimiter());
-      printEndOfStatement();
-    }
-  }
-
-  /**
-   * Drops the sequence used for the auto-increment of the given column.
-   * 
-   * @param table
-   *          The table
-   * @param column
-   *          The column
-   */
-  protected void dropAutoIncrementSequence(Table table, Column column) throws IOException {
-    print("DROP SEQUENCE ");
-    printIdentifier(getConstraintName("seq", table, column.getName(), null));
-    printEndOfStatement();
-  }
-
-  /**
-   * Drops the trigger used for the auto-increment of the given column.
-   * 
-   * @param table
-   *          The table
-   * @param column
-   *          The column
-   */
-  protected void dropAutoIncrementTrigger(Table table, Column column) throws IOException {
-    print("DROP TRIGGER ");
-    printIdentifier(getConstraintName("trg", table, column.getName(), null));
-    printEndOfStatement();
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  protected void createTemporaryTable(Database database, Table table, Map parameters)
-      throws IOException {
-    createTable(database, table, parameters);
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  protected void dropTemporaryTable(Database database, Table table) throws IOException {
-    dropTable(table);
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public void dropExternalForeignKeys(Table table) throws IOException {
-    // no need to as we drop the table with CASCASE CONSTRAINTS
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public void writeExternalIndexDropStmt(Table table, Index index) throws IOExceptio