bug fixed wallUpdateCheck.

This commit is contained in:
wenshao
2017-12-14 17:03:13 +08:00
parent 5170a3b944
commit 9c5353ea98
2 changed files with 4 additions and 2 deletions
@@ -939,7 +939,9 @@ public class WallVisitorUtils {
filterValues.add(((SQLValuableExpr) expr).getValue());
}
boolean validate = updateCheckHandler.check(tableName, checkColumn, setValue, filterValues);
visitor.addViolation(new IllegalSQLObjectViolation(ErrorCode.UPDATE_CHECK_FAIL, "update check failed.", visitor.toSQL(x)));
if (!validate) {
visitor.addViolation(new IllegalSQLObjectViolation(ErrorCode.UPDATE_CHECK_FAIL, "update check failed.", visitor.toSQL(x)));
}
} else {
visitor.addWallUpdateCheckItem(new WallUpdateCheckItem(tableName, checkColumn, valueExpr, filterValueExprList));
}
@@ -46,7 +46,7 @@ public class WallUpdateCheckTest extends TestCase {
});
{
WallCheckResult result = wallProvider.check("update t_orders set status = 3 where id = 3 and status = 4");
assertTrue(result.getViolations().size() > 0);
assertTrue(result.getViolations().size() == 0);
}
assertEquals(0, wallProvider.getWhiteListHitCount());
assertEquals(0, wallProvider.getBlackListHitCount());