mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improved sql parser. for issue #1775
This commit is contained in:
+2
-2
@@ -24,8 +24,8 @@ public class MySqlSetCharSetStatement extends MySqlStatementImpl {
|
||||
private String collate;
|
||||
|
||||
public void accept0(MySqlASTVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
visitor.endVisit(this);
|
||||
// visitor.visit(this);
|
||||
// visitor.endVisit(this);
|
||||
}
|
||||
|
||||
public String getCharSet() {
|
||||
|
||||
+2
-2
@@ -24,8 +24,8 @@ public class MySqlSetNamesStatement extends MySqlStatementImpl {
|
||||
private String collate;
|
||||
|
||||
public void accept0(MySqlASTVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
visitor.endVisit(this);
|
||||
// visitor.visit(this);
|
||||
// visitor.endVisit(this);
|
||||
}
|
||||
|
||||
public String getCharSet() {
|
||||
|
||||
@@ -690,7 +690,37 @@ public class MySqlExprParser extends SQLExprParser {
|
||||
}
|
||||
|
||||
if ("NAMES".equalsIgnoreCase(ident)) {
|
||||
// skip
|
||||
String charset = lexer.stringVal();
|
||||
|
||||
boolean chars = false;
|
||||
if (lexer.token() == Token.IDENTIFIER) {
|
||||
lexer.nextToken();
|
||||
} else if (lexer.token() == Token.DEFAULT) {
|
||||
charset = "DEFAULT";
|
||||
lexer.nextToken();
|
||||
} else {
|
||||
chars = true;
|
||||
accept(Token.LITERAL_CHARS);
|
||||
}
|
||||
|
||||
if (identifierEquals("COLLATE")) {
|
||||
MySqlCharExpr charsetExpr = new MySqlCharExpr(charset);
|
||||
lexer.nextToken();
|
||||
|
||||
String collate = lexer.stringVal();
|
||||
lexer.nextToken();
|
||||
charsetExpr.setCollate(collate);
|
||||
|
||||
item.setValue(charsetExpr);
|
||||
} else {
|
||||
item.setValue(chars
|
||||
? new SQLCharExpr(charset)
|
||||
: new SQLIdentifierExpr(charset)
|
||||
);
|
||||
}
|
||||
|
||||
item.setTarget(var);
|
||||
return item;
|
||||
} else if ("CHARACTER".equalsIgnoreCase(ident)) {
|
||||
var = new SQLIdentifierExpr("CHARACTER SET");
|
||||
accept(Token.SET);
|
||||
|
||||
+42
-44
@@ -71,8 +71,6 @@ import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlPrepareStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlRenameTableStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlReplaceStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlResetStatement;
|
||||
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.MySqlSetPasswordStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlSetTransactionStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowAuthorsStatement;
|
||||
@@ -2333,48 +2331,48 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
}
|
||||
|
||||
return stmt;
|
||||
} else if (identifierEquals("NAMES")) {
|
||||
lexer.nextToken();
|
||||
|
||||
MySqlSetNamesStatement stmt = new MySqlSetNamesStatement();
|
||||
if (lexer.token() == Token.DEFAULT) {
|
||||
lexer.nextToken();
|
||||
stmt.setDefault(true);
|
||||
} else {
|
||||
String charSet = lexer.stringVal();
|
||||
stmt.setCharSet(charSet);
|
||||
lexer.nextToken();
|
||||
if (identifierEquals(COLLATE2)) {
|
||||
lexer.nextToken();
|
||||
|
||||
String collate = lexer.stringVal();
|
||||
stmt.setCollate(collate);
|
||||
lexer.nextToken();
|
||||
}
|
||||
}
|
||||
return stmt;
|
||||
} else if (identifierEquals(CHARACTER)) {
|
||||
lexer.nextToken();
|
||||
|
||||
accept(Token.SET);
|
||||
|
||||
MySqlSetCharSetStatement stmt = new MySqlSetCharSetStatement();
|
||||
if (lexer.token() == Token.DEFAULT) {
|
||||
lexer.nextToken();
|
||||
stmt.setDefault(true);
|
||||
} else {
|
||||
String charSet = lexer.stringVal();
|
||||
stmt.setCharSet(charSet);
|
||||
lexer.nextToken();
|
||||
if (identifierEquals(COLLATE2)) {
|
||||
lexer.nextToken();
|
||||
|
||||
String collate = lexer.stringVal();
|
||||
stmt.setCollate(collate);
|
||||
lexer.nextToken();
|
||||
}
|
||||
}
|
||||
return stmt;
|
||||
// } else if (identifierEquals("NAMES")) {
|
||||
// lexer.nextToken();
|
||||
//
|
||||
// MySqlSetNamesStatement stmt = new MySqlSetNamesStatement();
|
||||
// if (lexer.token() == Token.DEFAULT) {
|
||||
// lexer.nextToken();
|
||||
// stmt.setDefault(true);
|
||||
// } else {
|
||||
// String charSet = lexer.stringVal();
|
||||
// stmt.setCharSet(charSet);
|
||||
// lexer.nextToken();
|
||||
// if (identifierEquals(COLLATE2)) {
|
||||
// lexer.nextToken();
|
||||
//
|
||||
// String collate = lexer.stringVal();
|
||||
// stmt.setCollate(collate);
|
||||
// lexer.nextToken();
|
||||
// }
|
||||
// }
|
||||
// return stmt;
|
||||
// } else if (identifierEquals(CHARACTER)) {
|
||||
// lexer.nextToken();
|
||||
//
|
||||
// accept(Token.SET);
|
||||
//
|
||||
// MySqlSetCharSetStatement stmt = new MySqlSetCharSetStatement();
|
||||
// if (lexer.token() == Token.DEFAULT) {
|
||||
// lexer.nextToken();
|
||||
// stmt.setDefault(true);
|
||||
// } else {
|
||||
// String charSet = lexer.stringVal();
|
||||
// stmt.setCharSet(charSet);
|
||||
// lexer.nextToken();
|
||||
// if (identifierEquals(COLLATE2)) {
|
||||
// lexer.nextToken();
|
||||
//
|
||||
// String collate = lexer.stringVal();
|
||||
// stmt.setCollate(collate);
|
||||
// lexer.nextToken();
|
||||
// }
|
||||
// }
|
||||
// return stmt;
|
||||
} else {
|
||||
SQLSetStatement stmt = new SQLSetStatement(getDbType());
|
||||
|
||||
|
||||
@@ -69,8 +69,6 @@ import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlRenameTableStateme
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlReplaceStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlResetStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlSelectQueryBlock;
|
||||
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.MySqlSetPasswordStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlSetTransactionStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowAuthorsStatement;
|
||||
@@ -257,14 +255,6 @@ public interface MySqlASTVisitor extends SQLASTVisitor {
|
||||
|
||||
void endVisit(MySqlSetTransactionStatement x);
|
||||
|
||||
boolean visit(MySqlSetNamesStatement x);
|
||||
|
||||
void endVisit(MySqlSetNamesStatement x);
|
||||
|
||||
boolean visit(MySqlSetCharSetStatement x);
|
||||
|
||||
void endVisit(MySqlSetCharSetStatement x);
|
||||
|
||||
boolean visit(MySqlShowBinaryLogsStatement x);
|
||||
|
||||
void endVisit(MySqlShowBinaryLogsStatement x);
|
||||
|
||||
@@ -71,8 +71,6 @@ import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlRenameTableStateme
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlReplaceStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlResetStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlSelectQueryBlock;
|
||||
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.MySqlSetPasswordStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlSetTransactionStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowAuthorsStatement;
|
||||
@@ -443,26 +441,6 @@ public class MySqlASTVisitorAdapter extends SQLASTVisitorAdapter implements MySq
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean visit(MySqlSetNamesStatement x) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endVisit(MySqlSetNamesStatement x) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean visit(MySqlSetCharSetStatement x) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endVisit(MySqlSetCharSetStatement x) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean visit(MySqlShowAuthorsStatement x) {
|
||||
return true;
|
||||
|
||||
@@ -79,8 +79,6 @@ import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlRenameTableStateme
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlReplaceStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlResetStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlSelectQueryBlock;
|
||||
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.MySqlSetPasswordStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlSetTransactionStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowAuthorsStatement;
|
||||
@@ -1769,46 +1767,35 @@ public class MySqlOutputVisitor extends SQLASTOutputVisitor implements MySqlASTV
|
||||
public void endVisit(MySqlSetTransactionStatement x) {
|
||||
|
||||
}
|
||||
//
|
||||
// @Override
|
||||
// public boolean visit(MySqlSetNamesStatement x) {
|
||||
// print0(ucase ? "SET NAMES " : "set names ");
|
||||
// if (x.isDefault()) {
|
||||
// print0(ucase ? "DEFAULT" : "default");
|
||||
// } else {
|
||||
// print0(x.getCharSet());
|
||||
// if (x.getCollate() != null) {
|
||||
// print0(ucase ? " COLLATE " : " collate ");
|
||||
// print0(x.getCollate());
|
||||
// }
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public boolean visit(MySqlSetNamesStatement x) {
|
||||
print0(ucase ? "SET NAMES " : "set names ");
|
||||
if (x.isDefault()) {
|
||||
print0(ucase ? "DEFAULT" : "default");
|
||||
} else {
|
||||
print0(x.getCharSet());
|
||||
if (x.getCollate() != null) {
|
||||
print0(ucase ? " COLLATE " : " collate ");
|
||||
print0(x.getCollate());
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endVisit(MySqlSetNamesStatement x) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean visit(MySqlSetCharSetStatement x) {
|
||||
print0(ucase ? "SET CHARACTER SET " : "set character set ");
|
||||
if (x.isDefault()) {
|
||||
print0(ucase ? "DEFAULT" : "default");
|
||||
} else {
|
||||
print0(x.getCharSet());
|
||||
if (x.getCollate() != null) {
|
||||
print0(ucase ? " COLLATE " : " collate ");
|
||||
print0(x.getCollate());
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endVisit(MySqlSetCharSetStatement x) {
|
||||
|
||||
}
|
||||
// public boolean visit(MySqlSetCharSetStatement x) {
|
||||
// print0(ucase ? "SET CHARACTER SET " : "set character set ");
|
||||
// if (x.isDefault()) {
|
||||
// print0(ucase ? "DEFAULT" : "default");
|
||||
// } else {
|
||||
// print0(x.getCharSet());
|
||||
// if (x.getCollate() != null) {
|
||||
// print0(ucase ? " COLLATE " : " collate ");
|
||||
// print0(x.getCollate());
|
||||
// }
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void endVisit(MySqlShowAuthorsStatement x) {
|
||||
@@ -2938,9 +2925,24 @@ public class MySqlOutputVisitor extends SQLASTOutputVisitor implements MySqlASTV
|
||||
|
||||
@Override
|
||||
public boolean visit(SQLAssignItem x) {
|
||||
x.getTarget().accept(this);
|
||||
if (!"NAMES".equalsIgnoreCase(x.getTarget().toString())) {
|
||||
|
||||
|
||||
String tagetString = x.getTarget().toString();
|
||||
|
||||
boolean mysqlSpecial = false;
|
||||
|
||||
if (JdbcConstants.MYSQL.equals(dbType)) {
|
||||
mysqlSpecial = "NAMES".equalsIgnoreCase(tagetString)
|
||||
|| "CHARACTER SET".equalsIgnoreCase(tagetString)
|
||||
|| "CHARSET".equalsIgnoreCase(tagetString);
|
||||
}
|
||||
|
||||
if (!mysqlSpecial) {
|
||||
x.getTarget().accept(this);
|
||||
print0(" = ");
|
||||
} else {
|
||||
print0(ucase ? tagetString.toUpperCase() : tagetString.toLowerCase());
|
||||
print(' ');
|
||||
}
|
||||
x.getValue().accept(this);
|
||||
return false;
|
||||
|
||||
@@ -86,8 +86,6 @@ import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlRenameTableStateme
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlReplaceStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlResetStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlSelectQueryBlock;
|
||||
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.MySqlSetPasswordStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlSetTransactionStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowAuthorsStatement;
|
||||
@@ -587,26 +585,6 @@ public class MySqlSchemaStatVisitor extends SchemaStatVisitor implements MySqlAS
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean visit(MySqlSetNamesStatement x) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endVisit(MySqlSetNamesStatement x) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean visit(MySqlSetCharSetStatement x) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endVisit(MySqlSetCharSetStatement x) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean visit(MySqlShowAuthorsStatement x) {
|
||||
return false;
|
||||
|
||||
-2
@@ -48,8 +48,6 @@ public class OracleCreateTableStatement extends SQLCreateTableStatement implemen
|
||||
private OracleStorageClause storage;
|
||||
private OracleLobStorageClause lobStorage;
|
||||
|
||||
private boolean organizationIndex = false;
|
||||
|
||||
private Integer pctfree;
|
||||
private Integer pctused;
|
||||
private Integer initrans;
|
||||
|
||||
@@ -628,10 +628,10 @@ public class OracleSelectParser extends SQLSelectParser {
|
||||
private void parseTableSourceQueryTableExpr(OracleSelectTableReference tableReference) {
|
||||
tableReference.setExpr(this.exprParser.expr());
|
||||
|
||||
{
|
||||
FlashbackQueryClause clause = flashback();
|
||||
tableReference.setFlashback(clause);
|
||||
}
|
||||
// {
|
||||
// FlashbackQueryClause clause = flashback();
|
||||
// tableReference.setFlashback(clause);
|
||||
// }
|
||||
|
||||
if (identifierEquals("SAMPLE")) {
|
||||
lexer.nextToken();
|
||||
@@ -726,40 +726,31 @@ public class OracleSelectParser extends SQLSelectParser {
|
||||
}
|
||||
|
||||
private FlashbackQueryClause flashback() {
|
||||
if (lexer.token() == Token.AS) {
|
||||
accept(Token.OF);
|
||||
|
||||
if (identifierEquals("SCN")) {
|
||||
AsOfFlashbackQueryClause clause = new AsOfFlashbackQueryClause();
|
||||
clause.setType(AsOfFlashbackQueryClause.Type.SCN);
|
||||
lexer.nextToken();
|
||||
}
|
||||
clause.setExpr(exprParser.expr());
|
||||
|
||||
if (lexer.token() == Token.OF) {
|
||||
return clause;
|
||||
} else if (identifierEquals("SNAPSHOT")) {
|
||||
lexer.nextToken();
|
||||
accept(Token.LPAREN);
|
||||
AsOfSnapshotClause clause = new AsOfSnapshotClause();
|
||||
clause.setExpr(this.expr());
|
||||
accept(Token.RPAREN);
|
||||
|
||||
if (identifierEquals("SCN")) {
|
||||
AsOfFlashbackQueryClause clause = new AsOfFlashbackQueryClause();
|
||||
clause.setType(AsOfFlashbackQueryClause.Type.SCN);
|
||||
lexer.nextToken();
|
||||
clause.setExpr(exprParser.expr());
|
||||
|
||||
return clause;
|
||||
} else if (identifierEquals("SNAPSHOT")) {
|
||||
lexer.nextToken();
|
||||
accept(Token.LPAREN);
|
||||
AsOfSnapshotClause clause = new AsOfSnapshotClause();
|
||||
clause.setExpr(this.expr());
|
||||
accept(Token.RPAREN);
|
||||
|
||||
return clause;
|
||||
} else {
|
||||
AsOfFlashbackQueryClause clause = new AsOfFlashbackQueryClause();
|
||||
acceptIdentifier("TIMESTAMP");
|
||||
clause.setType(AsOfFlashbackQueryClause.Type.TIMESTAMP);
|
||||
clause.setExpr(exprParser.expr());
|
||||
|
||||
return clause;
|
||||
}
|
||||
return clause;
|
||||
} else {
|
||||
AsOfFlashbackQueryClause clause = new AsOfFlashbackQueryClause();
|
||||
acceptIdentifier("TIMESTAMP");
|
||||
clause.setType(AsOfFlashbackQueryClause.Type.TIMESTAMP);
|
||||
clause.setExpr(exprParser.expr());
|
||||
|
||||
return clause;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected SQLTableSource primaryTableSourceRest(SQLTableSource tableSource) {
|
||||
@@ -784,9 +775,10 @@ public class OracleSelectParser extends SQLSelectParser {
|
||||
|
||||
if (lexer.token() == Token.OF) {
|
||||
tableSource.setFlashback(flashback());
|
||||
return parseTableSourceRest(tableSource);
|
||||
}
|
||||
|
||||
tableSource.setAlias(tableAlias());
|
||||
tableSource.setAlias(tableAlias(true));
|
||||
} else if ((tableSource.getAlias() == null) || (tableSource.getAlias().length() == 0)) {
|
||||
if (lexer.token() != Token.LEFT && lexer.token() != Token.RIGHT && lexer.token() != Token.FULL) {
|
||||
tableSource.setAlias(tableAlias());
|
||||
|
||||
@@ -61,12 +61,30 @@ public class SQLParser {
|
||||
}
|
||||
|
||||
protected String tableAlias() {
|
||||
if (lexer.token() == Token.CONNECT || lexer.token() == Token.START) {
|
||||
return tableAlias(false);
|
||||
}
|
||||
|
||||
protected String tableAlias(boolean must) {
|
||||
final Token token = lexer.token();
|
||||
if (token == Token.CONNECT
|
||||
|| token == Token.START
|
||||
|| token == Token.SELECT
|
||||
|| token == Token.FROM
|
||||
|| token == Token.WHERE) {
|
||||
if (must) {
|
||||
throw new ParserException("illegal alias. " + lexer.info());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
if (identifierEquals("START") || identifierEquals("CONNECT")) {
|
||||
return null;
|
||||
if (token == Token.IDENTIFIER) {
|
||||
String ident = lexer.stringVal;
|
||||
if (ident.equalsIgnoreCase("START") || ident.equalsIgnoreCase("CONNECT")) {
|
||||
if (must) {
|
||||
throw new ParserException("illegal alias. " + lexer.info());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return this.as();
|
||||
|
||||
@@ -59,8 +59,6 @@ import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlInsertStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlLockTableStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlRenameTableStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlReplaceStatement;
|
||||
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.MySqlShowGrantsStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlShowStatement;
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlUpdateStatement;
|
||||
@@ -2453,9 +2451,7 @@ public class WallVisitorUtils {
|
||||
allow = config.isDropTableAllow();
|
||||
denyMessage = "drop table not allow";
|
||||
errorCode = ErrorCode.DROP_TABLE_NOT_ALLOW;
|
||||
} else if (x instanceof MySqlSetCharSetStatement //
|
||||
|| x instanceof MySqlSetNamesStatement //
|
||||
|| x instanceof SQLSetStatement //
|
||||
} else if (x instanceof SQLSetStatement //
|
||||
|| x instanceof SQLServerSetStatement) {
|
||||
allow = config.isSetAllow();
|
||||
denyMessage = "set not allow";
|
||||
@@ -2571,8 +2567,7 @@ public class WallVisitorUtils {
|
||||
List<SQLStatement> statementList = parser.parseStatementList();
|
||||
if (statementList != null && statementList.size() > 0) {
|
||||
SQLStatement statement = statementList.get(0);
|
||||
if (statement instanceof SQLSetStatement || statement instanceof MySqlSetCharSetStatement
|
||||
|| statement instanceof MySqlSetNamesStatement) {
|
||||
if (statement instanceof SQLSetStatement) {
|
||||
isWhite = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user