Skip to content
Permalink
Browse files

[CONJ-618] Client prepared statement parsing double slash as comment …

…error

(cherry picked from commit 8a4877e)
  • Loading branch information...
rusher committed Jun 18, 2018
1 parent 5a8e22a commit 542cac05c91698d91c119253c25b4a53d75bd3de
@@ -237,11 +237,7 @@ public static boolean canAggregateSemiColon(String queryString, boolean noBacksl
break;

case '/':
if (state == LexState.SlashStarComment && lastChar == '*') {
state = LexState.Normal;
} else if (state == LexState.Normal && lastChar == '/') {
state = LexState.EOLComment;
}
if (state == LexState.SlashStarComment && lastChar == '*') state = LexState.Normal;
break;

case '#':
@@ -394,8 +390,6 @@ public static ClientPrepareResult rewritableParts(String queryString, boolean no
case '/':
if (state == LexState.SlashStarComment && lastChar == '*') {
state = LexState.Normal;
} else if (state == LexState.Normal && lastChar == '/') {
state = LexState.EOLComment;
}
break;

@@ -84,10 +84,12 @@ private boolean checkParsing(String sql, int paramNumber, boolean rewritable, bo
@Test
public void stringEscapeParsing() throws Exception {
assertTrue(checkParsing("select '\\'' as a, ? as b, \"\\\"\" as c, ? as d",
2, true, true,
2, false, true,
new String[]{
"select '\\'' as a, ",
"",
" as b, \"\\\"\" as c, ",
"",
" as d"},
new String[]{
"select '\\'' as a, ",

0 comments on commit 542cac0

Please sign in to comment.
You can’t perform that action at this time.