Unverified 提交 0e91d76a authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov 提交者: GitHub

Merge pull request #1713 from katzyn/value

Remove DataType.defaultDisplaySize and fix display size in TypeInfo
...@@ -7,6 +7,8 @@ package org.h2.api; ...@@ -7,6 +7,8 @@ package org.h2.api;
import org.h2.store.DataHandler; import org.h2.store.DataHandler;
import org.h2.value.DataType; import org.h2.value.DataType;
import org.h2.value.ExtTypeInfo;
import org.h2.value.TypeInfo;
import org.h2.value.Value; import org.h2.value.Value;
/** /**
...@@ -36,6 +38,17 @@ public interface CustomDataTypesHandler { ...@@ -36,6 +38,17 @@ public interface CustomDataTypesHandler {
*/ */
DataType getDataTypeById(int type); DataType getDataTypeById(int type);
/**
* Get type info for the given data type identity.
*
* @param type identifier of a data type
* @param precision precision
* @param scale scale
* @param extTypeInfo the extended type information, or null
* @return type information
*/
TypeInfo getTypeInfoById(int type, long precision, int scale, ExtTypeInfo extTypeInfo);
/** /**
* Get order for custom data type given its integer id * Get order for custom data type given its integer id
* *
......
...@@ -5899,7 +5899,7 @@ public class Parser { ...@@ -5899,7 +5899,7 @@ public class Parser {
String columnName = "C" + (i + 1); String columnName = "C" + (i + 1);
if (rows.isEmpty()) { if (rows.isEmpty()) {
if (type.getValueType() == Value.UNKNOWN) { if (type.getValueType() == Value.UNKNOWN) {
type = TypeInfo.TYPE_STRING_DEFAULT; type = TypeInfo.TYPE_STRING;
} }
column = new Column(columnName, type); column = new Column(columnName, type);
columns.add(column); columns.add(column);
......
...@@ -172,7 +172,7 @@ public class BinaryOperation extends Expression { ...@@ -172,7 +172,7 @@ public class BinaryOperation extends Expression {
break; break;
} }
} }
type = TypeInfo.TYPE_STRING_DEFAULT; type = TypeInfo.TYPE_STRING;
break; break;
} }
case PLUS: case PLUS:
...@@ -188,7 +188,7 @@ public class BinaryOperation extends Expression { ...@@ -188,7 +188,7 @@ public class BinaryOperation extends Expression {
// string when text concatenation with + is enabled // string when text concatenation with + is enabled
if (opType == OpType.PLUS && session.getDatabase(). if (opType == OpType.PLUS && session.getDatabase().
getMode().allowPlusForStringConcat) { getMode().allowPlusForStringConcat) {
type = TypeInfo.TYPE_STRING_DEFAULT; type = TypeInfo.TYPE_STRING;
opType = OpType.CONCAT; opType = OpType.CONCAT;
} else { } else {
type = TypeInfo.TYPE_DECIMAL_DEFAULT; type = TypeInfo.TYPE_DECIMAL_DEFAULT;
......
...@@ -648,7 +648,7 @@ public class Aggregate extends AbstractAggregate { ...@@ -648,7 +648,7 @@ public class Aggregate extends AbstractAggregate {
} }
switch (aggregateType) { switch (aggregateType) {
case GROUP_CONCAT: case GROUP_CONCAT:
type = TypeInfo.TYPE_STRING_DEFAULT; type = TypeInfo.TYPE_STRING;
break; break;
case COUNT_ALL: case COUNT_ALL:
case COUNT: case COUNT:
......
...@@ -2374,7 +2374,7 @@ public class Function extends Expression implements FunctionCall { ...@@ -2374,7 +2374,7 @@ public class Function extends Expression implements FunctionCall {
} }
} }
if (typeInfo.getValueType() == Value.UNKNOWN) { if (typeInfo.getValueType() == Value.UNKNOWN) {
typeInfo = TypeInfo.TYPE_STRING_DEFAULT; typeInfo = TypeInfo.TYPE_STRING;
} }
break; break;
} }
...@@ -2406,7 +2406,7 @@ public class Function extends Expression implements FunctionCall { ...@@ -2406,7 +2406,7 @@ public class Function extends Expression implements FunctionCall {
} }
} }
if (typeInfo.getValueType() == Value.UNKNOWN) { if (typeInfo.getValueType() == Value.UNKNOWN) {
typeInfo = TypeInfo.TYPE_STRING_DEFAULT; typeInfo = TypeInfo.TYPE_STRING;
} }
break; break;
} }
......
...@@ -3187,12 +3187,12 @@ public class JdbcDatabaseMetaData extends TraceObject implements ...@@ -3187,12 +3187,12 @@ public class JdbcDatabaseMetaData extends TraceObject implements
public ResultSet getClientInfoProperties() throws SQLException { public ResultSet getClientInfoProperties() throws SQLException {
Properties clientInfo = conn.getClientInfo(); Properties clientInfo = conn.getClientInfo();
SimpleResult result = new SimpleResult(); SimpleResult result = new SimpleResult();
result.addColumn("NAME", "NAME", TypeInfo.TYPE_STRING_DEFAULT); result.addColumn("NAME", "NAME", TypeInfo.TYPE_STRING);
result.addColumn("MAX_LEN", "MAX_LEN", TypeInfo.TYPE_INT); result.addColumn("MAX_LEN", "MAX_LEN", TypeInfo.TYPE_INT);
result.addColumn("DEFAULT_VALUE", "DEFAULT_VALUE", TypeInfo.TYPE_STRING_DEFAULT); result.addColumn("DEFAULT_VALUE", "DEFAULT_VALUE", TypeInfo.TYPE_STRING);
result.addColumn("DESCRIPTION", "DESCRIPTION", TypeInfo.TYPE_STRING_DEFAULT); result.addColumn("DESCRIPTION", "DESCRIPTION", TypeInfo.TYPE_STRING);
// Non-standard column // Non-standard column
result.addColumn("VALUE", "VALUE", TypeInfo.TYPE_STRING_DEFAULT); result.addColumn("VALUE", "VALUE", TypeInfo.TYPE_STRING);
for (Entry<Object, Object> entry : clientInfo.entrySet()) { for (Entry<Object, Object> entry : clientInfo.entrySet()) {
result.addRow(ValueString.get((String) entry.getKey()), ValueInt.get(Integer.MAX_VALUE), result.addRow(ValueString.get((String) entry.getKey()), ValueInt.get(Integer.MAX_VALUE),
ValueString.EMPTY, ValueString.EMPTY, ValueString.get((String) entry.getValue())); ValueString.EMPTY, ValueString.EMPTY, ValueString.get((String) entry.getValue()));
......
...@@ -158,11 +158,6 @@ public class DataType { ...@@ -158,11 +158,6 @@ public class DataType {
*/ */
public int defaultScale; public int defaultScale;
/**
* The default display size.
*/
public int defaultDisplaySize;
/** /**
* If this data type should not be listed in the database meta data. * If this data type should not be listed in the database meta data.
*/ */
...@@ -185,7 +180,6 @@ public class DataType { ...@@ -185,7 +180,6 @@ public class DataType {
DataType dataType = new DataType(); DataType dataType = new DataType();
dataType.defaultPrecision = dataType.maxPrecision = ValueNull.PRECISION; dataType.defaultPrecision = dataType.maxPrecision = ValueNull.PRECISION;
dataType.defaultDisplaySize = ValueNull.DISPLAY_SIZE;
add(Value.NULL, Types.NULL, add(Value.NULL, Types.NULL,
dataType, dataType,
new String[]{"NULL"}, new String[]{"NULL"},
...@@ -337,7 +331,6 @@ public class DataType { ...@@ -337,7 +331,6 @@ public class DataType {
dataType = new DataType(); dataType = new DataType();
dataType.prefix = dataType.suffix = "'"; dataType.prefix = dataType.suffix = "'";
dataType.defaultPrecision = dataType.maxPrecision = ValueUuid.PRECISION; dataType.defaultPrecision = dataType.maxPrecision = ValueUuid.PRECISION;
dataType.defaultDisplaySize = ValueUuid.DISPLAY_SIZE;
add(Value.UUID, Types.BINARY, add(Value.UUID, Types.BINARY,
createString(false), createString(false),
// UNIQUEIDENTIFIER is the MSSQL mode equivalent // UNIQUEIDENTIFIER is the MSSQL mode equivalent
...@@ -377,7 +370,7 @@ public class DataType { ...@@ -377,7 +370,7 @@ public class DataType {
32 32
); );
dataType = new DataType(); dataType = new DataType();
dataType.maxPrecision = dataType.defaultPrecision = dataType.defaultDisplaySize = Integer.MAX_VALUE; dataType.maxPrecision = dataType.defaultPrecision = Integer.MAX_VALUE;
add(Value.RESULT_SET, DataType.TYPE_RESULT_SET, add(Value.RESULT_SET, DataType.TYPE_RESULT_SET,
dataType, dataType,
new String[]{"RESULT_SET"}, new String[]{"RESULT_SET"},
...@@ -441,9 +434,6 @@ public class DataType { ...@@ -441,9 +434,6 @@ public class DataType {
dataType.defaultScale = ValueInterval.DEFAULT_SCALE; dataType.defaultScale = ValueInterval.DEFAULT_SCALE;
dataType.maxScale = ValueInterval.MAXIMUM_SCALE; dataType.maxScale = ValueInterval.MAXIMUM_SCALE;
} }
dataType.defaultDisplaySize = ValueInterval.getDisplaySize(type, ValueInterval.DEFAULT_PRECISION,
// Scale will be ignored if it is not supported
ValueInterval.DEFAULT_SCALE);
add(type, Types.OTHER, dataType, add(type, Types.OTHER, dataType,
new String[]{("INTERVAL " + name).intern()}, new String[]{("INTERVAL " + name).intern()},
36 36
...@@ -469,7 +459,6 @@ public class DataType { ...@@ -469,7 +459,6 @@ public class DataType {
dt.supportsScale = dataType.supportsScale; dt.supportsScale = dataType.supportsScale;
dt.defaultPrecision = dataType.defaultPrecision; dt.defaultPrecision = dataType.defaultPrecision;
dt.defaultScale = dataType.defaultScale; dt.defaultScale = dataType.defaultScale;
dt.defaultDisplaySize = dataType.defaultDisplaySize;
dt.caseSensitive = dataType.caseSensitive; dt.caseSensitive = dataType.caseSensitive;
dt.hidden = i > 0; dt.hidden = i > 0;
dt.memory = memory; dt.memory = memory;
...@@ -504,7 +493,6 @@ public class DataType { ...@@ -504,7 +493,6 @@ public class DataType {
dataType.maxPrecision = maxPrecision; dataType.maxPrecision = maxPrecision;
dataType.defaultPrecision = defaultPrecision; dataType.defaultPrecision = defaultPrecision;
dataType.defaultScale = defaultScale; dataType.defaultScale = defaultScale;
dataType.defaultDisplaySize = defaultDisplaySize;
if (needsPrecisionAndScale) { if (needsPrecisionAndScale) {
dataType.params = "PRECISION,SCALE"; dataType.params = "PRECISION,SCALE";
dataType.supportsPrecision = true; dataType.supportsPrecision = true;
...@@ -537,7 +525,6 @@ public class DataType { ...@@ -537,7 +525,6 @@ public class DataType {
dataType.maxScale = maxScale; dataType.maxScale = maxScale;
dataType.defaultPrecision = precision; dataType.defaultPrecision = precision;
dataType.defaultScale = scale; dataType.defaultScale = scale;
dataType.defaultDisplaySize = precision;
return dataType; return dataType;
} }
...@@ -550,7 +537,6 @@ public class DataType { ...@@ -550,7 +537,6 @@ public class DataType {
dataType.supportsPrecision = true; dataType.supportsPrecision = true;
dataType.maxPrecision = Integer.MAX_VALUE; dataType.maxPrecision = Integer.MAX_VALUE;
dataType.defaultPrecision = Integer.MAX_VALUE; dataType.defaultPrecision = Integer.MAX_VALUE;
dataType.defaultDisplaySize = Integer.MAX_VALUE;
return dataType; return dataType;
} }
...@@ -568,7 +554,6 @@ public class DataType { ...@@ -568,7 +554,6 @@ public class DataType {
dataType.params = "TYPE,SRID"; dataType.params = "TYPE,SRID";
dataType.maxPrecision = Integer.MAX_VALUE; dataType.maxPrecision = Integer.MAX_VALUE;
dataType.defaultPrecision = Integer.MAX_VALUE; dataType.defaultPrecision = Integer.MAX_VALUE;
dataType.defaultDisplaySize = Integer.MAX_VALUE;
return dataType; return dataType;
} }
......
...@@ -191,7 +191,6 @@ public class TestCustomDataTypesHandler extends TestDb { ...@@ -191,7 +191,6 @@ public class TestCustomDataTypesHandler extends TestDb {
if (name.toLowerCase(Locale.ENGLISH).equals(COMPLEX_DATA_TYPE_NAME)) { if (name.toLowerCase(Locale.ENGLISH).equals(COMPLEX_DATA_TYPE_NAME)) {
return complexDataType; return complexDataType;
} }
return null; return null;
} }
...@@ -203,6 +202,11 @@ public class TestCustomDataTypesHandler extends TestDb { ...@@ -203,6 +202,11 @@ public class TestCustomDataTypesHandler extends TestDb {
return null; return null;
} }
@Override
public TypeInfo getTypeInfoById(int type, long precision, int scale, ExtTypeInfo extTypeInfo) {
return new TypeInfo(type, 0, 0, ValueDouble.DISPLAY_SIZE * 2 + 1, null);
}
@Override @Override
public String getDataTypeClassName(int type) { public String getDataTypeClassName(int type) {
if (type == COMPLEX_DATA_TYPE_ID) { if (type == COMPLEX_DATA_TYPE_ID) {
......
...@@ -143,7 +143,7 @@ public class TestDate extends TestBase { ...@@ -143,7 +143,7 @@ public class TestDate extends TestBase {
assertEquals((int) ((nanos >>> 32) ^ nanos), t1.hashCode()); assertEquals((int) ((nanos >>> 32) ^ nanos), t1.hashCode());
// Literals return maximum precision // Literals return maximum precision
TypeInfo type = t1.getType(); TypeInfo type = t1.getType();
assertEquals(ValueTime.DEFAULT_PRECISION, type.getDisplaySize()); assertEquals(ValueTime.MAXIMUM_PRECISION, type.getDisplaySize());
assertEquals(ValueTime.MAXIMUM_PRECISION, type.getPrecision()); assertEquals(ValueTime.MAXIMUM_PRECISION, type.getPrecision());
assertEquals("java.sql.Time", t1.getObject().getClass().getName()); assertEquals("java.sql.Time", t1.getObject().getClass().getName());
ValueTime t1b = ValueTime.parse("11:11:11"); ValueTime t1b = ValueTime.parse("11:11:11");
...@@ -221,7 +221,7 @@ public class TestDate extends TestBase { ...@@ -221,7 +221,7 @@ public class TestDate extends TestBase {
t1.hashCode()); t1.hashCode());
// Literals return maximum precision // Literals return maximum precision
TypeInfo type = t1.getType(); TypeInfo type = t1.getType();
assertEquals(ValueTimestamp.DEFAULT_PRECISION, type.getDisplaySize()); assertEquals(ValueTimestamp.MAXIMUM_PRECISION, type.getDisplaySize());
assertEquals(ValueTimestamp.MAXIMUM_PRECISION, type.getPrecision()); assertEquals(ValueTimestamp.MAXIMUM_PRECISION, type.getPrecision());
assertEquals(9, type.getScale()); assertEquals(9, type.getScale());
assertEquals("java.sql.Timestamp", t1.getObject().getClass().getName()); assertEquals("java.sql.Timestamp", t1.getObject().getClass().getName());
......
...@@ -45,6 +45,7 @@ import org.h2.value.ValueDecimal; ...@@ -45,6 +45,7 @@ import org.h2.value.ValueDecimal;
import org.h2.value.ValueDouble; import org.h2.value.ValueDouble;
import org.h2.value.ValueFloat; import org.h2.value.ValueFloat;
import org.h2.value.ValueInt; import org.h2.value.ValueInt;
import org.h2.value.ValueInterval;
import org.h2.value.ValueJavaObject; import org.h2.value.ValueJavaObject;
import org.h2.value.ValueLobDb; import org.h2.value.ValueLobDb;
import org.h2.value.ValueNull; import org.h2.value.ValueNull;
...@@ -83,6 +84,7 @@ public class TestValue extends TestDb { ...@@ -83,6 +84,7 @@ public class TestValue extends TestDb {
testModulusDecimal(); testModulusDecimal();
testModulusOperator(); testModulusOperator();
testLobComparison(); testLobComparison();
testTypeInfo();
} }
private void testResultSetOperations() throws SQLException { private void testResultSetOperations() throws SQLException {
...@@ -502,4 +504,118 @@ public class TestValue extends TestDb { ...@@ -502,4 +504,118 @@ public class TestValue extends TestDb {
} }
} }
private void testTypeInfo() {
testTypeInfoCheck(Value.UNKNOWN, -1, -1, -1, TypeInfo.TYPE_UNKNOWN);
try {
TypeInfo.getTypeInfo(Value.UNKNOWN);
fail();
} catch (DbException ex) {
assertEquals(ErrorCode.UNKNOWN_DATA_TYPE_1, ex.getErrorCode());
}
testTypeInfoCheck(Value.NULL, 1, 0, 4, TypeInfo.TYPE_NULL, TypeInfo.getTypeInfo(Value.NULL));
testTypeInfoCheck(Value.BOOLEAN, 1, 0, 5, TypeInfo.TYPE_BOOLEAN, TypeInfo.getTypeInfo(Value.BOOLEAN));
testTypeInfoCheck(Value.BYTE, 3, 0, 4, TypeInfo.TYPE_BYTE, TypeInfo.getTypeInfo(Value.BYTE));
testTypeInfoCheck(Value.SHORT, 5, 0, 6, TypeInfo.TYPE_SHORT, TypeInfo.getTypeInfo(Value.SHORT));
testTypeInfoCheck(Value.INT, 10, 0, 11, TypeInfo.TYPE_INT, TypeInfo.getTypeInfo(Value.INT));
testTypeInfoCheck(Value.LONG, 19, 0, 20, TypeInfo.TYPE_LONG, TypeInfo.getTypeInfo(Value.LONG));
testTypeInfoCheck(Value.FLOAT, 7, 0, 15, TypeInfo.TYPE_FLOAT, TypeInfo.getTypeInfo(Value.FLOAT));
testTypeInfoCheck(Value.DOUBLE, 17, 0, 24, TypeInfo.TYPE_DOUBLE, TypeInfo.getTypeInfo(Value.DOUBLE));
testTypeInfoCheck(Value.DECIMAL, Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE,
TypeInfo.TYPE_DECIMAL, TypeInfo.getTypeInfo(Value.DECIMAL));
testTypeInfoCheck(Value.DECIMAL, 65_535, 32_767, 65_537, TypeInfo.TYPE_DECIMAL_DEFAULT);
testTypeInfoCheck(Value.TIME, 18, 9, 18, TypeInfo.TYPE_TIME, TypeInfo.getTypeInfo(Value.TIME));
for (int s = 0; s <= 9; s++) {
int d = s > 0 ? s + 9 : 8;
testTypeInfoCheck(Value.TIME, d, s, d, TypeInfo.getTypeInfo(Value.TIME, 0, s, null));
}
testTypeInfoCheck(Value.DATE, 10, 0, 10, TypeInfo.TYPE_DATE, TypeInfo.getTypeInfo(Value.DATE));
testTypeInfoCheck(Value.TIMESTAMP, 29, 9, 29, TypeInfo.TYPE_TIMESTAMP, TypeInfo.getTypeInfo(Value.TIMESTAMP));
for (int s = 0; s <= 9; s++) {
int d = s > 0 ? s + 20 : 19;
testTypeInfoCheck(Value.TIMESTAMP, d, s, d, TypeInfo.getTypeInfo(Value.TIMESTAMP, 0, s, null));
}
testTypeInfoCheck(Value.TIMESTAMP_TZ, 35, 9, 35, TypeInfo.TYPE_TIMESTAMP_TZ,
TypeInfo.getTypeInfo(Value.TIMESTAMP_TZ));
for (int s = 0; s <= 9; s++) {
int d = s > 0 ? s + 26 : 25;
testTypeInfoCheck(Value.TIMESTAMP_TZ, d, s, d, TypeInfo.getTypeInfo(Value.TIMESTAMP_TZ, 0, s, null));
}
testTypeInfoCheck(Value.BYTES, Integer.MAX_VALUE, 0, Integer.MAX_VALUE, TypeInfo.getTypeInfo(Value.BYTES));
testTypeInfoCheck(Value.BLOB, Long.MAX_VALUE, 0, Integer.MAX_VALUE, TypeInfo.getTypeInfo(Value.BLOB));
testTypeInfoCheck(Value.CLOB, Long.MAX_VALUE, 0, Integer.MAX_VALUE, TypeInfo.getTypeInfo(Value.CLOB));
testTypeInfoCheck(Value.STRING, Integer.MAX_VALUE, 0, Integer.MAX_VALUE, TypeInfo.TYPE_STRING,
TypeInfo.getTypeInfo(Value.STRING));
testTypeInfoCheck(Value.STRING_FIXED, Integer.MAX_VALUE, 0, Integer.MAX_VALUE,
TypeInfo.getTypeInfo(Value.STRING_FIXED));
testTypeInfoCheck(Value.STRING_IGNORECASE, Integer.MAX_VALUE, 0, Integer.MAX_VALUE,
TypeInfo.getTypeInfo(Value.STRING_IGNORECASE));
testTypeInfoCheck(Value.ARRAY, Integer.MAX_VALUE, 0, Integer.MAX_VALUE, TypeInfo.TYPE_ARRAY,
TypeInfo.getTypeInfo(Value.ARRAY));
testTypeInfoCheck(Value.RESULT_SET, Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE,
TypeInfo.TYPE_RESULT_SET, TypeInfo.getTypeInfo(Value.RESULT_SET));
testTypeInfoCheck(Value.ROW, Integer.MAX_VALUE, 0, Integer.MAX_VALUE, TypeInfo.TYPE_ROW,
TypeInfo.getTypeInfo(Value.ROW));
testTypeInfoCheck(Value.JAVA_OBJECT, Integer.MAX_VALUE, 0, Integer.MAX_VALUE, TypeInfo.TYPE_JAVA_OBJECT,
TypeInfo.getTypeInfo(Value.JAVA_OBJECT));
testTypeInfoCheck(Value.UUID, 16, 0, 36, TypeInfo.TYPE_UUID, TypeInfo.getTypeInfo(Value.UUID));
testTypeInfoCheck(Value.GEOMETRY, Integer.MAX_VALUE, 0, Integer.MAX_VALUE, TypeInfo.TYPE_GEOMETRY,
TypeInfo.getTypeInfo(Value.GEOMETRY));
testTypeInfoCheck(Value.ENUM, Integer.MAX_VALUE, 0, Integer.MAX_VALUE, TypeInfo.TYPE_ENUM_UNDEFINED,
TypeInfo.getTypeInfo(Value.ENUM));
testTypeInfoInterval1(Value.INTERVAL_YEAR);
testTypeInfoInterval1(Value.INTERVAL_MONTH);
testTypeInfoInterval1(Value.INTERVAL_DAY);
testTypeInfoInterval1(Value.INTERVAL_HOUR);
testTypeInfoInterval1(Value.INTERVAL_MINUTE);
testTypeInfoInterval2(Value.INTERVAL_SECOND);
testTypeInfoInterval1(Value.INTERVAL_YEAR_TO_MONTH);
testTypeInfoInterval1(Value.INTERVAL_DAY_TO_HOUR);
testTypeInfoInterval1(Value.INTERVAL_DAY_TO_MINUTE);
testTypeInfoInterval2(Value.INTERVAL_DAY_TO_SECOND);
testTypeInfoInterval1(Value.INTERVAL_HOUR_TO_MINUTE);
testTypeInfoInterval2(Value.INTERVAL_HOUR_TO_SECOND);
testTypeInfoInterval2(Value.INTERVAL_MINUTE_TO_SECOND);
}
private void testTypeInfoInterval1(int type) {
testTypeInfoCheck(type, 18, 0, ValueInterval.getDisplaySize(type, 18, 0), TypeInfo.getTypeInfo(type));
for (int p = 1; p <= 18; p++) {
testTypeInfoCheck(type, p, 0, ValueInterval.getDisplaySize(type, p, 0),
TypeInfo.getTypeInfo(type, p, 0, null));
}
}
private void testTypeInfoInterval2(int type) {
testTypeInfoCheck(type, 18, 9, ValueInterval.getDisplaySize(type, 18, 9), TypeInfo.getTypeInfo(type));
for (int p = 1; p <= 18; p++) {
for (int s = 0; s <= 9; s++) {
testTypeInfoCheck(type, p, s, ValueInterval.getDisplaySize(type, p, s),
TypeInfo.getTypeInfo(type, p, s, null));
}
}
}
private void testTypeInfoCheck(int valueType, long precision, int scale, int displaySize, TypeInfo... typeInfos) {
for (TypeInfo typeInfo : typeInfos) {
testTypeInfoCheck(valueType, precision, scale, displaySize, typeInfo);
}
}
private void testTypeInfoCheck(int valueType, long precision, int scale, int displaySize, TypeInfo typeInfo) {
assertEquals(valueType, typeInfo.getValueType());
assertEquals(precision, typeInfo.getPrecision());
assertEquals(scale, typeInfo.getScale());
assertEquals(displaySize, typeInfo.getDisplaySize());
}
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论