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

Groovy Sql , Does not excute SQL query , If there are odd numbers of single quotes in the query

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 2.5.10
    • None
    • None

    Description

      In versions of Groovy since 2.5.10 when Groovy SQL prepares to execute a query, it checks the query SQL for unterminated single quotes (line 145 of groovy.sql.ExtractIndexAndSql).

      This results into behavior : If query string  has odd numbers of single quotes it will fail with error IllegalStateException("Failed to process query. Unterminated ' character?"

      Example :  select  'NAME' =str_replace(str_replace,name ,'"', null ),"'", null) from Addresss.

      Here there are 5 single quotes so the query will fail.

      There is a quick solution as well 

      Try and match odd single quotes with even quotes.

      example :select  'NAME' =str_replace(str_replace,name ,'"', null ),"'", null)  --'

      Attachments

        Activity

          People

            Unassigned Unassigned
            shrikantss shri
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: