This commit is contained in:
温少
2012-03-14 14:25:29 +08:00
parent b266a9c820
commit 6b7958dbfd
10 changed files with 74 additions and 49 deletions
@@ -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());
@@ -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) {
@@ -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);
@@ -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);
@@ -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);