|| database instanceof DerbyDatabase
|| database instanceof FirebirdDatabase
|| database instanceof H2Database
|| database instanceof HsqlDatabase
|| database instanceof OracleDatabase) {
return new DatabaseDataType("TIMESTAMP");
}
if (database instanceof MSSQLDatabase) {
if ((getParameters().length > 0 && "16".equals(getParameters()[0])) || "SMALLDATETIME".equalsIgnoreCase(getRawDefinition())) {
return new DatabaseDataType("SMALLDATETIME");
}
}
if (database instanceof InformixDatabase) {
// From database to changelog
if (getAdditionalInformation() == null || getAdditionalInformation().length() == 0) {
if (getParameters() != null && getParameters().length > 0) {
String parameter = String.valueOf(getParameters()[0]);
if("4365".equals(parameter)) {
return new DatabaseDataType("DATETIME YEAR TO FRACTION(3)");
}
if("3594".equals(parameter)) {
return new DatabaseDataType("DATETIME YEAR TO SECOND");
}
if("3080".equals(parameter)) {
return new DatabaseDataType("DATETIME YEAR TO MINUTE");
}
if("2052".equals(parameter)) {
return new DatabaseDataType("DATETIME YEAR TO DAY");
}
}
}
// From changelog to the database
if (getAdditionalInformation() != null && getAdditionalInformation().length() > 0) {
return new DatabaseDataType(getRawDefinition());
}
return new DatabaseDataType("DATETIME YEAR TO FRACTION", 5);
}
if (database instanceof PostgresDatabase) {
String rawDefinition = getRawDefinition().toLowerCase();
if (rawDefinition.contains("tz") || rawDefinition.contains("with time zone")) {
return new DatabaseDataType("TIMESTAMP WITH TIME ZONE");
} else {
return new DatabaseDataType("TIMESTAMP WITHOUT TIME ZONE");
}
}
if (database instanceof SQLiteDatabase) {
return new DatabaseDataType("TEXT");
}
if (database instanceof MySQLDatabase) {
boolean supportsParameters = true;
try {
supportsParameters = database.getDatabaseMajorVersion() >= 5
&& database.getDatabaseMinorVersion() >= 6
&& ((MySQLDatabase) database).getDatabasePatchVersion() >= 4;
} catch (Exception ignore) {
//assume supports parameters
}
if (supportsParameters && getParameters().length > 0 && Integer.valueOf(getParameters()[0].toString()) <= 6) {
return new DatabaseDataType(getName(), getParameters());
} else {
return new DatabaseDataType(getName());
} }
return new DatabaseDataType(getName());
}