Derby
  1. Derby
  2. DERBY-4654

Restriction.toSQL() doesn't escape special characters

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 10.6.1.0
    • Fix Version/s: 10.6.2.1, 10.7.1.1
    • Component/s: SQL
    • Labels:
      None

      Description

      org.apache.derby.vti.Restriction.toSQL() adds double quotes around column names, but it does not escape the special characters (like double quotes) in the column names, so the returned string may not be valid SQL. This could cause problems when using the restriction to generate a query against an external database.

      Restriction.doubleQuote() should use IdUtil.normalToDelimited() to get proper quoting of the names.

      1. derby-4654.diff
        5 kB
        Knut Anders Hatlen
      2. derby-4654-2.diff
        5 kB
        Knut Anders Hatlen

        Activity

        Hide
        Knut Anders Hatlen added a comment -

        Attaching a patch with a test case that tests whether the returned restriction can be put into the WHERE clause of a SELECT statement. The patch also makes Restriction use the helper method in IdUtil to quote the string, and that makes the test case pass.

        Running regression tests now.

        Show
        Knut Anders Hatlen added a comment - Attaching a patch with a test case that tests whether the returned restriction can be put into the WHERE clause of a SELECT statement. The patch also makes Restriction use the helper method in IdUtil to quote the string, and that makes the test case pass. Running regression tests now.
        Hide
        Knut Anders Hatlen added a comment -

        All the regression tests passed.

        Show
        Knut Anders Hatlen added a comment - All the regression tests passed.
        Hide
        Knut Anders Hatlen added a comment -

        The new test for DERBY-4651 conflicted with the test in the patch for this issue. Uploading a new patch with an updated test.

        Committed revision 944152.

        Show
        Knut Anders Hatlen added a comment - The new test for DERBY-4651 conflicted with the test in the patch for this issue. Uploading a new patch with an updated test. Committed revision 944152.
        Hide
        Knut Anders Hatlen added a comment -

        Merged to 10.6 and committed revision 944159.

        Show
        Knut Anders Hatlen added a comment - Merged to 10.6 and committed revision 944159.

          People

          • Assignee:
            Knut Anders Hatlen
            Reporter:
            Knut Anders Hatlen
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development