rfscouto commented on issue #5432:
URL: https://github.com/apache/shardingsphere/issues/5432#issuecomment-904029691


   Any update on this issue? Currently facing it as well.
   @sandynz why did you say "they are different and every one is complicated"? 
As far as I can see, we can implement something quite simple and aligned with 
PostgreSQL (PgResultSet.java):
   
   ```
   public int findColumn(String columnName) throws SQLException {
       checkClosed();
   
       int col = findColumnIndex(columnName);
       if (col == 0) {
         throw new PSQLException(
             GT.tr("The column name {0} was not found in this ResultSet.", 
columnName),
             PSQLState.UNDEFINED_COLUMN);
       }
       return col;
     }
   
   private int findColumnIndex(String columnName) {
       if (columnNameIndexMap == null) {
         if (originalQuery != null) {
           columnNameIndexMap = originalQuery.getResultSetColumnNameIndexMap();
         }
         if (columnNameIndexMap == null) {
           columnNameIndexMap = createColumnNameIndexMap(fields, 
connection.isColumnSanitiserDisabled());
         }
       }
   
       Integer index = columnNameIndexMap.get(columnName);
       if (index != null) {
         return index;
       }
   
       index = columnNameIndexMap.get(columnName.toLowerCase(Locale.US));
       if (index != null) {
         columnNameIndexMap.put(columnName, index);
         return index;
       }
   
       index = columnNameIndexMap.get(columnName.toUpperCase(Locale.US));
       if (index != null) {
         columnNameIndexMap.put(columnName, index);
         return index;
       }
   
       return 0;
     }
   ```
   


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