use of org.jumpmind.db.platform.sqlite.SqliteDatabasePlatform in project symmetric-ds by JumpMind.
the class JdbcSymmetricDialectFactory method create.
public ISymmetricDialect create() {
AbstractSymmetricDialect dialect = null;
if (platform instanceof MariaDBDatabasePlatform) {
dialect = new MariaDBSymmetricDialect(parameterService, platform);
} else if (platform instanceof MySqlDatabasePlatform) {
dialect = new MySqlSymmetricDialect(parameterService, platform);
} else if (platform instanceof OracleDatabasePlatform) {
dialect = new OracleSymmetricDialect(parameterService, platform);
} else if (platform instanceof MsSql2008DatabasePlatform) {
dialect = new MsSqlSymmetricDialect(parameterService, platform);
} else if (platform instanceof MsSql2005DatabasePlatform) {
dialect = new MsSqlSymmetricDialect(parameterService, platform);
} else if (platform instanceof MsSql2000DatabasePlatform) {
dialect = new MsSql2000SymmetricDialect(parameterService, platform);
} else if (platform instanceof GreenplumPlatform) {
dialect = new GreenplumSymmetricDialect(parameterService, platform);
} else if (platform instanceof RedshiftDatabasePlatform) {
dialect = new RedshiftSymmetricDialect(parameterService, platform);
} else if (platform instanceof PostgreSqlDatabasePlatform) {
dialect = new PostgreSqlSymmetricDialect(parameterService, platform);
} else if (platform instanceof DerbyDatabasePlatform) {
dialect = new DerbySymmetricDialect(parameterService, platform);
} else if (platform instanceof H2DatabasePlatform) {
dialect = new H2SymmetricDialect(parameterService, platform);
} else if (platform instanceof HsqlDbDatabasePlatform) {
dialect = new HsqlDbSymmetricDialect(parameterService, platform);
} else if (platform instanceof HsqlDb2DatabasePlatform) {
dialect = new HsqlDb2SymmetricDialect(parameterService, platform);
} else if (platform instanceof InformixDatabasePlatform) {
dialect = new InformixSymmetricDialect(parameterService, platform);
} else if (platform instanceof Db2zOsDatabasePlatform) {
dialect = new Db2zOsSymmetricDialect(parameterService, platform);
} else if (platform instanceof Db2As400DatabasePlatform) {
dialect = new Db2As400SymmetricDialect(parameterService, platform);
} else if (platform instanceof Db2DatabasePlatform) {
int dbMajorVersion = platform.getSqlTemplate().getDatabaseMajorVersion();
int dbMinorVersion = platform.getSqlTemplate().getDatabaseMinorVersion();
if (dbMajorVersion < 9 || (dbMajorVersion == 9 && dbMinorVersion < 5)) {
dialect = new Db2SymmetricDialect(parameterService, platform);
} else {
dialect = new Db2v9SymmetricDialect(parameterService, platform);
}
} else if (platform instanceof FirebirdDatabasePlatform) {
int dbMajorVersion = platform.getSqlTemplate().getDatabaseMajorVersion();
int dbMinorVersion = platform.getSqlTemplate().getDatabaseMinorVersion();
if (dbMajorVersion == 2 && dbMinorVersion == 0) {
dialect = new Firebird20SymmetricDialect(parameterService, platform);
} else if (dbMajorVersion == 2) {
dialect = new Firebird21SymmetricDialect(parameterService, platform);
} else {
dialect = new FirebirdSymmetricDialect(parameterService, platform);
}
} else if (platform instanceof AseDatabasePlatform) {
dialect = new AseSymmetricDialect(parameterService, platform);
} else if (platform instanceof SqlAnywhereDatabasePlatform) {
dialect = new SqlAnywhereSymmetricDialect(parameterService, platform);
} else if (platform instanceof InterbaseDatabasePlatform) {
dialect = new InterbaseSymmetricDialect(parameterService, platform);
} else if (platform instanceof SqliteDatabasePlatform) {
dialect = new SqliteSymmetricDialect(parameterService, platform);
} else {
throw new DbNotSupportedException();
}
return dialect;
}
use of org.jumpmind.db.platform.sqlite.SqliteDatabasePlatform in project symmetric-ds by JumpMind.
the class AbstractWriterTest method assertEquals.
protected void assertEquals(String[] name, String[] expected, Map<String, Object> results) {
if (expected == null) {
Assert.assertNull("Expected empty results. " + printDatabase(), results);
} else {
Assert.assertNotNull(String.format("Did not find the expected row: %s.", Arrays.toString(expected)), results);
for (int i = 0; i < expected.length; i++) {
Object resultObj = results.get(name[i]);
String resultValue = null;
char decimal = ((DecimalFormat) DecimalFormat.getInstance()).getDecimalFormatSymbols().getDecimalSeparator();
if ((resultObj instanceof Double || resultObj instanceof BigDecimal) && expected[i].indexOf(decimal) != -1) {
DecimalFormat df = new DecimalFormat("0.00####################################");
resultValue = df.format(resultObj);
} else if (resultObj instanceof Date) {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.000");
resultValue = df.format(resultObj);
} else if (resultObj instanceof Boolean) {
resultValue = ((Boolean) resultObj) ? "1" : "0";
} else if (resultObj instanceof Double) {
resultValue = resultObj.toString();
if (platform instanceof SqliteDatabasePlatform) {
expected[i] = new Double(expected[i]).toString();
}
} else if (resultObj != null) {
resultValue = resultObj.toString();
}
Assert.assertEquals(name[i] + ". " + printDatabase(), expected[i], resultValue);
}
}
}
Aggregations