Reputation: 81
I'm writing my own lib on top of some Spring functionalities.
Sadly NamedParameterUtils.parseSqlStatement and related classes do not expose anything useful (almost everything is declared private, and by reading the issues and PRs on github there are no plans about changing that). I do not want to go for the Unsafe + field.setAccessible route...
.. so I copied NamedParameterUtils.parseSqlStatement method and other related code. Added tests for my use case and such. I've also added some test cases from NamedParameterUtilsTest.
My code coverage/test is just missing these lines:
...
if (statement[m + n] != STOP_SKIP[i].charAt(n)) {
endMatch = false;
break;
}
...
Those lines are inside the function "private static int skipCommentsAndQuotes(char[] statement, int position)" in the same file and called by NamedParameterUtils.parseSqlStatement.
What code should I pass to NamedParameterUtils.parseSqlStatement to reach and enter that if-statement? I did not change the function code, it's the same of the original code found on github (NamedParameterUtils.parseSqlStatement function code).
Upvotes: 0
Views: 14