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) --'