Commons DbUtils
  1. Commons DbUtils
  2. DBUTILS-34

BasicRowProcessor loses any information on database field case

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.0
    • Fix Version/s: 1.2
    • Labels:
      None

      Description

      In the BasicRowProcessor class there is a comment about the toMap method:
      " This implementation returns a <code>Map</code> with case insensitive column names as keys. Calls to map.get("COL") and map.get("col") return the same value"

      So the "contract" of this method just says that the "get" method is case insensitive. The current implementation obtains this result by putting all the keys in lowercase. This way we simply "lose" every information about the case of the fields. If you call the "keys" iterator, you don't have anymore the keys you inserted, but the "lowercase" version.

      I find it not completely correct: I would expect the keys to be exactly the ones I set on the database, also if I can get the value in a case insensitive way.
      I still have to find the idea for a pathc, but I'd like to know if you find my reasoning correct.

      I consider the current behaviour a problem, since I had to map the database fields to a bean and the "case" made it impossible, even if I had set my database to return mixed case fieldnames.

      1. BasicRowProcessor.java
        8 kB
        Julien Aymé
      2. BasicRowProcessor.patch
        4 kB
        Julien Aymé

        Activity

        Dan Fabulich made changes -
        Assignee Dan Fabulich [ dfabulich ]
        Henri Yandell made changes -
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Closed [ 6 ]
        Fix Version/s 1.2 [ 12312139 ]
        Julien Aymé made changes -
        Field Original Value New Value
        Attachment BasicRowProcessor.patch [ 12357116 ]
        Attachment BasicRowProcessor.java [ 12357117 ]
        Fabio Insaccanebbia created issue -

          People

          • Assignee:
            Dan Fabulich
            Reporter:
            Fabio Insaccanebbia
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development