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 d48f439 OPENJPA-2182 fix invalidColumnWordSet handling
d48f439 is described below
commit d48f439bc87907703e3bb36073d50dd2f772d236
Author: Mark Struberg <[email protected]>
AuthorDate: Tue Mar 30 20:48:54 2021 +0200
OPENJPA-2182 fix invalidColumnWordSet handling
invalidColumnWordSet should get populated with the list of reserved words
if not explicitly configured otherwise.
---
.../openjpa/jdbc/sql/AbstractSQLServerDictionary.java | 1 -
.../org/apache/openjpa/jdbc/sql/DBDictionary.java | 19 +++++++++----------
2 files changed, 9 insertions(+), 11 deletions(-)
diff --git
a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/AbstractSQLServerDictionary.java
b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/AbstractSQLServerDictionary.java
index b4995d6..ac8433e 100644
---
a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/AbstractSQLServerDictionary.java
+++
b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/AbstractSQLServerDictionary.java
@@ -38,7 +38,6 @@ public abstract class AbstractSQLServerDictionary
public AbstractSQLServerDictionary() {
reservedWordSet.addAll(Arrays.asList(new String[]{ "FILE", "INDEX" }));
- invalidColumnWordSet.addAll(reservedWordSet);
systemTableSet.add("DTPROPERTIES");
validationSQL = "SELECT GETDATE()";
rangePosition = RANGE_POST_DISTINCT;
diff --git
a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
index 0776702..3ae7357 100644
--- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
+++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
@@ -4221,8 +4221,7 @@ public class DBDictionary
* @deprecated
*/
@Deprecated
- public boolean isSystemSequence(String name, String schema,
- boolean targetSchema) {
+ public boolean isSystemSequence(String name, String schema, boolean
targetSchema) {
return isSystemSequence(DBIdentifier.newSequence(name),
DBIdentifier.newSchema(schema), targetSchema);
}
@@ -4238,8 +4237,7 @@ public class DBDictionary
* @param targetSchema if true, then the given schema was listed by
* the user as one of his schemas
*/
- public boolean isSystemSequence(DBIdentifier name, DBIdentifier schema,
- boolean targetSchema) {
+ public boolean isSystemSequence(DBIdentifier name, DBIdentifier schema,
boolean targetSchema) {
return !targetSchema && !DBIdentifier.isNull(schema)
&&
systemSchemaSet.contains(DBIdentifier.toUpper(schema).getName());
}
@@ -5029,13 +5027,10 @@ public class DBDictionary
@Override
public void endConfiguration() {
// initialize the set of reserved SQL92 words from resource
- InputStream in = DBDictionary.class.getResourceAsStream
- ("sql-keywords.rsrc");
+ InputStream in =
DBDictionary.class.getResourceAsStream("sql-keywords.rsrc");
try {
- String keywords = new BufferedReader(new InputStreamReader(in)).
- readLine();
- reservedWordSet.addAll(Arrays.asList(StringUtil.split
- (keywords, ",", 0)));
+ String keywords = new BufferedReader(new
InputStreamReader(in)).readLine();
+ reservedWordSet.addAll(Arrays.asList(StringUtil.split(keywords,
",", 0)));
} catch (IOException ioe) {
throw new GeneralException(ioe);
} finally {
@@ -5065,6 +5060,10 @@ public class DBDictionary
if (selectWords != null)
selectWordSet.addAll(Arrays.asList(StringUtil.split(selectWords.toUpperCase(Locale.ENGLISH),
",", 0)));
+ if (invalidColumnWordSet.isEmpty()) {
+ invalidColumnWordSet.addAll(reservedWordSet);
+ }
+
// initialize the error codes
SQLErrorCodeReader codeReader = new SQLErrorCodeReader();
String rsrc = "sql-error-state-codes.xml";