Skip to content

Commit

Permalink
improve sqlwall
Browse files Browse the repository at this point in the history
  • Loading branch information
yakolee committed Jul 9, 2014
1 parent b00c04a commit d47b121
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/main/java/com/alibaba/druid/wall/WallProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,9 @@ private WallCheckResult checkInternal(String sql) {
violations.add(new SyntaxErrorViolation(e, sql));
}
} catch (Exception e) {
violations.add(new SyntaxErrorViolation(e, sql));
if (config.isStrictSyntaxCheck()) {
violations.add(new SyntaxErrorViolation(e, sql));
}
}

if (statementList.size() > 1 && !config.isMultiStatementAllow()) {
Expand All @@ -664,15 +666,15 @@ private WallCheckResult checkInternal(String sql) {
violations.addAll(visitor.getViolations());
}

if (visitor.getViolations().size() == 0 && context != null && context.getWarnnings() >= 2) {
if (context.getCommentCount() > 0) {
violations.add(new IllegalSQLObjectViolation(ErrorCode.COMMIT_NOT_ALLOW, "comment not allow", sql));
} else if (context.getLikeNumberWarnnings() > 0) {
violations.add(new IllegalSQLObjectViolation(ErrorCode.COMMIT_NOT_ALLOW, "like number", sql));
} else {
violations.add(new IllegalSQLObjectViolation(ErrorCode.COMPOUND, "multi-warnnings", sql));
}
}
// if (visitor.getViolations().size() == 0 && context != null && context.getWarnnings() >= 2) {
// if (context.getCommentCount() > 0) {
// violations.add(new IllegalSQLObjectViolation(ErrorCode.COMMIT_NOT_ALLOW, "comment not allow", sql));
// } else if (context.getLikeNumberWarnnings() > 0) {
// violations.add(new IllegalSQLObjectViolation(ErrorCode.COMMIT_NOT_ALLOW, "like number", sql));
// } else {
// violations.add(new IllegalSQLObjectViolation(ErrorCode.COMPOUND, "multi-warnnings", sql));
// }
// }

WallSqlStat sqlStat = null;
if (violations.size() > 0) {
Expand Down

0 comments on commit d47b121

Please sign in to comment.