Permalink
Browse files

0003297: Treat Oracle DATE type as a TIMESTAMP

  • Loading branch information...
klementinastojanovska
klementinastojanovska committed Oct 31, 2017
1 parent 2243f61 commit 8d5e40d7ca8d03c15a7426a1f57919e0d1bb6630
Showing with 18 additions and 1 deletion.
  1. +18 −1 symmetric-db/src/main/java/org/jumpmind/db/io/DatabaseXmlUtil.java
@@ -33,6 +33,7 @@
import java.io.Reader;
import java.io.StringWriter;
import java.io.Writer;
import java.sql.JDBCType;
import java.util.Collection;
import org.apache.commons.io.IOUtils;
@@ -48,6 +49,7 @@
import org.jumpmind.db.model.Reference;
import org.jumpmind.db.model.Table;
import org.jumpmind.db.model.UniqueIndex;
import org.jumpmind.db.platform.DatabaseNamesConstants;
import org.jumpmind.exception.IoException;
import org.jumpmind.util.FormatUtils;
import org.xmlpull.v1.XmlPullParser;
@@ -434,6 +436,17 @@ public static String toXml(Database db) {
return writer.toString();
}
public static boolean isOracle(Column column) {
Collection<PlatformColumn> platformColumns = column.getPlatformColumns()
.values();
for(PlatformColumn col: platformColumns) {
if(col.getName().equals(DatabaseNamesConstants.ORACLE)) {
return true;
}
}
return false;
}
public static void write(Table table, Writer output) {
try {
@@ -448,7 +461,11 @@ public static void write(Table table, Writer output) {
output.write(" required=\"" + column.isRequired() + "\"");
}
if (column.getMappedType() != null) {
output.write(" type=\"" + column.getMappedType() + "\"");
if(isOracle(column) && column.getMappedType().equalsIgnoreCase("date")) {
output.write(" type=\"" + JDBCType.TIMESTAMP.getName() + "\"");
} else {
output.write(" type=\"" + column.getMappedType() + "\"");
}
}
if (column.getSize() != null) {
output.write(" size=\"" + column.getSize() + "\"");

0 comments on commit 8d5e40d

Please sign in to comment.