Search in sources :

Example 1 with MsSql2005DatabasePlatform

use of org.jumpmind.db.platform.mssql.MsSql2005DatabasePlatform 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;
}
Also used : OracleDatabasePlatform(org.jumpmind.db.platform.oracle.OracleDatabasePlatform) MsSql2000DatabasePlatform(org.jumpmind.db.platform.mssql.MsSql2000DatabasePlatform) MySqlDatabasePlatform(org.jumpmind.db.platform.mysql.MySqlDatabasePlatform) AseDatabasePlatform(org.jumpmind.db.platform.ase.AseDatabasePlatform) SqlAnywhereDatabasePlatform(org.jumpmind.db.platform.sqlanywhere.SqlAnywhereDatabasePlatform) RoundingMode(java.math.RoundingMode) DecimalFormat(java.text.DecimalFormat) MsSql2008DatabasePlatform(org.jumpmind.db.platform.mssql.MsSql2008DatabasePlatform) MsSql2005DatabasePlatform(org.jumpmind.db.platform.mssql.MsSql2005DatabasePlatform) BigDecimal(java.math.BigDecimal)

Example 2 with MsSql2005DatabasePlatform

use of org.jumpmind.db.platform.mssql.MsSql2005DatabasePlatform 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;
}
Also used : MySqlDatabasePlatform(org.jumpmind.db.platform.mysql.MySqlDatabasePlatform) MySqlSymmetricDialect(org.jumpmind.symmetric.db.mysql.MySqlSymmetricDialect) Db2DatabasePlatform(org.jumpmind.db.platform.db2.Db2DatabasePlatform) HsqlDb2DatabasePlatform(org.jumpmind.db.platform.hsqldb2.HsqlDb2DatabasePlatform) InformixSymmetricDialect(org.jumpmind.symmetric.db.informix.InformixSymmetricDialect) Firebird20SymmetricDialect(org.jumpmind.symmetric.db.firebird.Firebird20SymmetricDialect) InformixDatabasePlatform(org.jumpmind.db.platform.informix.InformixDatabasePlatform) Db2SymmetricDialect(org.jumpmind.symmetric.db.db2.Db2SymmetricDialect) HsqlDb2SymmetricDialect(org.jumpmind.symmetric.db.hsqldb2.HsqlDb2SymmetricDialect) AseDatabasePlatform(org.jumpmind.db.platform.ase.AseDatabasePlatform) AseSymmetricDialect(org.jumpmind.symmetric.db.ase.AseSymmetricDialect) InterbaseDatabasePlatform(org.jumpmind.db.platform.interbase.InterbaseDatabasePlatform) MsSqlSymmetricDialect(org.jumpmind.symmetric.db.mssql.MsSqlSymmetricDialect) InterbaseSymmetricDialect(org.jumpmind.symmetric.db.interbase.InterbaseSymmetricDialect) HsqlDbSymmetricDialect(org.jumpmind.symmetric.db.hsqldb.HsqlDbSymmetricDialect) OracleDatabasePlatform(org.jumpmind.db.platform.oracle.OracleDatabasePlatform) PostgreSqlSymmetricDialect(org.jumpmind.symmetric.db.postgresql.PostgreSqlSymmetricDialect) Db2zOsDatabasePlatform(org.jumpmind.db.platform.db2.Db2zOsDatabasePlatform) H2SymmetricDialect(org.jumpmind.symmetric.db.h2.H2SymmetricDialect) SqlAnywhereDatabasePlatform(org.jumpmind.db.platform.sqlanywhere.SqlAnywhereDatabasePlatform) RedshiftSymmetricDialect(org.jumpmind.symmetric.db.redshift.RedshiftSymmetricDialect) MsSql2008DatabasePlatform(org.jumpmind.db.platform.mssql.MsSql2008DatabasePlatform) FirebirdDatabasePlatform(org.jumpmind.db.platform.firebird.FirebirdDatabasePlatform) Firebird21SymmetricDialect(org.jumpmind.symmetric.db.firebird.Firebird21SymmetricDialect) MsSql2005DatabasePlatform(org.jumpmind.db.platform.mssql.MsSql2005DatabasePlatform) DerbySymmetricDialect(org.jumpmind.symmetric.db.derby.DerbySymmetricDialect) MariaDBSymmetricDialect(org.jumpmind.symmetric.db.mariadb.MariaDBSymmetricDialect) SqliteDatabasePlatform(org.jumpmind.db.platform.sqlite.SqliteDatabasePlatform) MsSql2000SymmetricDialect(org.jumpmind.symmetric.db.mssql2000.MsSql2000SymmetricDialect) Db2As400DatabasePlatform(org.jumpmind.db.platform.db2.Db2As400DatabasePlatform) Db2As400SymmetricDialect(org.jumpmind.symmetric.db.db2.Db2As400SymmetricDialect) RedshiftDatabasePlatform(org.jumpmind.db.platform.redshift.RedshiftDatabasePlatform) PostgreSqlDatabasePlatform(org.jumpmind.db.platform.postgresql.PostgreSqlDatabasePlatform) HsqlDb2SymmetricDialect(org.jumpmind.symmetric.db.hsqldb2.HsqlDb2SymmetricDialect) H2DatabasePlatform(org.jumpmind.db.platform.h2.H2DatabasePlatform) HsqlDbDatabasePlatform(org.jumpmind.db.platform.hsqldb.HsqlDbDatabasePlatform) HsqlDb2DatabasePlatform(org.jumpmind.db.platform.hsqldb2.HsqlDb2DatabasePlatform) Db2zOsSymmetricDialect(org.jumpmind.symmetric.db.db2.Db2zOsSymmetricDialect) FirebirdSymmetricDialect(org.jumpmind.symmetric.db.firebird.FirebirdSymmetricDialect) GreenplumPlatform(org.jumpmind.db.platform.greenplum.GreenplumPlatform) SqlAnywhereSymmetricDialect(org.jumpmind.symmetric.db.sqlanywhere.SqlAnywhereSymmetricDialect) MsSql2000DatabasePlatform(org.jumpmind.db.platform.mssql.MsSql2000DatabasePlatform) Db2v9SymmetricDialect(org.jumpmind.symmetric.db.db2.Db2v9SymmetricDialect) DerbyDatabasePlatform(org.jumpmind.db.platform.derby.DerbyDatabasePlatform) SqliteSymmetricDialect(org.jumpmind.symmetric.db.sqlite.SqliteSymmetricDialect) MariaDBDatabasePlatform(org.jumpmind.db.platform.mariadb.MariaDBDatabasePlatform) OracleSymmetricDialect(org.jumpmind.symmetric.db.oracle.OracleSymmetricDialect) GreenplumSymmetricDialect(org.jumpmind.symmetric.db.postgresql.GreenplumSymmetricDialect)

Aggregations

AseDatabasePlatform (org.jumpmind.db.platform.ase.AseDatabasePlatform)2 MsSql2000DatabasePlatform (org.jumpmind.db.platform.mssql.MsSql2000DatabasePlatform)2 MsSql2005DatabasePlatform (org.jumpmind.db.platform.mssql.MsSql2005DatabasePlatform)2 MsSql2008DatabasePlatform (org.jumpmind.db.platform.mssql.MsSql2008DatabasePlatform)2 MySqlDatabasePlatform (org.jumpmind.db.platform.mysql.MySqlDatabasePlatform)2 OracleDatabasePlatform (org.jumpmind.db.platform.oracle.OracleDatabasePlatform)2 SqlAnywhereDatabasePlatform (org.jumpmind.db.platform.sqlanywhere.SqlAnywhereDatabasePlatform)2 BigDecimal (java.math.BigDecimal)1 RoundingMode (java.math.RoundingMode)1 DecimalFormat (java.text.DecimalFormat)1 Db2As400DatabasePlatform (org.jumpmind.db.platform.db2.Db2As400DatabasePlatform)1 Db2DatabasePlatform (org.jumpmind.db.platform.db2.Db2DatabasePlatform)1 Db2zOsDatabasePlatform (org.jumpmind.db.platform.db2.Db2zOsDatabasePlatform)1 DerbyDatabasePlatform (org.jumpmind.db.platform.derby.DerbyDatabasePlatform)1 FirebirdDatabasePlatform (org.jumpmind.db.platform.firebird.FirebirdDatabasePlatform)1 GreenplumPlatform (org.jumpmind.db.platform.greenplum.GreenplumPlatform)1 H2DatabasePlatform (org.jumpmind.db.platform.h2.H2DatabasePlatform)1 HsqlDbDatabasePlatform (org.jumpmind.db.platform.hsqldb.HsqlDbDatabasePlatform)1 HsqlDb2DatabasePlatform (org.jumpmind.db.platform.hsqldb2.HsqlDb2DatabasePlatform)1 InformixDatabasePlatform (org.jumpmind.db.platform.informix.InformixDatabasePlatform)1