Skip to content
Permalink
Browse files

0003837: MSSQL Support for datetime2 values that are before January 1,

1753
  • Loading branch information...
jumpmind-josh committed Dec 19, 2018
1 parent c99d8a8 commit b5a3c4c8505cc465a4a1331cf94d1ada25720cba
Showing with 19 additions and 0 deletions.
  1. +19 −0 symmetric-db/src/main/java/org/jumpmind/db/platform/mssql/MsSqlDmlStatement.java
@@ -30,4 +30,23 @@ protected int getTypeCode(Column column, boolean isDateOverrideToTimestamp) {
return super.getTypeCode(column, isDateOverrideToTimestamp);
}
}

@Override
protected void appendColumnParameter(StringBuilder sql, Column column) {
if (column.getJdbcTypeName() != null && column.getJdbcTypeName().equals("datetime2") && column.getMappedTypeCode() == Types.VARCHAR) {
sql.append("cast(? AS datetime2(6))").append(",");
} else {
super.appendColumnParameter(sql, column);
}
}

@Override
protected void appendColumnEquals(StringBuilder sql, Column column) {
if (column.getJdbcTypeName() != null && column.getJdbcTypeName().equals("datetime2") && column.getMappedTypeCode() == Types.VARCHAR) {
sql.append(quote).append(column.getName()).append(quote)
.append(" = cast(? AS datetime2(6))");
} else {
super.appendColumnEquals(sql, column);
}
}
}

0 comments on commit b5a3c4c

Please sign in to comment.
You can’t perform that action at this time.