if (sql == null || dbType == null) {
return new Long(-1);
}
try {
WallProvider provider = null;
if ("mssql".equalsIgnoreCase(dbType)) {
provider = new SQLServerWallProvider();
} else if ("mysql".equalsIgnoreCase(dbType)) {
provider = new MySqlWallProvider();
} else {
return new Long(-1);
}
provider.getConfig().setStrictSyntaxCheck(false);
provider.getConfig().setMultiStatementAllow(true);
provider.getConfig().setConditionAndAlwayTrueAllow(true);
provider.getConfig().setConditionAndAlwayFalseAllow(true);
provider.getConfig().setNoneBaseStatementAllow(true);
provider.getConfig().setLimitZeroAllow(true);
provider.getConfig().setConditionDoubleConstAllow(true);
provider.getConfig().setCommentAllow(true);
// provider.getConfig().setSelectUnionCheck(false);
// add by yanhui.liyh
provider.setBlackListEnable(false);
provider.setWhiteListEnable(false);
long time = System.nanoTime();
for (int i = 0; i < num; i++) {
provider.checkValid(sql);
}
return (System.nanoTime() - time) / num / 1000;
} catch (Exception e) {
return new Long(-1);