OPENJPA-2182 fix invalidColumnWordSet handling

invalidColumnWordSet should get populated with the list of reserved words
if not explicitly configured otherwise.
This commit is contained in:
Mark Struberg 2021-03-30 20:48:54 +02:00
parent 1a8bcfb6b1
commit d48f439bc8
2 changed files with 9 additions and 11 deletions

View File

@ -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;

View File

@ -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";