mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
refactor
This commit is contained in:
+1
-1
@@ -107,7 +107,7 @@ public class MySqlInsertStatement extends SQLInsertStatement {
|
||||
|
||||
protected void accept0(MySqlASTVisitor visitor) {
|
||||
if (visitor.visit(this)) {
|
||||
this.acceptChild(visitor, getTableName());
|
||||
this.acceptChild(visitor, getTableSource());
|
||||
this.acceptChild(visitor, getColumns());
|
||||
this.acceptChild(visitor, getValuesList());
|
||||
this.acceptChild(visitor, getQuery());
|
||||
|
||||
+30
-27
@@ -117,7 +117,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
lexer.nextToken();
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
lexer.nextToken();
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -910,40 +910,43 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
}
|
||||
|
||||
public SQLInsertStatement parseInsert() {
|
||||
accept(Token.INSERT);
|
||||
|
||||
MySqlInsertStatement insertStatement = new MySqlInsertStatement();
|
||||
|
||||
if (identifierEquals("LOW_PRIORITY")) {
|
||||
insertStatement.setLowPriority(true);
|
||||
if (lexer.token() == Token.INSERT) {
|
||||
lexer.nextToken();
|
||||
}
|
||||
|
||||
if (identifierEquals("DELAYED")) {
|
||||
insertStatement.setDelayed(true);
|
||||
lexer.nextToken();
|
||||
}
|
||||
if (identifierEquals("LOW_PRIORITY")) {
|
||||
insertStatement.setLowPriority(true);
|
||||
lexer.nextToken();
|
||||
}
|
||||
|
||||
if (identifierEquals("HIGH_PRIORITY")) {
|
||||
insertStatement.setHighPriority(true);
|
||||
lexer.nextToken();
|
||||
}
|
||||
if (identifierEquals("DELAYED")) {
|
||||
insertStatement.setDelayed(true);
|
||||
lexer.nextToken();
|
||||
}
|
||||
|
||||
if (identifierEquals("IGNORE")) {
|
||||
insertStatement.setIgnore(true);
|
||||
lexer.nextToken();
|
||||
}
|
||||
if (identifierEquals("HIGH_PRIORITY")) {
|
||||
insertStatement.setHighPriority(true);
|
||||
lexer.nextToken();
|
||||
}
|
||||
|
||||
if (lexer.token() == Token.INTO) {
|
||||
lexer.nextToken();
|
||||
}
|
||||
if (identifierEquals("IGNORE")) {
|
||||
insertStatement.setIgnore(true);
|
||||
lexer.nextToken();
|
||||
}
|
||||
|
||||
SQLName tableName = this.exprParser.name();
|
||||
insertStatement.setTableName(tableName);
|
||||
if (lexer.token() == Token.INTO) {
|
||||
lexer.nextToken();
|
||||
}
|
||||
|
||||
SQLName tableName = this.exprParser.name();
|
||||
insertStatement.setTableName(tableName);
|
||||
|
||||
if (lexer.token() == Token.IDENTIFIER) {
|
||||
insertStatement.setAlias(lexer.stringVal());
|
||||
lexer.nextToken();
|
||||
}
|
||||
|
||||
if (lexer.token() == Token.IDENTIFIER) {
|
||||
insertStatement.setAlias(lexer.stringVal());
|
||||
lexer.nextToken();
|
||||
}
|
||||
|
||||
if (lexer.token() == (Token.LPAREN)) {
|
||||
|
||||
@@ -725,7 +725,6 @@ public class MySqlOutputVisitor extends SQLASTOutputVisitor implements MySqlASTV
|
||||
x.getTableName().accept(this);
|
||||
|
||||
if (x.getColumns().size() > 0) {
|
||||
incrementIndent();
|
||||
println();
|
||||
print("(");
|
||||
for (int i = 0, size = x.getColumns().size(); i < size; ++i) {
|
||||
@@ -739,7 +738,6 @@ public class MySqlOutputVisitor extends SQLASTOutputVisitor implements MySqlASTV
|
||||
x.getColumns().get(i).accept(this);
|
||||
}
|
||||
print(")");
|
||||
decrementIndent();
|
||||
}
|
||||
|
||||
if (x.getValuesList().size() != 0) {
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ public class OracleInsertStatement extends SQLInsertStatement implements OracleS
|
||||
|
||||
public void accept0(OracleASTVisitor visitor) {
|
||||
if (visitor.visit(this)) {
|
||||
this.acceptChild(visitor, tableName);
|
||||
this.acceptChild(visitor, tableSource);
|
||||
this.acceptChild(visitor, columns);
|
||||
this.acceptChild(visitor, values);
|
||||
this.acceptChild(visitor, query);
|
||||
|
||||
+1
-1
@@ -173,7 +173,7 @@ public class OracleMultiInsertStatement extends OracleStatementImpl {
|
||||
@Override
|
||||
public void accept0(OracleASTVisitor visitor) {
|
||||
if (visitor.visit(this)) {
|
||||
this.acceptChild(visitor, tableName);
|
||||
this.acceptChild(visitor, tableSource);
|
||||
this.acceptChild(visitor, columns);
|
||||
this.acceptChild(visitor, values);
|
||||
this.acceptChild(visitor, query);
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ public class PGInsertStatement extends SQLInsertStatement implements PGSQLStatem
|
||||
public void accept0(PGASTVisitor visitor) {
|
||||
if (visitor.visit(this)) {
|
||||
this.acceptChild(visitor, with);
|
||||
this.acceptChild(visitor, tableName);
|
||||
this.acceptChild(visitor, tableSource);
|
||||
this.acceptChild(visitor, columns);
|
||||
this.acceptChild(visitor, valuesList);
|
||||
this.acceptChild(visitor, query);
|
||||
|
||||
Reference in New Issue
Block a user