Search in sources :

Example 1 with AbstractJdbcDatabasePlatform

use of org.jumpmind.db.platform.AbstractJdbcDatabasePlatform in project symmetric-ds by JumpMind.

the class TestSetupUtil method dropDatabaseTables.

public static IDatabasePlatform dropDatabaseTables(String databaseType, ISymmetricEngine engine) {
    ISymmetricDialect dialect = engine.getSymmetricDialect();
    AbstractJdbcDatabasePlatform platform = (AbstractJdbcDatabasePlatform) dialect.getPlatform();
    engine.uninstall();
    platform.resetDataSource();
    IDdlBuilder builder = platform.getDdlBuilder();
    Database db2drop = platform.readDatabase(platform.getDefaultCatalog(), platform.getDefaultSchema(), new String[] { "TABLE" });
    platform.resetDataSource();
    String sql = builder.dropTables(db2drop);
    SqlScript dropScript = new SqlScript(sql, platform.getSqlTemplate(), false, platform.getSqlScriptReplacementTokens());
    dropScript.execute(true);
    platform.resetDataSource();
    dialect.cleanDatabase();
    platform.resetCachedTableModel();
    return platform;
}
Also used : ISymmetricDialect(org.jumpmind.symmetric.db.ISymmetricDialect) IDdlBuilder(org.jumpmind.db.platform.IDdlBuilder) Database(org.jumpmind.db.model.Database) SqlScript(org.jumpmind.db.sql.SqlScript) AbstractJdbcDatabasePlatform(org.jumpmind.db.platform.AbstractJdbcDatabasePlatform)

Aggregations

Database (org.jumpmind.db.model.Database)1 AbstractJdbcDatabasePlatform (org.jumpmind.db.platform.AbstractJdbcDatabasePlatform)1 IDdlBuilder (org.jumpmind.db.platform.IDdlBuilder)1 SqlScript (org.jumpmind.db.sql.SqlScript)1 ISymmetricDialect (org.jumpmind.symmetric.db.ISymmetricDialect)1