Skip to content

Commit

Permalink
Merge pull request #1198 from zendesk/ben/empty_sql_comments
Browse files Browse the repository at this point in the history
deal with empty SQL comments
  • Loading branch information
osheroff authored Jan 25, 2019
2 parents fa12fe0 + 07b1145 commit 5637d53
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/main/antlr4/imports/mysql_idents.g4
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ SQL_UPGRADE_ENDCOMMENT: '*/' -> skip;
MAXWELL_ELIDED_PARSE_ISSUE: '/__MAXWELL__/';

SQL_COMMENT: '/*' ~'!' (.)*? '*/' -> skip;
SQL_EMPTY_COMMENT: '/**/' -> skip;

SQL_LINE_COMMENT: ('#' | '--') (~'\n')* ('\n' | EOF) -> skip;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,12 @@ public void testCommentSyntax2() {
assertThat(changes.size(), is(1));
}

@Test
public void testCommentSyntax3() {
List<SchemaChange> changes = parse("/**/ CREATE DATABASE if not exists `foo`");
assertThat(changes.size(), is(1));
}

@Test
public void testCurrentTimestamp() {
List<SchemaChange> changes = parse("CREATE TABLE `foo` ( `id` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP )");
Expand Down

0 comments on commit 5637d53

Please sign in to comment.