[ 
https://issues.apache.org/jira/browse/GROOVY-9701?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18074583#comment-18074583
 ] 

Paul King commented on GROOVY-9701:
-----------------------------------

It's not so much the odd number of single quotes but rather some deficiencies 
in double quote parsing. 

> ExtractIndexAndSql does not recognize double-quoted SQL identifiers
> -------------------------------------------------------------------
>
>                 Key: GROOVY-9701
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9701
>             Project: Groovy
>          Issue Type: Bug
>          Components: groovy-runtime, SQL processing
>    Affects Versions: 2.5.10
>            Reporter: shri
>            Assignee: Paul King
>            Priority: Minor
>
> 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|https://www.codota.com/code/java/packages/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) 
>  --'



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to