summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-10-20 10:19:46 (EDT)
committerEike Stepper2007-10-20 10:19:46 (EDT)
commitb4be229539f34f66bf12edb23dab8e6cf68e3222 (patch)
tree08df4877229f223fc50132392a3b0d90a810bbc5
parent911af402233546677f27b8116db84b856b9a66d2 (diff)
downloadcdo-b4be229539f34f66bf12edb23dab8e6cf68e3222.zip
cdo-b4be229539f34f66bf12edb23dab8e6cf68e3222.tar.gz
cdo-b4be229539f34f66bf12edb23dab8e6cf68e3222.tar.bz2
[206979] Add Hsqldb adapter
https://bugs.eclipse.org/bugs/show_bug.cgi?id=206979
-rw-r--r--features/org.eclipse.emf.cdo.server.product-feature/rootfiles/configuration/cdo-server.xml10
-rw-r--r--plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.server/CDOServer.launch2
-rw-r--r--plugins/org.eclipse.net4j.db.derby/META-INF/MANIFEST.MF86
-rw-r--r--plugins/org.eclipse.net4j.db.hsqldb/.classpath2
-rw-r--r--plugins/org.eclipse.net4j.db.hsqldb/META-INF/MANIFEST.MF16
-rw-r--r--plugins/org.eclipse.net4j.db.hsqldb/src/org/eclipse/net4j/db/hsqldb/HSQLDBDataSource.java33
-rw-r--r--plugins/org.eclipse.net4j.db.hsqldb/src/org/eclipse/net4j/db/internal/hsqldb/HSQLDBAdapter.java49
-rw-r--r--plugins/org.eclipse.net4j.db/reserved_words/Copy of ansi.txt231
-rw-r--r--plugins/org.eclipse.net4j.db/reserved_words/mysql.txt229
-rw-r--r--plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBAdapter.java50
11 files changed, 458 insertions, 254 deletions
diff --git a/features/org.eclipse.emf.cdo.server.product-feature/rootfiles/configuration/cdo-server.xml b/features/org.eclipse.emf.cdo.server.product-feature/rootfiles/configuration/cdo-server.xml
index 2039f32..13cd084 100644
--- a/features/org.eclipse.emf.cdo.server.product-feature/rootfiles/configuration/cdo-server.xml
+++ b/features/org.eclipse.emf.cdo.server.product-feature/rootfiles/configuration/cdo-server.xml
@@ -32,16 +32,20 @@
</mappingStrategy>
<!-- name: <any user-contributed DBAdapter name> -->
- <dbAdapter name="derby"/>
+ <dbAdapter name="hsqldb"/>
<!-- <dataSource
driverClass="org.apache.derby.jdbc.EmbeddedDataSource"
databaseName="/temp/cdodb1"
createDatabase="create"/> -->
- <dataSource
+ <!--<dataSource
driverClass="org.apache.derby.jdbc.ClientDataSource"
databaseName="cdodb1"
- createDatabase="create"/>
+ createDatabase="create"/>-->
+ <dataSource
+ driverClass="org.eclipse.net4j.db.hsqldb.HSQLDBDataSource"
+ database="jdbc:hsqldb:mem:cdodb1"
+ user="sa"/>
</store>
</repository>
diff --git a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java
index 9745ba3..faa63a4 100644
--- a/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java
+++ b/plugins/org.eclipse.emf.cdo.server.db/src/org/eclipse/emf/cdo/server/internal/db/DBStore.java
@@ -157,6 +157,10 @@ public class DBStore extends Store implements IDBStore
{
Repository repository = (Repository)getRepository();
Connection connection = connectionProvider.getConnection();
+ if (connection == null)
+ {
+ throw new DBException("No connection from connection provider: " + connectionProvider);
+ }
try
{
diff --git a/plugins/org.eclipse.emf.cdo.server/CDOServer.launch b/plugins/org.eclipse.emf.cdo.server/CDOServer.launch
index 279eae7..3ad5d69 100644
--- a/plugins/org.eclipse.emf.cdo.server/CDOServer.launch
+++ b/plugins/org.eclipse.emf.cdo.server/CDOServer.launch
@@ -26,7 +26,7 @@
<stringAttribute key="product" value="org.eclipse.sdk.ide"/>
<stringAttribute key="selectedPlugin" value="org.eclipse.net4j.util"/>
<stringAttribute key="selected_target_plugins" value="javax.servlet,org.eclipse.core.contenttype,org.eclipse.core.jobs,org.eclipse.core.runtime,org.eclipse.core.runtime.compatibility.auth,org.eclipse.core.runtime.compatibility.registry,org.eclipse.equinox.app,org.eclipse.equinox.common,org.eclipse.equinox.preferences,org.eclipse.equinox.registry,org.eclipse.osgi,org.eclipse.osgi.services,org.eclipse.osgi.util,org.eclipse.update.configurator"/>
-<stringAttribute key="selected_workspace_plugins" value="org.eclipse.emf.cdo.protocol,org.eclipse.net4j.chat,org.eclipse.net4j.util,org.eclipse.emf.cdo.server,org.eclipse.net4j.buddies.protocol,org.eclipse.emf.cdo.server.db,org.eclipse.net4j.buddies.server,org.eclipse.net4j.db.derby,org.eclipse.net4j.db,org.eclipse.net4j,org.eclipse.net4j.tcp"/>
+<stringAttribute key="selected_workspace_plugins" value="org.eclipse.emf.cdo.protocol,org.eclipse.net4j.db.hsqldb,org.eclipse.net4j.chat,org.eclipse.net4j.util,org.eclipse.emf.cdo.server,org.eclipse.net4j.buddies.protocol,org.eclipse.emf.cdo.server.db,org.eclipse.net4j.db.mysql,org.eclipse.net4j.buddies.server,org.eclipse.net4j.db.derby,org.eclipse.net4j.db,org.eclipse.net4j,org.eclipse.net4j.tcp"/>
<stringAttribute key="templateConfig" value="${target_home}\configuration\config.ini"/>
<booleanAttribute key="tracing" value="true"/>
<booleanAttribute key="useDefaultConfig" value="true"/>
diff --git a/plugins/org.eclipse.net4j.db.derby/META-INF/MANIFEST.MF b/plugins/org.eclipse.net4j.db.derby/META-INF/MANIFEST.MF
index e7ac4f4..420b3ec 100644
--- a/plugins/org.eclipse.net4j.db.derby/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.net4j.db.derby/META-INF/MANIFEST.MF
@@ -10,5 +10,89 @@ Bundle-ClassPath: .,
lib/derbyclient.jar
Fragment-Host: org.eclipse.net4j.db;bundle-version="[0.8.0,0.9.0)"
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.3.0,4.0.0)"
-Export-Package: org.apache.derby.jdbc;x-friends:="org.eclipse.emf.cdo.tests,org.eclipse.net4j.jms.tests,org.eclipse.net4j.tests",
+Export-Package: org.apache.derby.authentication,
+ org.apache.derby.catalog,
+ org.apache.derby.catalog.types,
+ org.apache.derby.client,
+ org.apache.derby.client.am,
+ org.apache.derby.client.net,
+ org.apache.derby.database,
+ org.apache.derby.diag,
+ org.apache.derby.iapi.db,
+ org.apache.derby.iapi.error,
+ org.apache.derby.iapi.jdbc,
+ org.apache.derby.iapi.services.cache,
+ org.apache.derby.iapi.services.classfile,
+ org.apache.derby.iapi.services.compiler,
+ org.apache.derby.iapi.services.context,
+ org.apache.derby.iapi.services.crypto,
+ org.apache.derby.iapi.services.daemon,
+ org.apache.derby.iapi.services.diag,
+ org.apache.derby.iapi.services.i18n,
+ org.apache.derby.iapi.services.info,
+ org.apache.derby.iapi.services.io,
+ org.apache.derby.iapi.services.loader,
+ org.apache.derby.iapi.services.locks,
+ org.apache.derby.iapi.services.memory,
+ org.apache.derby.iapi.services.monitor,
+ org.apache.derby.iapi.services.property,
+ org.apache.derby.iapi.services.stream,
+ org.apache.derby.iapi.services.timer,
+ org.apache.derby.iapi.services.uuid,
+ org.apache.derby.iapi.sql,
+ org.apache.derby.iapi.sql.compile,
+ org.apache.derby.iapi.sql.conn,
+ org.apache.derby.iapi.sql.depend,
+ org.apache.derby.iapi.sql.dictionary,
+ org.apache.derby.iapi.sql.execute,
+ org.apache.derby.iapi.store.access,
+ org.apache.derby.iapi.store.access.conglomerate,
+ org.apache.derby.iapi.store.access.xa,
+ org.apache.derby.iapi.store.raw,
+ org.apache.derby.iapi.store.raw.data,
+ org.apache.derby.iapi.store.raw.log,
+ org.apache.derby.iapi.store.raw.xact,
+ org.apache.derby.iapi.tools.i18n,
+ org.apache.derby.iapi.types,
+ org.apache.derby.iapi.util,
+ org.apache.derby.impl.db,
+ org.apache.derby.impl.io,
+ org.apache.derby.impl.jdbc,
+ org.apache.derby.impl.jdbc.authentication,
+ org.apache.derby.impl.load,
+ org.apache.derby.impl.services.bytecode,
+ org.apache.derby.impl.services.cache,
+ org.apache.derby.impl.services.daemon,
+ org.apache.derby.impl.services.jce,
+ org.apache.derby.impl.services.locks,
+ org.apache.derby.impl.services.monitor,
+ org.apache.derby.impl.services.reflect,
+ org.apache.derby.impl.services.stream,
+ org.apache.derby.impl.services.timer,
+ org.apache.derby.impl.services.uuid,
+ org.apache.derby.impl.sql,
+ org.apache.derby.impl.sql.catalog,
+ org.apache.derby.impl.sql.compile,
+ org.apache.derby.impl.sql.conn,
+ org.apache.derby.impl.sql.depend,
+ org.apache.derby.impl.sql.execute,
+ org.apache.derby.impl.sql.execute.rts,
+ org.apache.derby.impl.store.access,
+ org.apache.derby.impl.store.access.btree,
+ org.apache.derby.impl.store.access.btree.index,
+ org.apache.derby.impl.store.access.conglomerate,
+ org.apache.derby.impl.store.access.heap,
+ org.apache.derby.impl.store.access.sort,
+ org.apache.derby.impl.store.raw,
+ org.apache.derby.impl.store.raw.data,
+ org.apache.derby.impl.store.raw.log,
+ org.apache.derby.impl.store.raw.xact,
+ org.apache.derby.impl.tools.sysinfo,
+ org.apache.derby.io,
+ org.apache.derby.jdbc,
+ org.apache.derby.osgi,
+ org.apache.derby.shared.common.error,
+ org.apache.derby.shared.common.i18n,
+ org.apache.derby.tools,
+ org.apache.derby.vti,
org.eclipse.net4j.db.internal.derby;version="0.8.0"
diff --git a/plugins/org.eclipse.net4j.db.hsqldb/.classpath b/plugins/org.eclipse.net4j.db.hsqldb/.classpath
index 8804c41..b15c85f 100644
--- a/plugins/org.eclipse.net4j.db.hsqldb/.classpath
+++ b/plugins/org.eclipse.net4j.db.hsqldb/.classpath
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
- <classpathentry exported="true" kind="lib" path="lib/hsqldb.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/hsqldb.jar" sourcepath="C:/Dokumente und Einstellungen/Stepper/Desktop/hsqldb_1_8_0_8/hsqldb/src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/>
diff --git a/plugins/org.eclipse.net4j.db.hsqldb/META-INF/MANIFEST.MF b/plugins/org.eclipse.net4j.db.hsqldb/META-INF/MANIFEST.MF
index d0b867d..d38caa9 100644
--- a/plugins/org.eclipse.net4j.db.hsqldb/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.net4j.db.hsqldb/META-INF/MANIFEST.MF
@@ -9,5 +9,17 @@ Bundle-ClassPath: .,
lib/hsqldb.jar
Fragment-Host: org.eclipse.net4j.db;bundle-version="[0.8.0,0.9.0)"
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.3.0,4.0.0)"
-Export-Package: org.eclipse.net4j.db.internal.hsqldb;version="0.8.0",
- org.hsqldb.jdbc;x-friends:="org.eclipse.net4j.tests,org.eclipse.emf.cdo.tests,org.eclipse.net4j.jms.tests"
+Export-Package: org.eclipse.net4j.db.hsqldb;version="0.8.0",
+ org.eclipse.net4j.db.internal.hsqldb;version="0.8.0",
+ org.hsqldb,
+ org.hsqldb.index,
+ org.hsqldb.jdbc,
+ org.hsqldb.lib,
+ org.hsqldb.lib.java,
+ org.hsqldb.persist,
+ org.hsqldb.resources,
+ org.hsqldb.rowio,
+ org.hsqldb.scriptio,
+ org.hsqldb.store,
+ org.hsqldb.types,
+ org.hsqldb.util
diff --git a/plugins/org.eclipse.net4j.db.hsqldb/src/org/eclipse/net4j/db/hsqldb/HSQLDBDataSource.java b/plugins/org.eclipse.net4j.db.hsqldb/src/org/eclipse/net4j/db/hsqldb/HSQLDBDataSource.java
new file mode 100644
index 0000000..e59a998
--- /dev/null
+++ b/plugins/org.eclipse.net4j.db.hsqldb/src/org/eclipse/net4j/db/hsqldb/HSQLDBDataSource.java
@@ -0,0 +1,33 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2007 Eike Stepper, Germany.
+ * All rights reserved. This program and the accompanying materials
+ * 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.hsqldb;
+
+import org.hsqldb.jdbc.jdbcDataSource;
+
+import java.text.MessageFormat;
+
+/**
+ * @author Eike Stepper
+ */
+public class HSQLDBDataSource extends jdbcDataSource
+{
+ private static final long serialVersionUID = 1L;
+
+ public HSQLDBDataSource()
+ {
+ }
+
+ @Override
+ public String toString()
+ {
+ return MessageFormat.format("HSQLDBDataSource[database={0}, user={1}]", getDatabase(), getUser());
+ }
+}
diff --git a/plugins/org.eclipse.net4j.db.hsqldb/src/org/eclipse/net4j/db/internal/hsqldb/HSQLDBAdapter.java b/plugins/org.eclipse.net4j.db.hsqldb/src/org/eclipse/net4j/db/internal/hsqldb/HSQLDBAdapter.java
index 0585e58..f83a917 100644
--- a/plugins/org.eclipse.net4j.db.hsqldb/src/org/eclipse/net4j/db/internal/hsqldb/HSQLDBAdapter.java
+++ b/plugins/org.eclipse.net4j.db.hsqldb/src/org/eclipse/net4j/db/internal/hsqldb/HSQLDBAdapter.java
@@ -10,12 +10,13 @@
**************************************************************************/
package org.eclipse.net4j.db.internal.hsqldb;
+import org.eclipse.net4j.db.DBType;
import org.eclipse.net4j.internal.db.DBAdapter;
+import org.eclipse.net4j.internal.db.DBField;
import org.hsqldb.jdbcDriver;
import java.sql.Driver;
-import java.util.Arrays;
/**
* @author Eike Stepper
@@ -31,4 +32,50 @@ public class HSQLDBAdapter extends DBAdapter
{
return new jdbcDriver();
}
+
+ @Override
+ protected String getTypeName(DBField field)
+ {
+ DBType type = field.getType();
+ switch (type)
+ {
+ case BOOLEAN:
+ case BIT:
+ case TINYINT:
+ case SMALLINT:
+ case INTEGER:
+ case BIGINT:
+ case FLOAT:
+ case REAL:
+ case DOUBLE:
+ case DATE:
+ case TIME:
+ case TIMESTAMP:
+ return type.toString();
+
+ case LONGVARCHAR:
+ return "LONGVARCHAR";
+
+ case LONGVARBINARY:
+ return "LONGVARBINARY";
+
+ case BLOB:
+ return "LONGVARBINARY";
+
+ case CLOB:
+ return "LONGVARCHAR";
+
+ case CHAR:
+ case VARCHAR:
+ case BINARY:
+ case VARBINARY:
+ return type.toString() + field.formatPrecision();
+
+ case NUMERIC:
+ case DECIMAL:
+ return type.toString() + field.formatPrecisionAndScale();
+ }
+
+ return super.getTypeName(field);
+ }
}
diff --git a/plugins/org.eclipse.net4j.db/reserved_words/Copy of ansi.txt b/plugins/org.eclipse.net4j.db/reserved_words/Copy of ansi.txt
deleted file mode 100644
index ff56656..0000000
--- a/plugins/org.eclipse.net4j.db/reserved_words/Copy of ansi.txt
+++ /dev/null
@@ -1,231 +0,0 @@
-ABSOLUTE
-ACTION
-ADD
-ALL
-ALLOCATE
-ALTER
-AND
-ANY
-ARE
-AS
-ASC
-ASSERTION
-AT
-AUTHORIZATION
-AVG
-BEGIN
-BETWEEN
-BIT
-BIT_LENGTH
-BOTH
-BY
-CASCADE
-CASCADED
-CASE
-CAST
-CATALOG
-CHAR
-CHARACTER
-CHAR_
-LENGTH
-CHARACTER_LENGTH
-CHECK
-CLOSE
-COALESCE
-COLLATE
-COLLATION
-COLUMN
-COMMIT
-CONNECT
-CONNECTION
-CONSTRAINT
-CONSTRAINTS
-CONTINUE
-CONVERT
-CORRESPONDING
-COUNT
-CREATE
-CROSS
-CURRENT
-CURRENT_DATE
-CURRENT_TIME
-CURRENT_TIMESTAMP
-CURRENT_
-USER
-CURSOR
-DATE
-DAY
-DEALLOCATE
-DEC
-DECIMAL
-DECLARE
-DEFAULT
-DEFERRABLE
-DEFERRED
-DELETE
-DESC
-DESCRIBE
-DESCRIPTOR
-DIAGNOSTICS
-DISCONNECT
-DISTINCT
-DOMAIN
-DOUBLE
-DROP
-ELSE
-END
-END-EXEC
-ESCAPE
-EXCEPT
-EXCEPTION
-EXEC
-EXECUTE
-EXISTS
-EXTERNAL
-EXTRACT
-FALSE
-FETCH
-FIRST
-FLOAT
-FOR
-FOREIGN
-FOUND
-FROM
-FULL
-GET
-GLOBAL
-GO
-GOTO
-GRANT
-GROUP
-HAVING
-HOUR
-IDENTITY
-IMMEDIATE
-IN
-INDICATOR
-INITIALLY
-INNER
-INPUT
-INSENSITIVE
-INSERT
-INT
-INTEGER
-INTERSECT
-INTERVAL
-INTO
-IS
-ISOLATION
-JOIN
-KEY
-LANGUAGE
-LAST
-LEADING
-LEFT
-LEVEL
-LIKE
-LOCAL
-LOWER
-MATCH
-MAX
-MIN
-MINUTE
-MODULE
-MONTH
-NAMES
-NATIONAL
-NATURAL
-NCHAR
-NEXT
-NO
-NOT
-NULL
-NULLIF
-NUMERIC
-OCTET_LENGTH
-OF
-ON
-ONLY
-OPEN
-OPTION
-OR
-ORDER
-OUTER
-OUTPUT
-OVERLAPS
-PAD
-PARTIAL
-POSITION
-PRECISION
-PREPARE
-PRESERVE
-PRIMARY
-PRIOR
-PRIVILEGES
-PROCEDURE
-PUBLIC
-READ
-REAL
-REFERENCES
-RELATIVE
-RESTRICT
-REVOKE
-RIGHT
-ROLLBACK
-ROWS
-SCHEMA
-SCROLL
-SECOND
-SECTION
-SELECT
-SESSION
-SESSION_
-USER
-SET
-SIZE
-SMALLINT
-SOME
-SPACE
-SQL
-SQLCODE
-SQLERROR
-SQLSTATE
-SUBSTRING
-SUM
-SYSTEM_USER
-TABLE
-TEMPORARY
-THEN
-TIME
-TIMESTAMP
-TIMEZONE_
-HOUR
-TIMEZONE_MINUTE
-TO
-TRAILING
-TRANSACTION
-TRANSLATE
-TRANSLATION
-TRIM
-TRUE
-UNION
-UNIQUE
-UNKNOWN
-UPDATE
-UPPER
-USAGE
-USER
-USING
-VALUE
-VALUES
-VARCHAR
-VARYING
-VIEW
-WHEN
-WHENEVER
-WHERE
-WITH
-WORK
-WRITE
-YEAR
-ZONE
diff --git a/plugins/org.eclipse.net4j.db/reserved_words/mysql.txt b/plugins/org.eclipse.net4j.db/reserved_words/mysql.txt
new file mode 100644
index 0000000..94dce4c
--- /dev/null
+++ b/plugins/org.eclipse.net4j.db/reserved_words/mysql.txt
@@ -0,0 +1,229 @@
+ACTION
+ADD
+ALL
+ALTER
+ANALYZE
+AND
+AS
+ASC
+ASENSITIVE
+BEFORE
+BETWEEN
+BIGINT
+BINARY
+BIT
+BLOB
+BOTH
+BY
+CALL
+CASCADE
+CASE
+CHANGE
+CHAR
+CHARACTER
+CHECK
+COLLATE
+COLUMN
+CONDITION
+CONSTRAINT
+CONTINUE
+CONVERT
+CREATE
+CROSS
+CURRENT_DATE
+CURRENT_TIME
+CURRENT_TIMESTAMP
+CURRENT_USER
+CURSOR
+DATABASE
+DATABASES
+DATE
+DAY_HOUR
+DAY_MICROSECOND
+DAY_MINUTE
+DAY_SECOND
+DEC
+DECIMAL
+DECLARE
+DEFAULT
+DELAYED
+DELETE
+DESC
+DESCRIBE
+DETERMINISTIC
+DISTINCT
+DISTINCTROW
+DIV
+DOUBLE
+DROP
+DUAL
+EACH
+ELSE
+ELSEIF
+ENCLOSED
+ENUM
+ESCAPED
+EXISTS
+EXIT
+EXPLAIN
+FALSE
+FETCH
+FLOAT
+FLOAT4
+FLOAT8
+FOR
+FORCE
+FOREIGN
+FROM
+FULLTEXT
+GRANT
+GROUP
+HAVING
+HIGH_PRIORITY
+HOUR_MICROSECOND
+HOUR_MINUTE
+HOUR_SECOND
+IF
+IGNORE
+IN
+INDEX
+INFILE
+INNER
+INOUT
+INSENSITIVE
+INSERT
+INT
+INT1
+INT2
+INT3
+INT4
+INT8
+INTEGER
+INTERVAL
+INTO
+IS
+ITERATE
+JOIN
+KEY
+KEYS
+KILL
+LEADING
+LEAVE
+LEFT
+LIKE
+LIMIT
+LINES
+LOAD
+LOCALTIME
+LOCALTIMESTAMP
+LOCK
+LONG
+LONGBLOB
+LONGTEXT
+LOOP
+LOW_PRIORITY
+MATCH
+MEDIUMBLOB
+MEDIUMINT
+MEDIUMTEXT
+MIDDLEINT
+MINUTE_MICROSECOND
+MINUTE_SECOND
+MOD
+MODIFIES
+NATURAL
+NO
+NOT
+NO_WRITE_TO_BINLOG
+NULL
+NUMERIC
+ON
+OPTIMIZE
+OPTION
+OPTIONALLY
+OR
+ORDER
+OUT
+OUTER
+OUTFILE
+PRECISION
+PRIMARY
+PROCEDURE
+PURGE
+RAID0
+READ
+READS
+REAL
+REFERENCES
+REGEXP
+RELEASE
+RENAME
+REPEAT
+REPLACE
+REQUIRE
+RESTRICT
+RETURN
+REVOKE
+RIGHT
+RLIKE
+SCHEMA
+SCHEMAS
+SECOND_MICROSECOND
+SELECT
+SENSITIVE
+SEPARATOR
+SET
+SHOW
+SMALLINT
+SONAME
+SPATIAL
+SPECIFIC
+SQL
+SQLEXCEPTION
+SQLSTATE
+SQLWARNING
+SQL_BIG_RESULT
+SQL_CALC_FOUND_ROWS
+SQL_SMALL_RESULT
+SSL
+STARTING
+STRAIGHT_JOIN
+TABLE
+TERMINATED
+TEXT
+THEN
+TIME
+TIMESTAMP
+TINYBLOB
+TINYINT
+TINYTEXT
+TO
+TRAILING
+TRIGGER
+TRUE
+UNDO
+UNION
+UNIQUE
+UNLOCK
+UNSIGNED
+UPDATE
+USAGE
+USE
+USING
+UTC_DATE
+UTC_TIME
+UTC_TIMESTAMP
+VALUES
+VARBINARY
+VARCHAR
+VARCHARACTER
+VARYING
+WHEN
+WHERE
+WHILE
+WITH
+WRITE
+X509
+XOR
+YEAR_MONTH
+ZEROFILL
diff --git a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBAdapter.java b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBAdapter.java
index 8730544..4b2137a 100644
--- a/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBAdapter.java
+++ b/plugins/org.eclipse.net4j.db/src/org/eclipse/net4j/internal/db/DBAdapter.java
@@ -25,6 +25,7 @@ import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
+import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
@@ -35,6 +36,40 @@ public abstract class DBAdapter implements IDBAdapter
{
private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG_SQL, DBAdapter.class);
+ private static final String[] RESERVED_WORDS = { "ABSOLUTE", "ACTION", "ADD", "AFTER", "ALL", "ALLOCATE", "ALTER",
+ "AND", "ANY", "ARE", "ARRAY", "AS", "ASC", "ASENSITIVE", "ASSERTION", "ASYMMETRIC", "AT", "ATOMIC",
+ "AUTHORIZATION", "AVG", "BEFORE", "BEGIN", "BETWEEN", "BIGINT", "BINARY", "BIT", "BIT_LENGTH", "BLOB", "BOOLEAN",
+ "BOTH", "BREADTH", "BY", "CALL", "CALLED", "CASCADE", "CASCADED", "CASE", "CAST", "CATALOG", "CHAR", "CHARACTER",
+ "CHARACTER_LENGTH", "CHAR_LENGTH", "CHECK", "CLOB", "CLOSE", "COALESCE", "COLLATE", "COLLATION", "COLUMN",
+ "COMMIT", "CONDITION", "CONNECT", "CONNECTION", "CONSTRAINT", "CONSTRAINTS", "CONSTRUCTOR", "CONTAINS",
+ "CONTINUE", "CONVERT", "CORRESPONDING", "COUNT", "CREATE", "CROSS", "CUBE", "CURRENT", "CURRENT_DATE",
+ "CURRENT_DEFAULT_TRANSFORM_GROUP", "CURRENT_PATH", "CURRENT_ROLE", "CURRENT_TIME", "CURRENT_TIMESTAMP",
+ "CURRENT_TRANSFORM_GROUP_FOR_TYPE", "CURRENT_USER", "CURSOR", "CYCLE", "DATA", "DATE", "DAY", "DEALLOCATE",
+ "DEC", "DECIMAL", "DECLARE", "DEFAULT", "DEFERRABLE", "DEFERRED", "DELETE", "DEPTH", "DEREF", "DESC", "DESCRIBE",
+ "DESCRIPTOR", "DETERMINISTIC", "DIAGNOSTICS", "DISCONNECT", "DISTINCT", "DO", "DOMAIN", "DOUBLE", "DROP",
+ "DYNAMIC", "EACH", "ELEMENT", "ELSE", "ELSEIF", "END", "EQUALS", "ESCAPE", "EXCEPT", "EXCEPTION", "EXEC",
+ "EXECUTE", "EXISTS", "EXIT", "EXTERNAL", "EXTRACT", "FALSE", "FETCH", "FILTER", "FIRST", "FLOAT", "FOR",
+ "FOREIGN", "FOUND", "FREE", "FROM", "FULL", "FUNCTION", "GENERAL", "GET", "GLOBAL", "GO", "GOTO", "GRANT",
+ "GROUP", "GROUPING", "HANDLER", "HAVING", "HOLD", "HOUR", "IDENTITY", "IF", "IMMEDIATE", "IN", "INDICATOR",
+ "INITIALLY", "INNER", "INOUT", "INPUT", "INSENSITIVE", "INSERT", "INT", "INTEGER", "INTERSECT", "INTERVAL",
+ "INTO", "IS", "ISOLATION", "ITERATE", "JOIN", "KEY", "LANGUAGE", "LARGE", "LAST", "LATERAL", "LEADING", "LEAVE",
+ "LEFT", "LEVEL", "LIKE", "LOCAL", "LOCALTIME", "LOCALTIMESTAMP", "LOCATOR", "LOOP", "LOWER", "MAP", "MATCH",
+ "MAX", "MEMBER", "MERGE", "METHOD", "MIN", "MINUTE", "MODIFIES", "MODULE", "MONTH", "MULTISET", "NAMES",
+ "NATIONAL", "NATURAL", "NCHAR", "NCLOB", "NEW", "NEXT", "NO", "NONE", "NOT", "NULL", "NULLIF", "NUMERIC",
+ "OBJECT", "OCTET_LENGTH", "OF", "OLD", "ON", "ONLY", "OPEN", "OPTION", "OR", "ORDER", "ORDINALITY", "OUT",
+ "OUTER", "OUTPUT", "OVER", "OVERLAPS", "PAD", "PARAMETER", "PARTIAL", "PARTITION", "PATH", "POSITION",
+ "PRECISION", "PREPARE", "PRESERVE", "PRIMARY", "PRIOR", "PRIVILEGES", "PROCEDURE", "PUBLIC", "RANGE", "READ",
+ "READS", "REAL", "RECURSIVE", "REF", "REFERENCES", "REFERENCING", "RELATIVE", "RELEASE", "REPEAT", "RESIGNAL",
+ "RESTRICT", "RESULT", "RETURN", "RETURNS", "REVOKE", "RIGHT", "ROLE", "ROLLBACK", "ROLLUP", "ROUTINE", "ROW",
+ "ROWS", "SAVEPOINT", "SCHEMA", "SCOPE", "SCROLL", "SEARCH", "SECOND", "SECTION", "SELECT", "SENSITIVE",
+ "SESSION", "SESSION_USER", "SET", "SETS", "SIGNAL", "SIMILAR", "SIZE", "SMALLINT", "SOME", "SPACE", "SPECIFIC",
+ "SPECIFICTYPE", "SQL", "SQLCODE", "SQLERROR", "SQLEXCEPTION", "SQLSTATE", "SQLWARNING", "START", "STATE",
+ "STATIC", "SUBMULTISET", "SUBSTRING", "SUM", "SYMMETRIC", "SYSTEM", "SYSTEM_USER", "TABLE", "TABLESAMPLE",
+ "TEMPORARY", "THEN", "TIME", "TIMESTAMP", "TIMEZONE_HOUR", "TIMEZONE_MINUTE", "TO", "TRAILING", "TRANSACTION",
+ "TRANSLATE", "TRANSLATION", "TREAT", "TRIGGER", "TRIM", "TRUE", "UNDER", "UNDO", "UNION", "UNIQUE", "UNKNOWN",
+ "UNNEST", "UNTIL", "UPDATE", "UPPER", "USAGE", "USER", "USING", "VALUE", "VALUES", "VARCHAR", "VARYING", "VIEW",
+ "WHEN", "WHENEVER", "WHERE", "WHILE", "WINDOW", "WITH", "WITHIN", "WITHOUT", "WORK", "WRITE", "YEAR", "ZONE" };
+
private String name;
private String version;
@@ -266,7 +301,7 @@ public abstract class DBAdapter implements IDBAdapter
protected boolean isReservedWord(String word)
{
- return false;
+ return Arrays.binarySearch(RESERVED_WORDS, word.toUpperCase()) >= 0;
}
protected void validateTable(DBTable table, Statement statement) throws DBException
@@ -288,19 +323,6 @@ public abstract class DBAdapter implements IDBAdapter
throw new DBException("DBTable " + table + " has " + columnCount + " columns instead of "
+ table.getFieldCount());
}
-
- // for (int i = 0; i < columnCount; i++)
- // {
- // int existingCode = metaData.getColumnType(i + 1);
- // DBField field = table.getField(i);
- // int code = field.getType().getCode();
- // if (code != existingCode)
- // {
- // throw new DBException("DBField " + field.getFullName() + " has type " +
- // existingCode + " instead of " + code
- // + " (" + field.getType() + ")");
- // }
- // }
}
catch (SQLException ex)
{