Skip to content

Commit

Permalink
[CONJ-618] Client prepared statement parsing double slash as comment …
Browse files Browse the repository at this point in the history
…error
  • Loading branch information
rusher committed Jun 18, 2018
1 parent e9e8acc commit 8a4877e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 '#':
Expand Down Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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, ",
Expand Down

0 comments on commit 8a4877e

Please sign in to comment.