提交 cf8f570d authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Do not parse integer decimals twice in Parser.readDecimal()

上级 2c97e6d0
...@@ -3864,6 +3864,7 @@ public class Parser { ...@@ -3864,6 +3864,7 @@ public class Parser {
parseIndex = i; parseIndex = i;
String sub = sqlCommand.substring(start, i); String sub = sqlCommand.substring(start, i);
checkLiterals(false); checkLiterals(false);
BigDecimal bd;
if (!containsE && sub.indexOf('.') < 0) { if (!containsE && sub.indexOf('.') < 0) {
BigInteger bi = new BigInteger(sub); BigInteger bi = new BigInteger(sub);
if (bi.compareTo(ValueLong.MAX_BI) <= 0) { if (bi.compareTo(ValueLong.MAX_BI) <= 0) {
...@@ -3875,12 +3876,13 @@ public class Parser { ...@@ -3875,12 +3876,13 @@ public class Parser {
currentTokenType = VALUE; currentTokenType = VALUE;
return; return;
} }
} bd = new BigDecimal(bi);
BigDecimal bd; } else {
try { try {
bd = new BigDecimal(sub); bd = new BigDecimal(sub);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, e, sub); throw DbException.get(ErrorCode.DATA_CONVERSION_ERROR_1, e, sub);
}
} }
currentValue = ValueDecimal.get(bd); currentValue = ValueDecimal.get(bd);
currentTokenType = VALUE; currentTokenType = VALUE;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论