Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-8128

Breaking change in 2.4.9 with Sql query with GString

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.4.9
    • Fix Version/s: 2.4.11
    • Component/s: groovy-runtime
    • Labels:
      None
    • Environment:
      Windows 7

      Description

      The following code worked for releases 2.4.8 and below:

          def query = """\
          SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED\r\n\
          select u5f_documenttype from DocVersion dv left outer join ClassDefinition cd on dv.object_class_id = cd.object_id 
          where cd.symbolic_name in ('Retail', 'RetailWeb') and dv.is_current = 1
          and u59_accountnumber = $acctNum and u5f_documenttype = 'Signature Card'
          """
          def docFound = 'No Doc'
          consumerSql.eachRow(query) {
      

      This code now fails in 2.4.9 and 2.4.10 with:

      Mar 22, 2017 9:23:43 AM groovy.sql.Sql eachRow
      WARNING: Failed to execute:     SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
          select u5f_documenttype from DocVersion dv left outer join ClassDefinition cd on dv.object_class_id = cd.object_id 
          where cd.symbolic_name in ('Retail', 'RetailWeb') and dv.is_current = 1
          and u59_accountnumber = ? and u5f_documenttype = 'Signature Card'
           because: com.microsoft.sqlserver.jdbc.SQLServerException: Unable to identify the table     SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
          select u5f_documenttype from DocVersion dv left outer join ClassDefinition cd on dv.object_class_id = cd.object_id 
          where cd.symbolic_name in ('Retail', 'RetailWeb') and dv.is_current = 1
          and u59_accountnumber = ? and u5f_documenttype = 'Signature Card'
           for the metadata.
      

      I have tried changing to using placeholders and name parameters and I get similar results.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                paulk Paul King
                Reporter:
                msauer53 Mike Sauer
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: