improved sql parser.

This commit is contained in:
wenshao
2017-06-15 09:50:49 +08:00
parent 4be1b561de
commit 0528af3207
20 changed files with 296 additions and 172 deletions
@@ -72,10 +72,13 @@ public class MySqlCreateTableParser extends SQLCreateTableParser {
}
public MySqlCreateTableStatement parseCrateTable(boolean acceptCreate) {
MySqlCreateTableStatement stmt = new MySqlCreateTableStatement();
if (acceptCreate) {
if (lexer.hasComment() && lexer.isKeepComments()) {
stmt.addBeforeComment(lexer.readAndResetComments());
}
accept(Token.CREATE);
}
MySqlCreateTableStatement stmt = new MySqlCreateTableStatement();
if (identifierEquals("TEMPORARY")) {
lexer.nextToken();
@@ -71,8 +71,7 @@ public class MySqlLexer extends Lexer {
}
public MySqlLexer(String input){
super(input);
super.keywods = DEFAULT_MYSQL_KEYWORDS;
this(input, true, true);
}
public MySqlLexer(String input, boolean skipComment, boolean keepComments){
@@ -407,7 +406,7 @@ public class MySqlLexer extends Lexer {
bufPos++;
}
stringVal = subString(mark, bufPos + 1);
stringVal = subString(mark, bufPos);
token = Token.LINE_COMMENT;
commentCount++;
if (keepComments) {
@@ -471,6 +471,9 @@ public class MySqlOutputVisitor extends SQLASTOutputVisitor implements MySqlASTV
}
public boolean visit(MySqlCreateTableStatement x) {
if (isPrettyFormat() && x.hasBeforeComment()) {
printlnComments(x.getBeforeCommentsDirect());
}
print0(ucase ? "CREATE " : "create ");
@@ -23,8 +23,4 @@ public interface OracleSelectTableSource extends SQLTableSource {
OracleSelectPivotBase getPivot();
void setPivot(OracleSelectPivotBase pivot);
SQLExpr getFlashback();
void setFlashback(SQLExpr flashback);
}