Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-3315

Should UCS_BASIC character types have to look at collation elements when dealing with escape character in the LIKE clause?

    XMLWordPrintableJSON

Details

    • Task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 10.3.1.4, 10.3.2.1, 10.4.1.3
    • 10.3.3.0, 10.4.1.3
    • JDBC
    • None

    Description

      Code in SQLChar.like(dvd, dvd) method at line number 1767 is executed for non-national/non-collation sensitive character types ie for UCS_BASIC character types and the code looks as follows
      // Make sure we fail for both varchar an nvarchar
      // for multiple collation characters.
      SQLChar escapeSQLChar = (SQLChar) escape;
      int[] escapeIntArray = escapeSQLChar.getIntArray();
      if (escapeIntArray != null && (escapeIntArray.length != 1))

      { throw StandardException.newException(SQLState.LANG_INVALID_ESCAPE_CHARACTER,new String (escapeSQLChar.getCharArray())); }

      It appears that we are trying to see if number of collation elements associated with escape character is more than 1 and if yes, then we throw exception. Seems like a code like above should be done for collation sensitive character types and not for UCS_BASIC character types. Interestingly, nothing like this is getting checked for national character datatypes.

      This behavior was detected while working on DERBY-3302

      Attachments

        Activity

          People

            mamtas Mamta A. Satoor
            mamtas Mamta A. Satoor
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: