mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
@@ -345,19 +345,20 @@ public class MySqlLexer extends Lexer {
|
||||
putChar(ch);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (ch == '\'') {
|
||||
scanChar();
|
||||
if (ch != '\'') {
|
||||
token = LITERAL_CHARS;
|
||||
break;
|
||||
} else {
|
||||
initBuff(bufPos);
|
||||
arraycopy(mark + 1, buf, 0, bufPos);
|
||||
hasSpecial = true;
|
||||
putChar('\'');
|
||||
continue;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
if (ch == '\'') {
|
||||
scanChar();
|
||||
if (ch != '\'') {
|
||||
token = LITERAL_CHARS;
|
||||
break;
|
||||
} else {
|
||||
initBuff(bufPos);
|
||||
arraycopy(mark + 1, buf, 0, bufPos);
|
||||
hasSpecial = true;
|
||||
putChar('\'');
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1117,9 +1117,7 @@ public class SQLEvalVisitorUtils {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ("0".equals(val) || "false".equalsIgnoreCase((String) val)) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException(val.getClass() + " not supported.");
|
||||
@@ -1378,7 +1376,11 @@ public class SQLEvalVisitorUtils {
|
||||
if (decimalB.scale() < decimalA.scale()) {
|
||||
decimalB = decimalB.setScale(decimalA.scale());
|
||||
}
|
||||
return decimalA.divide(decimalB, BigDecimal.ROUND_HALF_UP);
|
||||
try {
|
||||
return decimalA.divide(decimalB);
|
||||
} catch (ArithmeticException ex) {
|
||||
return decimalA.divide(decimalB, BigDecimal.ROUND_HALF_UP);
|
||||
}
|
||||
}
|
||||
|
||||
if (a instanceof Double || b instanceof Double) {
|
||||
|
||||
@@ -228,11 +228,11 @@ public class WallVisitorUtils {
|
||||
|
||||
Object whereValue = getConditionValue(visitor, where, visitor.getConfig().isSelectWhereAlwayTrueCheck());
|
||||
|
||||
if (queryBlockFromIsNull(visitor, x, false) && whereValue != null) {
|
||||
addViolation(visitor, ErrorCode.EMPTY_QUERY_HAS_CONDITION, "empty select has condition", x);
|
||||
}
|
||||
|
||||
if (Boolean.TRUE == whereValue) {
|
||||
if (queryBlockFromIsNull(visitor, x, false)) {
|
||||
addViolation(visitor, ErrorCode.EMPTY_QUERY_HAS_CONDITION, "empty select has condition", x);
|
||||
}
|
||||
|
||||
boolean isSimpleConstExpr = false;
|
||||
SQLExpr first = getFirst(where);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user