summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkwilk2011-04-27 18:31:50 (EDT)
committerRyan D. Brooks2011-04-27 18:31:50 (EDT)
commit36ab7a56efcb461e42cb46d7d9f5007f6af31ca5 (patch)
tree358484d425abc4f8970a78f3291c036b8a8ea98e
parent323410751de02f36cc25bcd3eff3c3604df61dd4 (diff)
downloadorg.eclipse.osee-36ab7a56efcb461e42cb46d7d9f5007f6af31ca5.zip
org.eclipse.osee-36ab7a56efcb461e42cb46d7d9f5007f6af31ca5.tar.gz
org.eclipse.osee-36ab7a56efcb461e42cb46d7d9f5007f6af31ca5.tar.bz2
refinement: Add direct support for date parameters in prepared queries
-rw-r--r--plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/internal/core/StatementUtil.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/internal/core/StatementUtil.java b/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/internal/core/StatementUtil.java
index 15880fa..b4aa443 100644
--- a/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/internal/core/StatementUtil.java
+++ b/plugins/org.eclipse.osee.framework.database/src/org/eclipse/osee/framework/database/internal/core/StatementUtil.java
@@ -14,6 +14,7 @@ import java.io.ByteArrayInputStream;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
+import java.util.Date;
import java.util.List;
import java.util.logging.Level;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
@@ -113,6 +114,10 @@ public final class StatementUtil {
} else if (dataValue instanceof ByteArrayInputStream) {
preparedStatement.setBinaryStream(preparedIndex, (ByteArrayInputStream) dataValue,
((ByteArrayInputStream) dataValue).available());
+ } else if (dataValue instanceof Date) {
+ java.util.Date javaDate = (java.util.Date) dataValue;
+ java.sql.Timestamp date = new java.sql.Timestamp(javaDate.getTime());
+ preparedStatement.setTimestamp(preparedIndex, date);
} else {
preparedStatement.setObject(preparedIndex, dataValue);
}