use of org.jumpmind.db.model.Database in project symmetric-ds by JumpMind.
the class AbstractDatabasePlatform method readDatabaseFromXml.
public Database readDatabaseFromXml(InputStream is, boolean alterCaseToMatchDatabaseDefaultCase) {
InputStreamReader reader = new InputStreamReader(is);
Database database = DatabaseXmlUtil.read(reader);
if (alterCaseToMatchDatabaseDefaultCase) {
alterCaseToMatchDatabaseDefaultCase(database);
}
return database;
}
use of org.jumpmind.db.model.Database in project symmetric-ds by JumpMind.
the class AbstractDatabasePlatform method readFromDatabase.
public Database readFromDatabase(Table... tables) {
Database fromDb = new Database();
for (Table tableFromXml : tables) {
Table tableFromDatabase = getTableFromCache(tableFromXml.getCatalog(), tableFromXml.getSchema(), tableFromXml.getName(), true);
if (tableFromDatabase != null) {
fromDb.addTable(tableFromDatabase);
}
}
fromDb.initialize();
return fromDb;
}
use of org.jumpmind.db.model.Database 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;
}
use of org.jumpmind.db.model.Database in project symmetric-ds by JumpMind.
the class TestSetupUtil method dropAndCreateDatabaseTables.
public static void dropAndCreateDatabaseTables(String databaseType, ISymmetricEngine engine) {
IDatabasePlatform platform = dropDatabaseTables(databaseType, engine);
Database testDb = platform.readDatabaseFromXml("/test-schema.xml", true);
platform.createDatabase(testDb, false, true);
}
use of org.jumpmind.db.model.Database in project symmetric-ds by JumpMind.
the class AbstractSymmetricDialect method getCreateSymmetricDDL.
public String getCreateSymmetricDDL() {
Database database = readSymmetricSchemaFromXml();
prefixConfigDatabase(database);
IDdlBuilder builder = platform.getDdlBuilder();
return builder.createTables(database, true);
}
Aggregations