use of org.jumpmind.db.platform.ase.AseDatabasePlatform in project symmetric-ds by JumpMind.
the class DatabaseWriterTest method testStringSpaces.
@Test
public void testStringSpaces() throws Exception {
String[] values = new String[TEST_COLUMNS.length];
values[0] = getNextId();
values[1] = " two spaces before";
if (!(platform instanceof AseDatabasePlatform)) {
values[2] = "two spaces after ";
}
values[3] = " one space before";
values[4] = "one space after ";
writeData(new CsvData(DataEventType.INSERT, values), values);
}
use of org.jumpmind.db.platform.ase.AseDatabasePlatform in project symmetric-ds by JumpMind.
the class DatabaseWriterTest method testStringEmpty.
@Test
public void testStringEmpty() throws Exception {
String[] values = new String[TEST_COLUMNS.length];
values[0] = getNextId();
if (!(platform instanceof AseDatabasePlatform)) {
values[1] = values[2] = "";
}
values[3] = values[4] = "";
String[] expectedValues = (String[]) ArrayUtils.clone(values);
if (platform.getDatabaseInfo().isRequiredCharColumnEmptyStringSameAsNull()) {
expectedValues[4] = null;
}
writeData(new CsvData(DataEventType.INSERT, values), expectedValues);
}
use of org.jumpmind.db.platform.ase.AseDatabasePlatform 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 SqliteJdbcSymmetricDialect(parameterService, platform);
} else if (platform instanceof VoltDbDatabasePlatform) {
dialect = new VoltDbSymmetricDialect(parameterService, platform);
} else {
dialect = new GenericSymmetricDialect(parameterService, platform);
}
return dialect;
}
use of org.jumpmind.db.platform.ase.AseDatabasePlatform in project symmetric-ds by JumpMind.
the class DatabaseWriterTest method massageExpectectedResultsForDialect.
private String[] massageExpectectedResultsForDialect(String[] values) {
RoundingMode mode = RoundingMode.DOWN;
if (values[5] != null && (!(platform instanceof OracleDatabasePlatform || platform instanceof MsSql2000DatabasePlatform || platform instanceof MsSql2005DatabasePlatform || platform instanceof MsSql2008DatabasePlatform || platform instanceof AseDatabasePlatform || platform instanceof SqlAnywhereDatabasePlatform))) {
values[5] = values[5].replaceFirst(" \\d\\d:\\d\\d:\\d\\d\\.?0?", " 00:00:00.0");
}
if (values[10] != null) {
values[10] = values[10].replace(',', '.');
}
if (values[10] != null && !(platform instanceof OracleDatabasePlatform)) {
int scale = 17;
if (platform instanceof MySqlDatabasePlatform) {
scale = 16;
}
DecimalFormat df = new DecimalFormat("0.00####################################");
values[10] = df.format(new BigDecimal(values[10]).setScale(scale, mode));
}
// Adjust character fields that may have been adjusted from null to a default space with appropriate padding
values[3] = translateExpectedCharString(values[3], 50, false);
values[4] = translateExpectedCharString(values[4], 50, true);
return values;
}
Aggregations