[
https://issues.apache.org/jira/browse/GROOVY-9701?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Paul King closed GROOVY-9701.
-----------------------------
> 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
> Fix For: 6.0.0-alpha-1
>
>
> 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)