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