[openjpa] branch master updated (c780084 -> 31d2d86)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[openjpa] branch master updated (c780084 -> 31d2d86)

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

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


    from c780084  OPENJPA-2870 update spec metadata to 2.2
     new 8e18fdb  OPENJPA-2865 add compat check for WITH_TIMEZONE cols
     new 31d2d86  OPENJPA-2868 update invalid columNames for Oracle

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/openjpa/jdbc/meta/MappingInfo.java  |  4 +--
 .../org/apache/openjpa/jdbc/schema/Column.java     | 19 +++++++++++++
 .../openjpa/jdbc/schema/DynamicSchemaFactory.java  |  3 +--
 .../apache/openjpa/jdbc/sql/DerbyDictionary.java   |  2 +-
 .../apache/openjpa/jdbc/sql/OracleDictionary.java  | 31 +++++++++++-----------
 5 files changed, 39 insertions(+), 20 deletions(-)
Reply | Threaded
Open this post in threaded view
|

[openjpa] 01/02: OPENJPA-2865 add compat check for WITH_TIMEZONE cols

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

commit 8e18fdbbbc29f39764f969168dcec58583721f39
Author: Mark Struberg <[hidden email]>
AuthorDate: Sun May 2 22:23:50 2021 +0200

    OPENJPA-2865 add compat check for WITH_TIMEZONE cols
---
 .../org/apache/openjpa/jdbc/meta/MappingInfo.java     |  4 ++--
 .../java/org/apache/openjpa/jdbc/schema/Column.java   | 19 +++++++++++++++++++
 .../openjpa/jdbc/schema/DynamicSchemaFactory.java     |  3 +--
 3 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingInfo.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingInfo.java
index a9a80f1..c2ebe98 100644
--- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingInfo.java
+++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingInfo.java
@@ -770,8 +770,8 @@ public abstract class MappingInfo implements Serializable {
         if (col == null) {
             col = table.addColumn(colName);
             col.setType(type);
-        } else if ((compat || !ttype) && !col.isCompatible(type, typeName,
-            size, decimals)) {
+        } else if ((compat || !ttype) &&
+                !col.isCompatible(type, typeName, size, decimals)) {
             // if existing column isn't compatible with desired type, die if
             // can't adapt, else warn and change the existing column type
             Message msg = _loc.get(prefix + "-bad-col", context,
diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Column.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Column.java
index b63c82e..6253808 100644
--- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Column.java
+++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Column.java
@@ -762,10 +762,29 @@ public class Column extends ReferenceCounter {
                     case Types.DATE:
                     case Types.TIME:
                     case Types.TIMESTAMP:
+                    case Types.TIMESTAMP_WITH_TIMEZONE:
                         return true;
                     default:
                         return false;
                 }
+            case Types.TIMESTAMP_WITH_TIMEZONE:
+                switch (type) {
+                    case Types.DATE:
+                    case Types.TIMESTAMP:
+                        return true;
+                    default:
+                        return false;
+                }
+            case Types.TIME_WITH_TIMEZONE:
+                switch (type) {
+                    case Types.DATE:
+                    case Types.TIME:
+                    case Types.TIMESTAMP:
+                        return true;
+                    default:
+                        return false;
+                }
+
             case Types.SQLXML:  // All XML Types
             case 2007:          // Oracle-defined opaque type code for XMLType treated the same way
                 switch (type) {
diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DynamicSchemaFactory.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DynamicSchemaFactory.java
index d0e3129..2a29eac 100644
--- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DynamicSchemaFactory.java
+++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DynamicSchemaFactory.java
@@ -240,8 +240,7 @@ public class DynamicSchemaFactory
         }
 
         @Override
-        public boolean isCompatible(int type, String typeName, int size,
-            int decimals) {
+        public boolean isCompatible(int type, String typeName, int size, int decimals) {
             if (getType() != Types.OTHER)
                 return super.isCompatible(type, typeName, size, decimals);
 
Reply | Threaded
Open this post in threaded view
|

[openjpa] 02/02: OPENJPA-2868 update invalid columNames for Oracle

struberg
In reply to this post by 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

commit 31d2d862b74bfdcc6088e3c078dfde0098b42423
Author: Mark Struberg <[hidden email]>
AuthorDate: Sun May 2 23:12:35 2021 +0200

    OPENJPA-2868 update invalid columNames for Oracle
---
 .../apache/openjpa/jdbc/sql/DerbyDictionary.java   |  2 +-
 .../apache/openjpa/jdbc/sql/OracleDictionary.java  | 31 +++++++++++-----------
 2 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DerbyDictionary.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DerbyDictionary.java
index 61b119c..8fcbb8e 100644
--- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DerbyDictionary.java
+++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DerbyDictionary.java
@@ -107,7 +107,7 @@ public class DerbyDictionary
             "USING", "VALUES", "VARCHAR", "VARYING", "VIEW", "WHENEVER", "WHERE", "WINDOW", "WITH", "WORK", "WRITE", "XML",
             "XMLEXISTS", "XMLPARSE", "XMLQUERY", "XMLSERIALIZE", "YEAR",
             // end generated.
-            // the following keywords used to be defined as reserved words in the past, but now seem to work
+            // The following keywords used to be defined as reserved words in the past, but now seem to work
             // we still add them for compat reasons
             "COALESCE", "OVER", "ROW_NUMBER",
         }));
diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java
index 8109937..b8283bc 100644
--- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java
+++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/OracleDictionary.java
@@ -227,21 +227,22 @@ public class OracleDictionary
 
         // reservedWordSet subset that CANNOT be used as valid column names
         // (i.e., without surrounding them with double-quotes)
-        invalidColumnWordSet.addAll(Arrays.asList(new String[]{
-            "ACCESS", "ADD", "ALL", "ALTER", "AND", "ANY", "AS", "ASC", "AUDIT",
-            "BETWEEN", "BY", "CHAR", "CHECK", "CLUSTER", "COLUMN", "COMMENT",
-            "COMPRESS", "CONNECT", "CREATE", "CURRENT", "DATE", "DECIMAL",
-            "DEFAULT", "DELETE", "DESC", "DISTINCT", "DROP", "ELSE", "END-EXEC",
-            "EXCLUSIVE", "EXISTS", "FILE", "FLOAT", "FOR", "FROM", "GRANT",
-            "GROUP", "HAVING", "IDENTIFIED", "IMMEDIATE", "IN", "INCREMENT",
-            "INDEX", "INITIAL", "INSERT", "INTEGER", "INTERSECT", "INTO",
-            "IS", "KEY", "LEVEL", "LIKE", "LOCK", "LONG", "MAXEXTENTS", "MINUS",
-            "MODE", "NOAUDIT", "NOCOMPRESS", "NOT", "NOWAIT", "NULL", "NUMBER",
-            "OF", "OFFLINE", "ON", "ONLINE", "OPTION", "OR", "ORDER", "PCTFREE",
-            "PRIOR", "PRIVILEGES", "PUBLIC", "REVOKE", "ROW", "ROWS", "SELECT",
-            "SESSION", "SET", "SIZE", "SMALLINT", "TABLE", "THEN", "TO",
-            "UNION", "UNIQUE", "UPDATE", "USER", "VALUES", "VARCHAR", "VIEW",
-            "WHENEVER", "WHERE", "WITH",
+        // generated at 2021-05-02T16:36:42.608 via org.apache.openjpa.reservedwords.ReservedWordsIT
+        invalidColumnWordSet.addAll(Arrays.asList(new String[] {
+            "ACCESS", "ADD", "ALL", "ALTER", "AND", "ANY", "AS", "ASC", "AUDIT", "BETWEEN", "BY", "CHAR", "CHECK", "CLUSTER",
+            "COLUMN", "COMMENT", "COMPRESS", "CONNECT", "CREATE", "CURRENT", "DATE", "DECIMAL", "DEFAULT", "DELETE", "DESC",
+            "DISTINCT", "DROP", "ELSE", "END-EXEC", "EXCLUSIVE", "EXISTS", "FILE", "FLOAT", "FOR", "FROM", "GRANT", "GROUP",
+            "HAVING", "IDENTIFIED", "IMMEDIATE", "IN", "INCREMENT", "INDEX", "INITIAL", "INSERT", "INTEGER", "INTERSECT", "INTO",
+            "IS", "LEVEL", "LIKE", "LOCK", "LONG", "MAXEXTENTS", "MINUS", "MLSLABEL", "MODE", "MODIFY", "NOAUDIT", "NOCOMPRESS",
+            "NOT", "NOWAIT", "NULL", "NUMBER", "OF", "OFFLINE", "ON", "ONLINE", "OPTION", "OR", "ORDER", "PCTFREE", "PRIOR",
+            "PUBLIC", "RAW", "RENAME", "RESOURCE", "REVOKE", "ROW", "ROWID", "ROWNUM", "ROWS", "SELECT", "SESSION", "SET",
+            "SHARE", "SIZE", "SMALLINT", "START", "SUCCESSFUL", "SYNONYM", "SYSDATE", "TABLE", "THEN", "TO", "TRIGGER", "UID",
+            "UNION", "UNIQUE", "UPDATE", "USER", "VALIDATE", "VALUES", "VARCHAR", "VARCHAR2", "VIEW", "WHENEVER", "WHERE",
+            "WITH",
+            // end generated.
+            // The following keywords used to be defined as reserved words in the past, but now seem to work
+            // we still add them for compat reasons
+            "PRIVILEGES"
         }));
 
         substringFunctionName = "SUBSTR";