improve sql wall

This commit is contained in:
wenshao
2013-08-29 14:31:21 +08:00
parent 40ccaee0e3
commit d179a8752e
9 changed files with 158 additions and 38 deletions
@@ -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;
}
}
@@ -1376,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) {