提交 c11b7c64 authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 032cba61
...@@ -3201,7 +3201,7 @@ public class Parser { ...@@ -3201,7 +3201,7 @@ public class Parser {
readIf("CHAR"); readIf("CHAR");
if (dataType.supportsScale) { if (dataType.supportsScale) {
if (readIf(",")) { if (readIf(",")) {
scale = getPositiveInt(); scale = getInt();
original += ", " + scale; original += ", " + scale;
} else { } else {
scale = 0; scale = 0;
......
...@@ -66,7 +66,7 @@ public class MathUtils { ...@@ -66,7 +66,7 @@ public class MathUtils {
public static BigDecimal setScale(BigDecimal bd, int scale) throws SQLException { public static BigDecimal setScale(BigDecimal bd, int scale) throws SQLException {
if (scale > Constants.BIG_DECIMAL_SCALE_MAX) { if (scale > Constants.BIG_DECIMAL_SCALE_MAX) {
throw Message.getInvalidValueException("" + scale, "scale"); throw Message.getInvalidValueException("" + scale, "scale");
} else if (scale < 0) { } else if (scale < -Constants.BIG_DECIMAL_SCALE_MAX) {
throw Message.getInvalidValueException("" + scale, "scale"); throw Message.getInvalidValueException("" + scale, "scale");
} }
return bd.setScale(scale, BigDecimal.ROUND_HALF_UP); return bd.setScale(scale, BigDecimal.ROUND_HALF_UP);
......
...@@ -46,6 +46,9 @@ public class StringUtils { ...@@ -46,6 +46,9 @@ public class StringUtils {
} }
public static String quoteStringSQL(String s) { public static String quoteStringSQL(String s) {
if (s == null) {
return "NULL";
}
StringBuffer buff = new StringBuffer(s.length() + 2); StringBuffer buff = new StringBuffer(s.length() + 2);
buff.append('\''); buff.append('\'');
for (int i = 0; i < s.length(); i++) { for (int i = 0; i < s.length(); i++) {
......
...@@ -160,6 +160,8 @@ java org.h2.test.TestAll timer ...@@ -160,6 +160,8 @@ java org.h2.test.TestAll timer
/* /*
create table test(d number(1, -84));
MySQL: MySQL:
CREATE TABLE user ( CREATE TABLE user (
id int(25) NOT NULL auto_increment, id int(25) NOT NULL auto_increment,
...@@ -250,6 +252,8 @@ http://www.w3schools.com/sql/ ...@@ -250,6 +252,8 @@ http://www.w3schools.com/sql/
History: History:
Roadmap: Roadmap:
Negative scale values for DECIMAL or NUMBER columns are not supported
in regular tables and in linked tables.
*/ */
if (args.length > 0) { if (args.length > 0) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论