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

Support for the MS SQL Server syntax VARCHAR(MAX).

上级 c618b4ab
...@@ -3571,37 +3571,39 @@ public class Parser { ...@@ -3571,37 +3571,39 @@ public class Parser {
scale = scale == -1 ? dataType.defaultScale : scale; scale = scale == -1 ? dataType.defaultScale : scale;
if (dataType.supportsPrecision || dataType.supportsScale) { if (dataType.supportsPrecision || dataType.supportsScale) {
if (readIf("(")) { if (readIf("(")) {
long p = readLong(); if (!readIf("MAX")) {
if (readIf("K")) { long p = readLong();
p *= 1024; if (readIf("K")) {
} else if (readIf("M")) { p *= 1024;
p *= 1024 * 1024; } else if (readIf("M")) {
} else if (readIf("G")) { p *= 1024 * 1024;
p *= 1024 * 1024 * 1024; } else if (readIf("G")) {
} p *= 1024 * 1024 * 1024;
if (p > Long.MAX_VALUE) { }
p = Long.MAX_VALUE; if (p > Long.MAX_VALUE) {
} p = Long.MAX_VALUE;
original += "(" + p; }
// Oracle syntax original += "(" + p;
readIf("CHAR"); // Oracle syntax
if (dataType.supportsScale) { readIf("CHAR");
if (readIf(",")) { if (dataType.supportsScale) {
scale = getInt(); if (readIf(",")) {
original += ", " + scale; scale = getInt();
} else { original += ", " + scale;
// special case: TIMESTAMP(5) actually means TIMESTAMP(23, 5)
if (dataType.type == Value.TIMESTAMP) {
scale = MathUtils.convertLongToInt(p);
p = precision;
} else { } else {
scale = 0; // special case: TIMESTAMP(5) actually means TIMESTAMP(23, 5)
if (dataType.type == Value.TIMESTAMP) {
scale = MathUtils.convertLongToInt(p);
p = precision;
} else {
scale = 0;
}
} }
} }
precision = p;
displaySize = MathUtils.convertLongToInt(precision);
original += ")";
} }
precision = p;
displaySize = MathUtils.convertLongToInt(precision);
original += ")";
read(")"); read(")");
} }
} else if (readIf("(")) { } else if (readIf("(")) {
......
...@@ -426,7 +426,7 @@ select constraint_name from information_schema.indexes where table_name = 'CHILD ...@@ -426,7 +426,7 @@ select constraint_name from information_schema.indexes where table_name = 'CHILD
drop table parent, child; drop table parent, child;
> ok > ok
create table test(id int, name varchar); create table test(id int, name varchar(max));
> ok > ok
alter table test alter column id identity; alter table test alter column id identity;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论