提交 4c584cef authored 作者: Thomas Mueller's avatar Thomas Mueller

Better string representation for decimal values (for example 0.00000000 instead of 0E-26).

上级 89697695
...@@ -18,7 +18,8 @@ Change Log ...@@ -18,7 +18,8 @@ Change Log
<h1>Change Log</h1> <h1>Change Log</h1>
<h2>Next Version (unreleased)</h2> <h2>Next Version (unreleased)</h2>
<ul><li>Prepared statements could only be re-used if the same data types were used <ul><li>Better string representation for decimal values (for example 0.00000000 instead of 0E-26).
</li><li>Prepared statements could only be re-used if the same data types were used
the second time they were executed. the second time they were executed.
</li><li>In error messages about referential constraint violation, the values are now included. </li><li>In error messages about referential constraint violation, the values are now included.
</li><li>SCRIPT and RUNSCRIPT: the password can now be set using a prepared statement. </li><li>SCRIPT and RUNSCRIPT: the password can now be set using a prepared statement.
......
...@@ -134,7 +134,12 @@ public class ValueDecimal extends Value { ...@@ -134,7 +134,12 @@ public class ValueDecimal extends Value {
public String getString() { public String getString() {
if (valueString == null) { if (valueString == null) {
valueString = value.toString(); String p = value.toPlainString();
if (p.length() < 40) {
valueString = p;
} else {
valueString = value.toString();
}
} }
return valueString; return valueString;
} }
......
select 1.00 / 3 * 0.00;
> 0.00000000000000000000000000000;
select 1.00000 / 3 * 0.0000;
> 0.0000000000000000000000000000000000;
select 1.0000000 / 3 * 0.00000;
> 0.0000000000000000000000000000000000000;
select 1.0000000 / 3 * 0.000000;
> 0E-38;
select substr('[Hello]', 2, 5); select substr('[Hello]', 2, 5);
> Hello; > Hello;
select substr('Hello World', -5); select substr('Hello World', -5);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论