Skip to content

Commit

Permalink
Fixed #27: SqlScriptReader is parsing string literals from comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
abrougher authored and chenson42 committed May 16, 2016
1 parent 6203190 commit b365ce2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Expand Up @@ -140,8 +140,9 @@ private final String removeComments(String s) {
char prev = '\0';
int index = 0;
for (char cur : characters) {

literalInfo = switchLiteral(literalInfo, index, characters);
if (!inLineComment) {
literalInfo = switchLiteral(literalInfo, index, characters);
}

if (literalInfo == null && !inLineComment && !inBlockComment) {
inBlockComment = isBlockCommentStart(prev, cur);
Expand Down Expand Up @@ -227,7 +228,9 @@ private final boolean checkStatementEnds(String s) {
char prev = '\0';
int index = 0;
for (char cur : characters) {
literalInfo = switchLiteral(literalInfo, index, characters);
if (!inLineComment) {
literalInfo = switchLiteral(literalInfo, index, characters);
}

if (literalInfo == null && !inLineComment && !inBlockComment) {
inBlockComment = isBlockCommentStart(prev, cur);
Expand Down
2 changes: 2 additions & 0 deletions symmetric-db/src/test/resources/test-script-1.sql
Expand Up @@ -19,6 +19,8 @@
-- under the License.
--

-- This is a comment with a single literal. It's

-- This is a comment
select * from
TEST where
Expand Down

0 comments on commit b365ce2

Please sign in to comment.