mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
mysql parser show statements
This commit is contained in:
+39
@@ -0,0 +1,39 @@
|
||||
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 MySqlShowEngineStatement extends MySqlStatementImpl {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private SQLExpr name;
|
||||
private Option option;
|
||||
|
||||
public void accept0(MySqlASTVisitor visitor) {
|
||||
if (visitor.visit(this)) {
|
||||
acceptChild(visitor, name);
|
||||
}
|
||||
visitor.endVisit(this);
|
||||
}
|
||||
|
||||
public SQLExpr getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(SQLExpr name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Option getOption() {
|
||||
return option;
|
||||
}
|
||||
|
||||
public void setOption(Option option) {
|
||||
this.option = option;
|
||||
}
|
||||
|
||||
public static enum Option {
|
||||
STATUS, MUTEX
|
||||
}
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package com.alibaba.druid.sql.dialect.mysql.ast.statement;
|
||||
|
||||
import com.alibaba.druid.sql.dialect.mysql.visitor.MySqlASTVisitor;
|
||||
|
||||
public class MySqlShowEnginesStatement extends MySqlStatementImpl {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private boolean storage = false;
|
||||
|
||||
public void accept0(MySqlASTVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
visitor.endVisit(this);
|
||||
}
|
||||
|
||||
public boolean isStorage() {
|
||||
return storage;
|
||||
}
|
||||
|
||||
public void setStorage(boolean storage) {
|
||||
this.storage = storage;
|
||||
}
|
||||
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright 1999-2011 Alibaba Group Holding Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.alibaba.druid.sql.dialect.mysql.ast.statement;
|
||||
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlSelectQueryBlock.Limit;
|
||||
import com.alibaba.druid.sql.dialect.mysql.visitor.MySqlASTVisitor;
|
||||
|
||||
public class MySqlShowErrorsStatement extends MySqlStatementImpl {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private boolean count = false;
|
||||
private Limit limit;
|
||||
|
||||
public boolean isCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
public void setCount(boolean count) {
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
public Limit getLimit() {
|
||||
return limit;
|
||||
}
|
||||
|
||||
public void setLimit(Limit limit) {
|
||||
this.limit = limit;
|
||||
}
|
||||
|
||||
public void accept0(MySqlASTVisitor visitor) {
|
||||
if (visitor.visit(this)) {
|
||||
acceptChild(visitor, limit);
|
||||
}
|
||||
visitor.endVisit(this);
|
||||
}
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright 1999-2011 Alibaba Group Holding Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
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 MySqlShowEventsStatement extends MySqlStatementImpl {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private SQLExpr schema;
|
||||
private SQLExpr like;
|
||||
private SQLExpr where;
|
||||
|
||||
public SQLExpr getSchema() {
|
||||
return schema;
|
||||
}
|
||||
|
||||
public void setSchema(SQLExpr schema) {
|
||||
this.schema = schema;
|
||||
}
|
||||
|
||||
public SQLExpr getLike() {
|
||||
return like;
|
||||
}
|
||||
|
||||
public void setLike(SQLExpr like) {
|
||||
this.like = like;
|
||||
}
|
||||
|
||||
public SQLExpr getWhere() {
|
||||
return where;
|
||||
}
|
||||
|
||||
public void setWhere(SQLExpr where) {
|
||||
this.where = where;
|
||||
}
|
||||
|
||||
public void accept0(MySqlASTVisitor visitor) {
|
||||
if (visitor.visit(this)) {
|
||||
acceptChild(visitor, schema);
|
||||
acceptChild(visitor, like);
|
||||
acceptChild(visitor, where);
|
||||
}
|
||||
visitor.endVisit(this);
|
||||
}
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
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 MySqlShowFunctionCodeStatement extends MySqlStatementImpl {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private SQLExpr name;
|
||||
|
||||
public void accept0(MySqlASTVisitor visitor) {
|
||||
if (visitor.visit(this)) {
|
||||
acceptChild(visitor, name);
|
||||
}
|
||||
visitor.endVisit(this);
|
||||
}
|
||||
|
||||
public SQLExpr getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(SQLExpr functionName) {
|
||||
this.name = functionName;
|
||||
}
|
||||
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright 1999-2011 Alibaba Group Holding Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
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 MySqlShowFunctionStatusStatement extends MySqlStatementImpl {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private SQLExpr like;
|
||||
private SQLExpr where;
|
||||
|
||||
public SQLExpr getLike() {
|
||||
return like;
|
||||
}
|
||||
|
||||
public void setLike(SQLExpr like) {
|
||||
this.like = like;
|
||||
}
|
||||
|
||||
public SQLExpr getWhere() {
|
||||
return where;
|
||||
}
|
||||
|
||||
public void setWhere(SQLExpr where) {
|
||||
this.where = where;
|
||||
}
|
||||
|
||||
public void accept0(MySqlASTVisitor visitor) {
|
||||
if (visitor.visit(this)) {
|
||||
acceptChild(visitor, like);
|
||||
acceptChild(visitor, where);
|
||||
}
|
||||
visitor.endVisit(this);
|
||||
}
|
||||
}
|
||||
+144
-87
@@ -52,6 +52,7 @@ import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlReplicateStatement
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlResetStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlRollbackStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlSelectQueryBlock;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlSelectQueryBlock.Limit;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlSetCharSetStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlSetNamesStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlSetTransactionIsolationLevelStatement;
|
||||
@@ -70,6 +71,12 @@ import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowCreateTableSta
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowCreateTriggerStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowCreateViewStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowDatabasesStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowEngineStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowEnginesStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowErrorsStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowEventsStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowFunctionCodeStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowFunctionStatusStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowMasterLogsStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowStatusStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowTablesStatement;
|
||||
@@ -107,26 +114,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
public SQLUpdateStatement parseUpdateStatement() throws ParserException {
|
||||
MySqlUpdateStatement stmt = (MySqlUpdateStatement) super.parseUpdateStatement();
|
||||
|
||||
if (lexer.token() == Token.LIMIT) {
|
||||
lexer.nextToken();
|
||||
|
||||
MySqlSelectQueryBlock.Limit limit = new MySqlSelectQueryBlock.Limit();
|
||||
|
||||
SQLExpr temp = this.exprParser.expr();
|
||||
if (lexer.token() == (Token.COMMA)) {
|
||||
limit.setOffset(temp);
|
||||
lexer.nextToken();
|
||||
limit.setRowCount(exprParser.expr());
|
||||
} else if (identifierEquals("OFFSET")) {
|
||||
limit.setRowCount(temp);
|
||||
lexer.nextToken();
|
||||
limit.setOffset(exprParser.expr());
|
||||
} else {
|
||||
limit.setRowCount(temp);
|
||||
}
|
||||
|
||||
stmt.setLimit(limit);
|
||||
}
|
||||
stmt.setLimit(parseLimit());
|
||||
|
||||
return stmt;
|
||||
}
|
||||
@@ -190,15 +178,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
deleteStatement.setOrderBy(orderBy);
|
||||
}
|
||||
|
||||
if (lexer.token() == Token.LIMIT) {
|
||||
lexer.nextToken();
|
||||
|
||||
MySqlSelectQueryBlock.Limit limit = new MySqlSelectQueryBlock.Limit();
|
||||
SQLExpr rowCount = exprParser.expr();
|
||||
limit.setRowCount(rowCount);
|
||||
|
||||
deleteStatement.setLimit(limit);
|
||||
}
|
||||
deleteStatement.setLimit(parseLimit());
|
||||
|
||||
return deleteStatement;
|
||||
}
|
||||
@@ -466,10 +446,29 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
accept(Token.LPAREN);
|
||||
accept(Token.STAR);
|
||||
accept(Token.RPAREN);
|
||||
acceptIdentifier("WARNINGS");
|
||||
|
||||
MySqlShowWarningsStatement stmt = new MySqlShowWarningsStatement();
|
||||
stmt.setCount(true);
|
||||
if (identifierEquals("ERRORS")) {
|
||||
lexer.nextToken();
|
||||
|
||||
MySqlShowErrorsStatement stmt = new MySqlShowErrorsStatement();
|
||||
stmt.setCount(true);
|
||||
|
||||
return stmt;
|
||||
} else {
|
||||
acceptIdentifier("WARNINGS");
|
||||
|
||||
MySqlShowWarningsStatement stmt = new MySqlShowWarningsStatement();
|
||||
stmt.setCount(true);
|
||||
|
||||
return stmt;
|
||||
}
|
||||
}
|
||||
|
||||
if (identifierEquals("ERRORS")) {
|
||||
lexer.nextToken();
|
||||
|
||||
MySqlShowErrorsStatement stmt = new MySqlShowErrorsStatement();
|
||||
stmt.setLimit(parseLimit());
|
||||
|
||||
return stmt;
|
||||
}
|
||||
@@ -576,25 +575,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
stmt.setFrom(this.exprParser.expr());
|
||||
}
|
||||
|
||||
if (lexer.token() == Token.LIMIT) {
|
||||
lexer.nextToken();
|
||||
|
||||
MySqlSelectQueryBlock.Limit limit = new MySqlSelectQueryBlock.Limit();
|
||||
|
||||
SQLExpr temp = this.exprParser.expr();
|
||||
if (lexer.token() == (Token.COMMA)) {
|
||||
limit.setOffset(temp);
|
||||
lexer.nextToken();
|
||||
limit.setRowCount(exprParser.expr());
|
||||
} else if (identifierEquals("OFFSET")) {
|
||||
limit.setRowCount(temp);
|
||||
lexer.nextToken();
|
||||
limit.setOffset(exprParser.expr());
|
||||
} else {
|
||||
limit.setRowCount(temp);
|
||||
}
|
||||
stmt.setLimit(limit);
|
||||
}
|
||||
stmt.setLimit(parseLimit());
|
||||
|
||||
return stmt;
|
||||
}
|
||||
@@ -603,69 +584,140 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
lexer.nextToken();
|
||||
return new MySqlShowContributorsStatement();
|
||||
}
|
||||
|
||||
|
||||
if (lexer.token() == Token.CREATE) {
|
||||
lexer.nextToken();
|
||||
|
||||
|
||||
if (identifierEquals("DATABASE")) {
|
||||
lexer.nextToken();
|
||||
|
||||
|
||||
MySqlShowCreateDatabaseStatement stmt = new MySqlShowCreateDatabaseStatement();
|
||||
stmt.setDatabase(this.exprParser.name());
|
||||
return stmt;
|
||||
}
|
||||
|
||||
|
||||
if (identifierEquals("EVENT")) {
|
||||
lexer.nextToken();
|
||||
|
||||
|
||||
MySqlShowCreateEventStatement stmt = new MySqlShowCreateEventStatement();
|
||||
stmt.setEventName(this.exprParser.name());
|
||||
return stmt;
|
||||
}
|
||||
|
||||
|
||||
if (identifierEquals("FUNCTION")) {
|
||||
lexer.nextToken();
|
||||
|
||||
|
||||
MySqlShowCreateFunctionStatement stmt = new MySqlShowCreateFunctionStatement();
|
||||
stmt.setName(this.exprParser.name());
|
||||
return stmt;
|
||||
}
|
||||
|
||||
|
||||
if (identifierEquals("PROCEDURE")) {
|
||||
lexer.nextToken();
|
||||
|
||||
|
||||
MySqlShowCreateProcedureStatement stmt = new MySqlShowCreateProcedureStatement();
|
||||
stmt.setName(this.exprParser.name());
|
||||
return stmt;
|
||||
}
|
||||
|
||||
|
||||
if (lexer.token() == Token.TABLE) {
|
||||
lexer.nextToken();
|
||||
|
||||
|
||||
MySqlShowCreateTableStatement stmt = new MySqlShowCreateTableStatement();
|
||||
stmt.setName(this.exprParser.name());
|
||||
return stmt;
|
||||
}
|
||||
|
||||
|
||||
if (lexer.token() == Token.VIEW) {
|
||||
lexer.nextToken();
|
||||
|
||||
|
||||
MySqlShowCreateViewStatement stmt = new MySqlShowCreateViewStatement();
|
||||
stmt.setName(this.exprParser.name());
|
||||
return stmt;
|
||||
}
|
||||
|
||||
|
||||
if (identifierEquals("TRIGGER")) {
|
||||
lexer.nextToken();
|
||||
|
||||
|
||||
MySqlShowCreateTriggerStatement stmt = new MySqlShowCreateTriggerStatement();
|
||||
stmt.setName(this.exprParser.name());
|
||||
return stmt;
|
||||
}
|
||||
|
||||
|
||||
throw new ParserException("TODO " + lexer.stringVal());
|
||||
}
|
||||
|
||||
if (identifierEquals("ENGINE")) {
|
||||
lexer.nextToken();
|
||||
MySqlShowEngineStatement stmt = new MySqlShowEngineStatement();
|
||||
stmt.setName(this.exprParser.name());
|
||||
stmt.setOption(MySqlShowEngineStatement.Option.valueOf(lexer.stringVal().toUpperCase()));
|
||||
lexer.nextToken();
|
||||
return stmt;
|
||||
}
|
||||
|
||||
if (identifierEquals("STORAGE")) {
|
||||
lexer.nextToken();
|
||||
acceptIdentifier("ENGINES");
|
||||
MySqlShowEnginesStatement stmt = new MySqlShowEnginesStatement();
|
||||
stmt.setStorage(true);
|
||||
return stmt;
|
||||
}
|
||||
|
||||
if (identifierEquals("ENGINES")) {
|
||||
lexer.nextToken();
|
||||
MySqlShowEnginesStatement stmt = new MySqlShowEnginesStatement();
|
||||
return stmt;
|
||||
}
|
||||
|
||||
if (identifierEquals("EVENTS")) {
|
||||
lexer.nextToken();
|
||||
MySqlShowEventsStatement stmt = new MySqlShowEventsStatement();
|
||||
|
||||
if (lexer.token() == Token.FROM || lexer.token() == Token.IN) {
|
||||
lexer.nextToken();
|
||||
stmt.setSchema(this.exprParser.name());
|
||||
}
|
||||
|
||||
if (lexer.token() == Token.LIKE) {
|
||||
lexer.nextToken();
|
||||
stmt.setLike(this.exprParser.expr());
|
||||
}
|
||||
|
||||
if (lexer.token() == Token.WHERE) {
|
||||
lexer.nextToken();
|
||||
stmt.setWhere(this.exprParser.expr());
|
||||
}
|
||||
return stmt;
|
||||
}
|
||||
|
||||
if (identifierEquals("FUNCTION")) {
|
||||
lexer.nextToken();
|
||||
|
||||
if (identifierEquals("CODE")) {
|
||||
lexer.nextToken();
|
||||
MySqlShowFunctionCodeStatement stmt = new MySqlShowFunctionCodeStatement();
|
||||
stmt.setName(this.exprParser.name());
|
||||
return stmt;
|
||||
}
|
||||
|
||||
acceptIdentifier("STATUS");
|
||||
MySqlShowFunctionStatusStatement stmt = new MySqlShowFunctionStatusStatement();
|
||||
|
||||
if (lexer.token() == Token.LIKE) {
|
||||
lexer.nextToken();
|
||||
stmt.setLike(this.exprParser.expr());
|
||||
}
|
||||
|
||||
if (lexer.token() == Token.WHERE) {
|
||||
lexer.nextToken();
|
||||
stmt.setWhere(this.exprParser.expr());
|
||||
}
|
||||
return stmt;
|
||||
}
|
||||
|
||||
//MySqlShowFunctionStatusStatement
|
||||
|
||||
throw new ParserException("TODO " + lexer.stringVal());
|
||||
}
|
||||
|
||||
@@ -690,26 +742,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
private MySqlShowWarningsStatement parseShowWarnings() throws ParserException {
|
||||
MySqlShowWarningsStatement stmt = new MySqlShowWarningsStatement();
|
||||
|
||||
if (lexer.token() == Token.LIMIT) {
|
||||
lexer.nextToken();
|
||||
|
||||
MySqlSelectQueryBlock.Limit limit = new MySqlSelectQueryBlock.Limit();
|
||||
|
||||
SQLExpr temp = this.exprParser.expr();
|
||||
if (lexer.token() == (Token.COMMA)) {
|
||||
limit.setOffset(temp);
|
||||
lexer.nextToken();
|
||||
limit.setRowCount(exprParser.expr());
|
||||
} else if (identifierEquals("OFFSET")) {
|
||||
limit.setRowCount(temp);
|
||||
lexer.nextToken();
|
||||
limit.setOffset(exprParser.expr());
|
||||
} else {
|
||||
limit.setRowCount(temp);
|
||||
}
|
||||
|
||||
stmt.setLimit(limit);
|
||||
}
|
||||
stmt.setLimit(parseLimit());
|
||||
|
||||
return stmt;
|
||||
}
|
||||
@@ -1357,4 +1390,28 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
return stmt;
|
||||
}
|
||||
}
|
||||
|
||||
private Limit parseLimit() {
|
||||
if (lexer.token() == Token.LIMIT) {
|
||||
lexer.nextToken();
|
||||
|
||||
MySqlSelectQueryBlock.Limit limit = new MySqlSelectQueryBlock.Limit();
|
||||
|
||||
SQLExpr temp = this.exprParser.expr();
|
||||
if (lexer.token() == (Token.COMMA)) {
|
||||
limit.setOffset(temp);
|
||||
lexer.nextToken();
|
||||
limit.setRowCount(exprParser.expr());
|
||||
} else if (identifierEquals("OFFSET")) {
|
||||
limit.setRowCount(temp);
|
||||
lexer.nextToken();
|
||||
limit.setOffset(exprParser.expr());
|
||||
} else {
|
||||
limit.setRowCount(temp);
|
||||
}
|
||||
return limit;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,6 +61,12 @@ import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowCreateTableSta
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowCreateTriggerStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowCreateViewStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowDatabasesStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowEngineStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowEnginesStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowErrorsStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowEventsStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowFunctionCodeStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowFunctionStatusStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowMasterLogsStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowStatusStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowTablesStatement;
|
||||
@@ -291,4 +297,28 @@ public interface MySqlASTVisitor extends SQLASTVisitor {
|
||||
boolean visit(MySqlShowCreateViewStatement x);
|
||||
|
||||
void endVisit(MySqlShowCreateViewStatement x);
|
||||
|
||||
boolean visit(MySqlShowEngineStatement x);
|
||||
|
||||
void endVisit(MySqlShowEngineStatement x);
|
||||
|
||||
boolean visit(MySqlShowEnginesStatement x);
|
||||
|
||||
void endVisit(MySqlShowEnginesStatement x);
|
||||
|
||||
boolean visit(MySqlShowErrorsStatement x);
|
||||
|
||||
void endVisit(MySqlShowErrorsStatement x);
|
||||
|
||||
boolean visit(MySqlShowEventsStatement x);
|
||||
|
||||
void endVisit(MySqlShowEventsStatement x);
|
||||
|
||||
boolean visit(MySqlShowFunctionCodeStatement x);
|
||||
|
||||
void endVisit(MySqlShowFunctionCodeStatement x);
|
||||
|
||||
boolean visit(MySqlShowFunctionStatusStatement x);
|
||||
|
||||
void endVisit(MySqlShowFunctionStatusStatement x);
|
||||
}
|
||||
|
||||
@@ -48,6 +48,12 @@ import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowCreateTableSta
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowCreateTriggerStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowCreateViewStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowDatabasesStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowEngineStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowEnginesStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowErrorsStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowEventsStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowFunctionCodeStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowFunctionStatusStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowMasterLogsStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowStatusStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowTablesStatement;
|
||||
@@ -630,4 +636,64 @@ public class MySqlASTVisitorAdapter extends SQLASTVisitorAdapter implements
|
||||
public void endVisit(MySqlShowCreateViewStatement x) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean visit(MySqlShowEngineStatement x) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endVisit(MySqlShowEngineStatement x) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean visit(MySqlShowEnginesStatement x) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endVisit(MySqlShowEnginesStatement x) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean visit(MySqlShowErrorsStatement x) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endVisit(MySqlShowErrorsStatement x) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean visit(MySqlShowEventsStatement x) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endVisit(MySqlShowEventsStatement x) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean visit(MySqlShowFunctionCodeStatement x) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endVisit(MySqlShowFunctionCodeStatement x) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean visit(MySqlShowFunctionStatusStatement x) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endVisit(MySqlShowFunctionStatusStatement x) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+142
-29
@@ -80,6 +80,12 @@ import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowCreateTableSta
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowCreateTriggerStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowCreateViewStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowDatabasesStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowEngineStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowEnginesStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowErrorsStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowEventsStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowFunctionCodeStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowFunctionStatusStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowMasterLogsStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowStatusStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowTablesStatement;
|
||||
@@ -1466,9 +1472,9 @@ public class MySqlOutputVisitor extends SQLASTOutputVisitor implements MySqlASTV
|
||||
|
||||
@Override
|
||||
public void endVisit(MySqlSetNamesStatement x) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean visit(MySqlSetCharSetStatement x) {
|
||||
print("SET CHARACTER SET ");
|
||||
@@ -1483,15 +1489,15 @@ public class MySqlOutputVisitor extends SQLASTOutputVisitor implements MySqlASTV
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void endVisit(MySqlSetCharSetStatement x) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endVisit(MySqlShowAuthorsStatement x) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1499,12 +1505,12 @@ public class MySqlOutputVisitor extends SQLASTOutputVisitor implements MySqlASTV
|
||||
print("SHOW AUTHORS");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void endVisit(MySqlShowBinaryLogsStatement x) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean visit(MySqlShowBinaryLogsStatement x) {
|
||||
print("SHOW BINARY LOGS");
|
||||
@@ -1519,9 +1525,9 @@ public class MySqlOutputVisitor extends SQLASTOutputVisitor implements MySqlASTV
|
||||
|
||||
@Override
|
||||
public void endVisit(MySqlShowMasterLogsStatement x) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean visit(MySqlShowCollationStatement x) {
|
||||
print("SHOW COLLATION");
|
||||
@@ -1535,12 +1541,12 @@ public class MySqlOutputVisitor extends SQLASTOutputVisitor implements MySqlASTV
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void endVisit(MySqlShowCollationStatement x) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean visit(MySqlShowBinLogEventsStatement x) {
|
||||
print("SHOW BINLOG EVENTS");
|
||||
@@ -1558,10 +1564,10 @@ public class MySqlOutputVisitor extends SQLASTOutputVisitor implements MySqlASTV
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void endVisit(MySqlShowBinLogEventsStatement x) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1580,7 +1586,7 @@ public class MySqlOutputVisitor extends SQLASTOutputVisitor implements MySqlASTV
|
||||
|
||||
@Override
|
||||
public void endVisit(MySqlShowCharacterSetStatement x) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1591,19 +1597,19 @@ public class MySqlOutputVisitor extends SQLASTOutputVisitor implements MySqlASTV
|
||||
|
||||
@Override
|
||||
public void endVisit(MySqlShowContributorsStatement x) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean visit(MySqlShowCreateDatabaseStatement x) {
|
||||
print("SHOW CREATE DATABASE ");
|
||||
x.getDatabase().accept(this);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void endVisit(MySqlShowCreateDatabaseStatement x) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1615,31 +1621,31 @@ public class MySqlOutputVisitor extends SQLASTOutputVisitor implements MySqlASTV
|
||||
|
||||
@Override
|
||||
public void endVisit(MySqlShowCreateEventStatement x) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean visit(MySqlShowCreateFunctionStatement x) {
|
||||
print("SHOW CREATE FUNCTION ");
|
||||
x.getName().accept(this);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void endVisit(MySqlShowCreateFunctionStatement x) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean visit(MySqlShowCreateProcedureStatement x) {
|
||||
print("SHOW CREATE PROCEDURE ");
|
||||
x.getName().accept(this);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void endVisit(MySqlShowCreateProcedureStatement x) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1651,7 +1657,7 @@ public class MySqlOutputVisitor extends SQLASTOutputVisitor implements MySqlASTV
|
||||
|
||||
@Override
|
||||
public void endVisit(MySqlShowCreateTableStatement x) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1663,7 +1669,7 @@ public class MySqlOutputVisitor extends SQLASTOutputVisitor implements MySqlASTV
|
||||
|
||||
@Override
|
||||
public void endVisit(MySqlShowCreateTriggerStatement x) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1675,6 +1681,113 @@ public class MySqlOutputVisitor extends SQLASTOutputVisitor implements MySqlASTV
|
||||
|
||||
@Override
|
||||
public void endVisit(MySqlShowCreateViewStatement x) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean visit(MySqlShowEngineStatement x) {
|
||||
print("SHOW ENGINE ");
|
||||
x.getName().accept(this);
|
||||
print(' ');
|
||||
print(x.getOption().name());
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endVisit(MySqlShowEngineStatement x) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean visit(MySqlShowEnginesStatement x) {
|
||||
if (x.isStorage()) {
|
||||
print("SHOW STORAGE ENGINES");
|
||||
} else {
|
||||
print("SHOW ENGINES");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endVisit(MySqlShowEnginesStatement x) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean visit(MySqlShowErrorsStatement x) {
|
||||
if (x.isCount()) {
|
||||
print("SHOW COUNT(*) ERRORS");
|
||||
} else {
|
||||
print("SHOW ERRORS");
|
||||
if (x.getLimit() != null) {
|
||||
print(' ');
|
||||
x.getLimit().accept(this);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endVisit(MySqlShowErrorsStatement x) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean visit(MySqlShowEventsStatement x) {
|
||||
print("SHOW EVENTS");
|
||||
if (x.getSchema() != null) {
|
||||
print(" FROM ");
|
||||
x.getSchema().accept(this);
|
||||
}
|
||||
|
||||
if (x.getLike() != null) {
|
||||
print(" LIKE ");
|
||||
x.getLike().accept(this);
|
||||
}
|
||||
|
||||
if (x.getWhere() != null) {
|
||||
print(" WHERE ");
|
||||
x.getWhere().accept(this);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endVisit(MySqlShowEventsStatement x) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean visit(MySqlShowFunctionCodeStatement x) {
|
||||
print("SHOW FUNCTION CODE ");
|
||||
x.getName().accept(this);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endVisit(MySqlShowFunctionCodeStatement x) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean visit(MySqlShowFunctionStatusStatement x) {
|
||||
print("SHOW FUNCTION STATUS");
|
||||
if (x.getLike() != null) {
|
||||
print(" LIKE ");
|
||||
x.getLike().accept(this);
|
||||
}
|
||||
|
||||
if (x.getWhere() != null) {
|
||||
print(" WHERE ");
|
||||
x.getWhere().accept(this);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endVisit(MySqlShowFunctionStatusStatement x) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +57,12 @@ import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowCreateTableSta
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowCreateTriggerStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowCreateViewStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowDatabasesStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowEngineStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowEnginesStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowErrorsStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowEventsStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowFunctionCodeStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowFunctionStatusStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowMasterLogsStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowStatusStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowTablesStatement;
|
||||
@@ -692,4 +698,64 @@ public class MySqlSchemaStatVisitor extends SchemaStatVisitor implements MySqlAS
|
||||
public void endVisit(MySqlShowCreateViewStatement x) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean visit(MySqlShowEngineStatement x) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endVisit(MySqlShowEngineStatement x) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean visit(MySqlShowEnginesStatement x) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endVisit(MySqlShowEnginesStatement x) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean visit(MySqlShowErrorsStatement x) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endVisit(MySqlShowErrorsStatement x) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean visit(MySqlShowEventsStatement x) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endVisit(MySqlShowEventsStatement x) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean visit(MySqlShowFunctionCodeStatement x) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endVisit(MySqlShowFunctionCodeStatement x) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean visit(MySqlShowFunctionStatusStatement x) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endVisit(MySqlShowFunctionStatusStatement x) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user