Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Winkler2009-01-08 12:34:42 +0000
committerStefan Winkler2009-01-08 12:34:42 +0000
commit01eaaed429318e591fbe8496b7104d48401a39a3 (patch)
tree262e9322556335f2ee6a038d2ed93e403f5f9670 /plugins/org.eclipse.net4j.db
parent3586a8dca601f3941c475ff5bedc60c1ef45e89d (diff)
downloadcdo-01eaaed429318e591fbe8496b7104d48401a39a3.tar.gz
cdo-01eaaed429318e591fbe8496b7104d48401a39a3.tar.xz
cdo-01eaaed429318e591fbe8496b7104d48401a39a3.zip
[217255] [DB] DBStore does not store Date type correctly
https://bugs.eclipse.org/bugs/show_bug.cgi?id=217255
Diffstat (limited to 'plugins/org.eclipse.net4j.db')
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBType.java41
1 files changed, 37 insertions, 4 deletions
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBType.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBType.java
index 0c45c7ada6..f9ca440e86 100644
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBType.java
+++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/db/DBType.java
@@ -4,12 +4,14 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Eike Stepper - initial API and implementation
**************************************************************************/
package org.eclipse.net4j.db;
+import java.util.Date;
+
/**
* @author Eike Stepper
*/
@@ -29,9 +31,40 @@ public enum DBType
CHAR(1), //
VARCHAR(12), //
LONGVARCHAR(-1, "LONG VARCHAR"), //
- DATE(91), //
- TIME(92), //
- TIMESTAMP(93), //
+ DATE(91)
+ {
+ @Override
+ public void appendValue(StringBuilder builder, Object value)
+ {
+ throw new UnsupportedOperationException();
+ }
+ }, //
+ TIME(92)
+ {
+ @Override
+ public void appendValue(StringBuilder builder, Object value)
+ {
+ throw new UnsupportedOperationException();
+ }
+ }, //
+ TIMESTAMP(93)
+ {
+ @Override
+ public void appendValue(StringBuilder builder, Object value)
+ {
+ if (value instanceof Date)
+ {
+ Date date = (Date)value;
+ builder.append("'");
+ builder.append(new java.sql.Timestamp(date.getTime()));
+ builder.append("'");
+ }
+ else
+ {
+ throw new IllegalArgumentException("Not a java.util.Date: " + value);
+ }
+ }
+ }, //
BINARY(-2)
{
@Override

Back to the top