提交 c1087334 authored 作者: Noel Grandin's avatar Noel Grandin

I don't think we need an enumerated flag in DataType

上级 8665d5e0
...@@ -4202,7 +4202,7 @@ public class Parser { ...@@ -4202,7 +4202,7 @@ public class Parser {
} }
read(")"); read(")");
} }
} else if (dataType.enumerated) { } else if (dataType.type == Value.ENUM) {
if (readIf("(")) { if (readIf("(")) {
java.util.List<String> enumeratorList = new ArrayList<String>(); java.util.List<String> enumeratorList = new ArrayList<String>();
original += '('; original += '(';
......
...@@ -25,6 +25,7 @@ import org.h2.table.IndexColumn; ...@@ -25,6 +25,7 @@ import org.h2.table.IndexColumn;
import org.h2.table.Table; import org.h2.table.Table;
import org.h2.util.New; import org.h2.util.New;
import org.h2.value.DataType; import org.h2.value.DataType;
import org.h2.value.Value;
/** /**
* This class represents the statement * This class represents the statement
...@@ -250,7 +251,7 @@ public class CreateTable extends SchemaCommand { ...@@ -250,7 +251,7 @@ public class CreateTable extends SchemaCommand {
precision = scale; precision = scale;
} }
String[] enumerators = null; String[] enumerators = null;
if (dt.enumerated) { if (dt.type == Value.ENUM) {
/** /**
* Only columns of tables may be enumerated. * Only columns of tables may be enumerated.
*/ */
......
...@@ -140,11 +140,6 @@ public class DataType { ...@@ -140,11 +140,6 @@ public class DataType {
*/ */
public boolean caseSensitive; public boolean caseSensitive;
/**
* If enumerated values are supported.
*/
public boolean enumerated;
/** /**
* If the precision parameter is supported. * If the precision parameter is supported.
*/ */
...@@ -390,8 +385,11 @@ public class DataType { ...@@ -390,8 +385,11 @@ public class DataType {
new String[]{"RESULT_SET"}, new String[]{"RESULT_SET"},
400 400
); );
dataType = createString(false);
dataType.supportsPrecision = false;
dataType.supportsScale = false;
add(Value.ENUM, Types.OTHER, "Enum", add(Value.ENUM, Types.OTHER, "Enum",
createEnum(), dataType,
new String[]{"ENUM"}, new String[]{"ENUM"},
48 48
); );
...@@ -416,7 +414,6 @@ public class DataType { ...@@ -416,7 +414,6 @@ public class DataType {
dt.params = dataType.params; dt.params = dataType.params;
dt.prefix = dataType.prefix; dt.prefix = dataType.prefix;
dt.suffix = dataType.suffix; dt.suffix = dataType.suffix;
dt.enumerated = dataType.enumerated;
dt.supportsPrecision = dataType.supportsPrecision; dt.supportsPrecision = dataType.supportsPrecision;
dt.supportsScale = dataType.supportsScale; dt.supportsScale = dataType.supportsScale;
dt.defaultPrecision = dataType.defaultPrecision; dt.defaultPrecision = dataType.defaultPrecision;
...@@ -470,13 +467,6 @@ public class DataType { ...@@ -470,13 +467,6 @@ public class DataType {
return dataType; return dataType;
} }
private static DataType createEnum() {
DataType dataType = createString(false);
dataType.enumerated = true;
dataType.supportsPrecision = false;
dataType.supportsScale = false;
return dataType;
}
private static DataType createString(boolean caseSensitive) { private static DataType createString(boolean caseSensitive) {
DataType dataType = new DataType(); DataType dataType = new DataType();
dataType.prefix = "'"; dataType.prefix = "'";
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论