mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improved sql parser.
This commit is contained in:
+4
-1
@@ -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 ");
|
||||
|
||||
|
||||
-4
@@ -23,8 +23,4 @@ public interface OracleSelectTableSource extends SQLTableSource {
|
||||
OracleSelectPivotBase getPivot();
|
||||
|
||||
void setPivot(OracleSelectPivotBase pivot);
|
||||
|
||||
SQLExpr getFlashback();
|
||||
|
||||
void setFlashback(SQLExpr flashback);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user