rzo1 commented on code in PR #304:
URL: https://github.com/apache/openjpa/pull/304#discussion_r4549968812


##########
openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/identifier/Normalizer.java:
##########
@@ -71,6 +71,24 @@ public static String normalizeString(String name) {
         return name;
     }
 
+    /**
+     * Normalizes a single part name with the given rule rather than the
+     * default rule, such as the rule of a dictionary that delimits its
+     * reserved words.
+     * @param name
+     * @param rule
+     * @since 4.2.0
+     */
+    public static String normalizeString(String name, IdentifierRule rule) {
+        if (StringUtil.isEmpty(name)) {
+            return name;
+        }
+        if (!normalizer.isDelimited(rule, name)) {

Review Comment:
   It only supplies the default configuration, i.e. the internal `"` 
delimiters: names are kept normalized with `"` and converted to the database 
delimiters (back ticks on MySQL) in `toDBName`. The dictionary's own naming 
util would delimit with the database delimiters (`isDelimited`/`delimit` read 
`_config.getLeadingDelimiter()`), so the normalized names would no longer 
match. It holds no per-database state anymore: the reserved words come in 
through the dictionary's `normalizingRule` argument, which is the point of this 
change. The instance itself is the one `Normalizer` has had all along.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to