diff options
author | James Moger <james.moger@gmail.com> | 2011-08-15 16:44:14 -0400 |
---|---|---|
committer | James Moger <james.moger@gmail.com> | 2011-08-15 16:44:14 -0400 |
commit | 66e810aaf212c5e37b0a1702b6c33480595408ce (patch) | |
tree | 2babeea368dec0023b9a2add5b3ddc2c1aaaeea8 /src/com/iciql/SQLStatement.java | |
parent | 3622ae0026718ac8466e13e8011f8db309d89106 (diff) | |
download | iciql-66e810aaf212c5e37b0a1702b6c33480595408ce.tar.gz iciql-66e810aaf212c5e37b0a1702b6c33480595408ce.zip |
Added Derby dialect. Finished HSQL dialect. Documentation.
* Improved DEFAULT value specifications.
* Fixed bug in buildObjects where the ResultSet could be closed by the
automatic create table attempt.
* DbInspector now uses the dialect's reported DATETIME class preference.
* Improved IciqlException SQLState code checks.
* Integrated LIMIT and OFFSET expression appending in dialects.
* Updated to H2 1.3.159
* Allow reopening of a memory database in the test suite.
Diffstat (limited to 'src/com/iciql/SQLStatement.java')
-rw-r--r-- | src/com/iciql/SQLStatement.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/com/iciql/SQLStatement.java b/src/com/iciql/SQLStatement.java index 4962502..a33fe6c 100644 --- a/src/com/iciql/SQLStatement.java +++ b/src/com/iciql/SQLStatement.java @@ -65,6 +65,12 @@ public class SQLStatement { }
public SQLStatement addParameter(Object o) {
+ // Automatically convert java.util.Date to java.sql.Timestamp
+ // if the dialect requires java.sql.Timestamp objects (e.g. Derby)
+ if (o != null && o.getClass().equals(java.util.Date.class)
+ && db.getDialect().getDateTimeClass().equals(java.sql.Timestamp.class)) {
+ o = new java.sql.Timestamp(((java.util.Date) o).getTime());
+ }
params.add(o);
return this;
}
@@ -112,7 +118,8 @@ public class SQLStatement { try {
prep.setObject(parameterIndex, x);
} catch (SQLException e) {
- IciqlException ix = new IciqlException(e, "error setting parameter {0} as {1}", parameterIndex, x.getClass().getSimpleName());
+ IciqlException ix = new IciqlException(e, "error setting parameter {0} as {1}", parameterIndex, x
+ .getClass().getSimpleName());
ix.setSQL(getSQL());
throw ix;
}
|