improve wall filter

This commit is contained in:
wenshao
2013-04-02 19:52:40 +08:00
parent ba45a857c4
commit 78c7456ef0
31 changed files with 824 additions and 147 deletions
@@ -0,0 +1,24 @@
/*
* 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.parser;
@SuppressWarnings("serial")
public class EOFParserException extends ParserException {
public EOFParserException(){
super("EOF");
}
}
@@ -457,8 +457,10 @@ public class SQLExprParser extends SQLParser {
sqlExpr = new SQLIdentifierExpr('"' + lexer.stringVal() + '"');
lexer.nextToken();
break;
case EOF:
throw new EOFParserException();
default:
throw new ParserException("ERROR. token : " + tok + " " + lexer.stringVal());
throw new ParserException("ERROR. token : " + tok + ", pos : " + lexer.pos());
}
return primaryRest(sqlExpr);
@@ -814,8 +816,11 @@ public class SQLExprParser extends SQLParser {
SQLExpr rightExp;
if (lexer.token() == Token.EQ) {
lexer.nextToken();
rightExp = bitOr();
try {
rightExp = bitOr();
} catch (EOFParserException e) {
throw new ParserException("EOF, " + expr + "=", e);
}
rightExp = equalityRest(rightExp);
expr = new SQLBinaryOpExpr(expr, SQLBinaryOperator.Equality, rightExp);
@@ -223,7 +223,7 @@ public class SQLStatementParser extends SQLParser {
continue;
}
throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal() + ", pos " + lexer.pos());
throw new ParserException("syntax error, " + lexer.token() + " " + lexer.stringVal() + ", pos " + lexer.pos());
}
}