-
Notifications
You must be signed in to change notification settings - Fork 229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bidirectional Converters and Quirks #70
Conversation
@aldenquimby I think I will get an opportunity to test it on a DB2 database tomorrow or Tuesday. |
I have DB2 @ office |
@dimzon It would be great if you have an opportunity to test! The problem is that executing an insert/update on a DateTime/Timestamp column with a java.util.Date value, will not save time information (only date) on some databases (MS SQL, MySQL and PostgreSQL). If we convert it to a java.sql.Timestamp value, it crashes on DB2 when using as a parameter for a Date column. I will also try to get an opportunity to test it on DB2. But I will check here first, to see if you have already testet :) |
@aaberg |
CREATE TABLE DT_TEST (
F1 DATE,
F2 TIME,
F3 TIMESTAMP
) try(Connection cn = ds.getConnection()){
try(PreparedStatement ps = cn.prepareStatement("insert into dt_test(f1,f2,f3) values(?,?,?)")){
Object date = new java.sql.Timestamp(System.currentTimeMillis());
ps.setObject(1, date);
ps.setObject(2, date);
ps.setObject(3, date);
ps.executeUpdate();
}
} works fine for all 3 fields |
@dimzon what happens if you use a java.sql.Timestamp instead of date? ps.setObject(1, timestamp); On Mon, Apr 7, 2014 at 11:52 AM, dimzon notifications@github.com wrote:
|
@aaberg re-read my code above. I'm using |
Ahh, your right. I didn't see that. Which jdbc driver and version do you use? |
Forget it! You wrote that too!!! I need to learn to read! |
also in upper post 2014-04-07 15:04 GMT+04:00 Lars Aaberg notifications@github.com:
|
Conflicts: core/src/main/java/org/sql2o/PojoResultSetIterator.java
Bidirectional Converters and Quirks
Before merging, I want to test on a DB2 database because the
Query#addParameter(String, Date)
no longer exists. @aaberg do you have a DB2 db available to you?Note: at some point we may want to move the quirks implementations to respective extension packages