[openjpa] branch master updated: OPENJPA-2868 reserved column names for HSQLDB

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[openjpa] branch master updated: OPENJPA-2868 reserved column names for HSQLDB

struberg
This is an automated email from the ASF dual-hosted git repository.

struberg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openjpa.git


The following commit(s) were added to refs/heads/master by this push:
     new f8667f5  OPENJPA-2868 reserved column names for HSQLDB
f8667f5 is described below

commit f8667f564d90a3087bded08c8d2ed600501a176e
Author: Mark Struberg <[hidden email]>
AuthorDate: Sun May 2 22:21:32 2021 +0200

    OPENJPA-2868 reserved column names for HSQLDB
---
 .../org/apache/openjpa/jdbc/sql/HSQLDictionary.java   | 12 ++++++++++++
 .../persistence/common/utils/AbstractTestCase.java    |  1 +
 .../persistence/kernel/TestPessimisticLocking.java    | 19 +++++++++----------
 3 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/HSQLDictionary.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/HSQLDictionary.java
index 6166412..34bbb74 100644
--- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/HSQLDictionary.java
+++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/HSQLDictionary.java
@@ -98,6 +98,18 @@ public class HSQLDictionary extends DBDictionary {
         }));
         fixedSizeTypeNameSet.remove("NUMERIC");
         fixedSizeTypeNameSet.remove("DECIMAL");
+
+        // reservedWordSet subset that CANNOT be used as valid column names
+        // (i.e., without surrounding them with double-quotes)
+        // generated at 2021-05-02T18:24:22.807 via org.apache.openjpa.reservedwords.ReservedWordsIT
+        invalidColumnWordSet.addAll(Arrays.asList(new String[] {
+            "ALL", "AND", "ANY", "AS", "AT", "BETWEEN", "BOTH", "BY", "CALL", "CASE", "CAST", "CHECK", "COALESCE", "CONSTRAINT",
+            "CONVERT", "CORRESPONDING", "CREATE", "CROSS", "CUBE", "DEFAULT", "DISTINCT", "DO", "DROP", "ELSE", "END-EXEC",
+            "EVERY", "EXCEPT", "EXISTS", "FETCH", "FOR", "FOREIGN", "FROM", "FULL", "GRANT", "GROUP", "GROUPING", "HAVING",
+            "IN", "INNER", "INTERSECT", "INTO", "IS", "JOIN", "LEADING", "LEFT", "LIKE", "NATURAL", "NOT", "NULLIF", "ON",
+            "OR", "ORDER", "OUTER", "PRIMARY", "REFERENCES", "RIGHT", "ROLLUP", "SELECT", "SET", "SOME", "SUM", "TABLE", "THEN",
+            "TO", "TRAILING", "TRIGGER", "UNION", "UNIQUE", "USING", "VALUES", "WHEN", "WHERE", "WITH",
+        }));
     }
 
     /**
diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/common/utils/AbstractTestCase.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/common/utils/AbstractTestCase.java
index dad1331..7855716 100644
--- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/common/utils/AbstractTestCase.java
+++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/common/utils/AbstractTestCase.java
@@ -105,6 +105,7 @@ public abstract class AbstractTestCase extends AbstractCachedEMFTestCase {
     protected enum Platform {
         EMPRESS,
         HYPERSONIC,
+        HERDDB,
         POSTGRESQL,
         MARIADB,
         MYSQL,
diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestPessimisticLocking.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestPessimisticLocking.java
index d027f07..57aab3d 100644
--- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestPessimisticLocking.java
+++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/kernel/TestPessimisticLocking.java
@@ -58,10 +58,6 @@ public class TestPessimisticLocking extends BaseKernelTest {
     }
 
     protected boolean skipTest() {
-        // pointbase doesn't really lock
-        if (getCurrentPlatform() == AbstractTestCase.Platform.POINTBASE)
-            return true;
-
         if (getConfiguration() instanceof JDBCConfiguration) {
             JDBCConfiguration conf = (JDBCConfiguration) getConfiguration();
             return !conf.getDBDictionaryInstance().supportsSelectForUpdate;
@@ -136,6 +132,10 @@ public class TestPessimisticLocking extends BaseKernelTest {
      */
     public void pessimisticLockingTest(boolean useReentrantLock)
         throws Throwable {
+        if (skipTest()) {
+            return;
+        }
+
         long timeout = System.currentTimeMillis() + (60 * 5 * 1000);
 
         ReentrantLock lock = null;
@@ -269,11 +269,10 @@ public class TestPessimisticLocking extends BaseKernelTest {
                     }
                 }
             }
- catch (Exception e)
- {
- exception = e;
- }
- }
- }
+            catch (Exception e) {
+                exception = e;
+            }
+        }
+    }
 
 }