mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improve WallFilter
This commit is contained in:
@@ -27,7 +27,6 @@ import com.alibaba.druid.sql.parser.Keywords;
|
||||
import com.alibaba.druid.sql.parser.Lexer;
|
||||
import com.alibaba.druid.sql.parser.NotAllowCommentException;
|
||||
import com.alibaba.druid.sql.parser.ParserException;
|
||||
import com.alibaba.druid.sql.parser.SQLParseException;
|
||||
import com.alibaba.druid.sql.parser.Token;
|
||||
|
||||
public class MySqlLexer extends Lexer {
|
||||
@@ -64,7 +63,7 @@ public class MySqlLexer extends Lexer {
|
||||
|
||||
public void scanVariable() {
|
||||
if (ch != '@' && ch != ':' && ch != '#' && ch != '$') {
|
||||
throw new SQLParseException("illegal variable");
|
||||
throw new ParserException("illegal variable");
|
||||
}
|
||||
|
||||
mark = pos;
|
||||
@@ -87,7 +86,7 @@ public class MySqlLexer extends Lexer {
|
||||
ch = charAt(++pos);
|
||||
break;
|
||||
} else if (ch == EOI) {
|
||||
throw new SQLParseException("illegal identifier");
|
||||
throw new ParserException("illegal identifier");
|
||||
}
|
||||
|
||||
bufPos++;
|
||||
@@ -110,7 +109,7 @@ public class MySqlLexer extends Lexer {
|
||||
ch = charAt(++pos);
|
||||
break;
|
||||
} else if (ch == EOI) {
|
||||
throw new SQLParseException("illegal identifier");
|
||||
throw new ParserException("illegal identifier");
|
||||
}
|
||||
|
||||
bufPos++;
|
||||
@@ -156,7 +155,7 @@ public class MySqlLexer extends Lexer {
|
||||
ch = charAt(++pos);
|
||||
break;
|
||||
} else if (ch == EOI) {
|
||||
throw new SQLParseException("illegal identifier");
|
||||
throw new ParserException("illegal identifier");
|
||||
}
|
||||
|
||||
bufPos++;
|
||||
@@ -176,7 +175,7 @@ public class MySqlLexer extends Lexer {
|
||||
|
||||
final boolean firstFlag = isFirstIdentifierChar(first);
|
||||
if (!firstFlag) {
|
||||
throw new SQLParseException("illegal identifier");
|
||||
throw new ParserException("illegal identifier");
|
||||
}
|
||||
|
||||
mark = pos;
|
||||
|
||||
@@ -138,7 +138,6 @@ import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlUnlockTablesStatem
|
||||
import com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlUpdateStatement;
|
||||
import com.alibaba.druid.sql.parser.Lexer;
|
||||
import com.alibaba.druid.sql.parser.ParserException;
|
||||
import com.alibaba.druid.sql.parser.SQLParseException;
|
||||
import com.alibaba.druid.sql.parser.SQLSelectParser;
|
||||
import com.alibaba.druid.sql.parser.SQLStatementParser;
|
||||
import com.alibaba.druid.sql.parser.Token;
|
||||
@@ -1860,7 +1859,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
private void parseValueClause(List<ValuesClause> valueClauseList, int columnSize) {
|
||||
for (;;) {
|
||||
if (lexer.token() != Token.LPAREN) {
|
||||
throw new SQLParseException("syntax error, expect ')'");
|
||||
throw new ParserException("syntax error, expect ')'");
|
||||
}
|
||||
lexer.nextTokenValue();
|
||||
|
||||
@@ -1914,7 +1913,7 @@ public class MySqlStatementParser extends SQLStatementParser {
|
||||
}
|
||||
|
||||
if (lexer.token() != Token.RPAREN) {
|
||||
throw new SQLParseException("syntax error");
|
||||
throw new ParserException("syntax error");
|
||||
}
|
||||
|
||||
lexer.nextTokenComma();
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.alibaba.druid.sql.dialect.oracle.parser;
|
||||
|
||||
import static com.alibaba.druid.sql.parser.CharTypes.isIdentifierChar;
|
||||
import static com.alibaba.druid.sql.parser.LayoutCharacters.EOI;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -23,11 +24,9 @@ import java.util.Map;
|
||||
import com.alibaba.druid.sql.parser.Keywords;
|
||||
import com.alibaba.druid.sql.parser.Lexer;
|
||||
import com.alibaba.druid.sql.parser.NotAllowCommentException;
|
||||
import com.alibaba.druid.sql.parser.SQLParseException;
|
||||
import com.alibaba.druid.sql.parser.ParserException;
|
||||
import com.alibaba.druid.sql.parser.Token;
|
||||
|
||||
import static com.alibaba.druid.sql.parser.LayoutCharacters.EOI;
|
||||
|
||||
public class OracleLexer extends Lexer {
|
||||
|
||||
public final static Keywords DEFAULT_ORACLE_KEYWORDS;
|
||||
@@ -104,7 +103,7 @@ public class OracleLexer extends Lexer {
|
||||
}
|
||||
|
||||
if (ch != ':' && ch != '#' && ch != '$') {
|
||||
throw new SQLParseException("illegal variable");
|
||||
throw new ParserException("illegal variable");
|
||||
}
|
||||
|
||||
mark = pos;
|
||||
@@ -136,13 +135,13 @@ public class OracleLexer extends Lexer {
|
||||
|
||||
if (quoteFlag) {
|
||||
if (ch != '"') {
|
||||
throw new SQLParseException("syntax error");
|
||||
throw new ParserException("syntax error");
|
||||
}
|
||||
++pos;
|
||||
bufPos++;
|
||||
} else if (mybatisFlag) {
|
||||
if (ch != '}') {
|
||||
throw new SQLParseException("syntax error");
|
||||
throw new ParserException("syntax error");
|
||||
}
|
||||
++pos;
|
||||
bufPos++;
|
||||
|
||||
@@ -67,7 +67,6 @@ import com.alibaba.druid.sql.dialect.oracle.ast.stmt.OracleSelectTableSource;
|
||||
import com.alibaba.druid.sql.dialect.oracle.ast.stmt.OracleSelectUnPivot;
|
||||
import com.alibaba.druid.sql.parser.ParserException;
|
||||
import com.alibaba.druid.sql.parser.SQLExprParser;
|
||||
import com.alibaba.druid.sql.parser.SQLParseException;
|
||||
import com.alibaba.druid.sql.parser.SQLSelectParser;
|
||||
import com.alibaba.druid.sql.parser.Token;
|
||||
|
||||
@@ -182,7 +181,7 @@ public class OracleSelectParser extends SQLSelectParser {
|
||||
SearchClause searchClause = new SearchClause();
|
||||
|
||||
if (lexer.token() != Token.IDENTIFIER) {
|
||||
throw new SQLParseException("syntax erorr : " + lexer.token());
|
||||
throw new ParserException("syntax erorr : " + lexer.token());
|
||||
}
|
||||
|
||||
searchClause.setType(SearchClause.Type.valueOf(lexer.stringVal()));
|
||||
@@ -823,7 +822,7 @@ public class OracleSelectParser extends SQLSelectParser {
|
||||
|
||||
SQLBinaryOpExpr binaryExpr = (SQLBinaryOpExpr) exprParser.expr();
|
||||
if (binaryExpr.getOperator() != SQLBinaryOperator.BooleanAnd) {
|
||||
throw new SQLParseException("syntax error : " + binaryExpr.getOperator());
|
||||
throw new ParserException("syntax error : " + binaryExpr.getOperator());
|
||||
}
|
||||
|
||||
clause.setBegin(binaryExpr.getLeft());
|
||||
@@ -831,7 +830,7 @@ public class OracleSelectParser extends SQLSelectParser {
|
||||
|
||||
tableReference.setFlashback(clause);
|
||||
} else {
|
||||
throw new SQLParseException("TODO");
|
||||
throw new ParserException("TODO");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user