bug fixed for issue #1759 #1807

This commit is contained in:
wenshao
2017-07-12 00:40:38 +08:00
parent f2708bb208
commit a31afb10c4
2 changed files with 27 additions and 1 deletions
@@ -2396,7 +2396,9 @@ public class WallVisitorUtils {
boolean allow = false;
int errorCode;
String denyMessage;
if (x instanceof SQLInsertStatement) {
if (x instanceof SQLCommentStatement) {
return;
} else if (x instanceof SQLInsertStatement) {
allow = config.isInsertAllow();
denyMessage = "insert not allow";
errorCode = ErrorCode.INSERT_NOT_ALLOW;
@@ -0,0 +1,24 @@
package com.alibaba.druid.bvt.bug;
import com.alibaba.druid.sql.ast.SQLStatement;
import com.alibaba.druid.sql.dialect.oracle.parser.OracleStatementParser;
import com.alibaba.druid.wall.WallCheckResult;
import com.alibaba.druid.wall.spi.OracleWallProvider;
import junit.framework.TestCase;
/**
* Created by wenshao on 12/07/2017.
*/
public class Issue1759 extends TestCase {
public void test_0() throws Exception {
String sql = "COMMENT ON COLUMN \"TB_CRM_MATERIAL\".\"INVALID_TIME\" IS '生效时间'";
OracleStatementParser parser = new OracleStatementParser(sql);
SQLStatement statement = parser.parseStatement();// 分号之后多语句忽略
OracleWallProvider provider = new OracleWallProvider();
WallCheckResult result1 = provider.check(sql);
assertTrue(result1.getViolations().size() == 0);
}
}