Describe the bug
In the extractQuestionMarkValues the values is detected with a regex that allows spaces in between the question marks.
And if Values are found you replace all the whitespaces in between comma.
This does not work with the replace logic which on the other replaces the the values template (?, ?, ?) with the actual values.
Example:
Statement:
insert into table values (?, ?)
Then the regex matches and extractedSubstring result is the following:
?, ?
Then the result is prefixed with brackets () and replace all the spaces resulting in
(?,?)
Then the statement.replace does not replace anything because the (?,?) is not found in insert into table values (?, ?)
Solution:
The String from the Regex matching group should not be manipulated at all
The matching group should include the opening and closing bracket ( )
the following regex would do the trick
(?i)VALUES\s*(\(\s*\?(?:,\s*\?\s*)*\))
I will create a PR with this.
Smartphone (please complete the following information):
Describe the bug In the extractQuestionMarkValues the values is detected with a regex that allows spaces in between the question marks. And if Values are found you replace all the whitespaces in between comma. This does not work with the replace logic which on the other replaces the the values template (?, ?, ?) with the actual values.
Example:
insert into table values (?, ?)
?, ?
(?,?)
statement.replace
does not replace anything because the(?,?)
is not found ininsert into table values (?, ?)
Solution:
(?i)VALUES\s*(\(\s*\?(?:,\s*\?\s*)*\))
I will create a PR with this.Smartphone (please complete the following information):