rmannibucau commented on a change in pull request #69:
URL: https://github.com/apache/openjpa/pull/69#discussion_r456519302



##########
File path: openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Table.java
##########
@@ -329,10 +341,19 @@ public Column getColumn(String name) {
         return getColumn(DBIdentifier.newIdentifier(name, 
DBIdentifierType.COLUMN, true));
     }
 
-    public Column getColumn(DBIdentifier name) {
+    private Column internalGetColumn(DBIdentifier name) {
         if (DBIdentifier.isNull(name) || _colMap == null)
             return null;
-        return _colMap.get(DBIdentifier.toUpper(name));
+        DBIdentifier key = normalizeColumnKey(name);
+        return _colMap.get(key);
+    }
+
+    public Column getColumn(DBIdentifier name) {
+        return internalGetColumn(name);
+    }
+
+    private DBIdentifier normalizeColumnKey(DBIdentifier name) {
+        return DBIdentifier.removeDelimiters(DBIdentifier.toUpper(name, true));

Review comment:
       It is not really about the overhead (should be a "contains" in terms of 
complexity for most cases) but more about being fully deterministic and not 
"random".
   
   Why is it hard?
   Tables can be created in:
   - 
openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java#newTable
   - 
openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java#getValidColumnName
   - org.apache.openjpa.jdbc.schema.Schema#addTable
   - org.apache.openjpa.jdbc.schema.SchemaGroup#newTable
   
   Now if you take 1 more level you always have the dictionnary handy so if 
simpler we can just add the dict in the table.
   
   Alternative I had in mind was just to handle it in 
org.apache.openjpa.jdbc.sql.DBDictionary#getValidColumnName(org.apache.openjpa.jdbc.identifier.DBIdentifier,
 org.apache.openjpa.jdbc.schema.Table, boolean) in herddb dict and set the flag 
there.
   It is not about tracking it is delimited or not but tracking that the dict 
is in delimited mode or not, then you would do 
    if identifier.delimited then removeDelimited() else noop.
   




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to