mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
bug fixed for mysql parser & update pom version
This commit is contained in:
+15
-1
@@ -15,14 +15,18 @@
|
||||
*/
|
||||
package com.alibaba.druid.sql.dialect.mysql.ast.statement;
|
||||
|
||||
import com.alibaba.druid.sql.ast.SQLExpr;
|
||||
import com.alibaba.druid.sql.dialect.mysql.visitor.MySqlASTVisitor;
|
||||
|
||||
public class MySqlShowProcessListStatement extends MySqlStatementImpl implements MySqlShowStatement {
|
||||
|
||||
private boolean full = false;
|
||||
private SQLExpr where;
|
||||
|
||||
public void accept0(MySqlASTVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
if (visitor.visit(this)) {
|
||||
acceptChild(visitor, where);
|
||||
}
|
||||
visitor.endVisit(this);
|
||||
}
|
||||
|
||||
@@ -34,4 +38,14 @@ public class MySqlShowProcessListStatement extends MySqlStatementImpl implements
|
||||
this.full = full;
|
||||
}
|
||||
|
||||
public SQLExpr getWhere() {
|
||||
return where;
|
||||
}
|
||||
|
||||
public void setWhere(SQLExpr x) {
|
||||
if (x != null) {
|
||||
x.setParent(this);
|
||||
}
|
||||
this.where = x;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -934,12 +934,12 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
}
|
||||
|
||||
if (tddlHints) {
|
||||
SQLStatementImpl stmt = (SQLStatementImpl)this.parseStatement();
|
||||
SQLStatement stmt = this.parseStatement();
|
||||
stmt.setHeadHints(hints);
|
||||
statementList.add(stmt);
|
||||
return true;
|
||||
} else if (accept) {
|
||||
SQLStatementImpl stmt = (SQLStatementImpl) this.parseStatement();
|
||||
SQLStatement stmt = this.parseStatement();
|
||||
stmt.setHeadHints(hints);
|
||||
statementList.add(stmt);
|
||||
return true;
|
||||
@@ -1712,6 +1712,14 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
if (lexer.identifierEquals("PROCESSLIST")) {
|
||||
lexer.nextToken();
|
||||
MySqlShowProcessListStatement stmt = new MySqlShowProcessListStatement();
|
||||
|
||||
if (lexer.token() == Token.WHERE) {
|
||||
lexer.nextToken();
|
||||
stmt.setWhere(
|
||||
this.exprParser.expr()
|
||||
);
|
||||
}
|
||||
|
||||
return stmt;
|
||||
}
|
||||
|
||||
|
||||
@@ -888,6 +888,14 @@ public class MySqlOutputVisitor extends SQLASTOutputVisitor implements MySqlASTV
|
||||
|
||||
@Override
|
||||
public boolean visit(MySqlInsertStatement x) {
|
||||
List<SQLCommentHint> headHints = x.getHeadHintsDirect();
|
||||
if (headHints != null) {
|
||||
for (SQLCommentHint hint : headHints) {
|
||||
hint.accept(this);
|
||||
println();
|
||||
}
|
||||
}
|
||||
|
||||
print0(ucase ? "INSERT " : "insert ");
|
||||
|
||||
if (x.isLowPriority()) {
|
||||
|
||||
Reference in New Issue
Block a user