提交 2daa26ba authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Remove unused display size parameters

上级 584b1c8d
...@@ -169,7 +169,7 @@ public class BinaryOperation extends Expression { ...@@ -169,7 +169,7 @@ public class BinaryOperation extends Expression {
if (DataType.isStringType(l.getValueType()) && DataType.isStringType(r.getValueType())) { if (DataType.isStringType(l.getValueType()) && DataType.isStringType(r.getValueType())) {
long precision = l.getPrecision() + r.getPrecision(); long precision = l.getPrecision() + r.getPrecision();
if (precision >= 0 && precision < Integer.MAX_VALUE) { if (precision >= 0 && precision < Integer.MAX_VALUE) {
type = TypeInfo.getTypeInfo(Value.STRING, precision, 0, (int) precision, null); type = TypeInfo.getTypeInfo(Value.STRING, precision, 0, null);
break; break;
} }
} }
......
...@@ -2317,20 +2317,20 @@ public class Function extends Expression implements FunctionCall { ...@@ -2317,20 +2317,20 @@ public class Function extends Expression implements FunctionCall {
allConst = false; allConst = false;
} }
} }
int t, s, d; int t, s;
long p; long p;
Expression p0 = args.length < 1 ? null : args[0]; Expression p0 = args.length < 1 ? null : args[0];
switch (info.type) { switch (info.type) {
case DATE_ADD: { case DATE_ADD: {
t = Value.TIMESTAMP; t = Value.TIMESTAMP;
p = d = ValueTimestamp.DEFAULT_PRECISION; p = ValueTimestamp.DEFAULT_PRECISION;
s = ValueTimestamp.MAXIMUM_SCALE; s = ValueTimestamp.MAXIMUM_SCALE;
if (p0.isConstant()) { if (p0.isConstant()) {
Expression p2 = args[2]; Expression p2 = args[2];
switch (p2.getType().getValueType()) { switch (p2.getType().getValueType()) {
case Value.TIME: case Value.TIME:
t = Value.TIME; t = Value.TIME;
p = d = ValueTime.DEFAULT_PRECISION; p = ValueTime.DEFAULT_PRECISION;
break; break;
case Value.DATE: { case Value.DATE: {
int field = DateTimeFunctions.getDatePart(p0.getValue(session).getString()); int field = DateTimeFunctions.getDatePart(p0.getValue(session).getString());
...@@ -2346,14 +2346,14 @@ public class Function extends Expression implements FunctionCall { ...@@ -2346,14 +2346,14 @@ public class Function extends Expression implements FunctionCall {
break; break;
default: default:
t = Value.DATE; t = Value.DATE;
p = d = ValueDate.PRECISION; p = ValueDate.PRECISION;
s = 0; s = 0;
} }
break; break;
} }
case Value.TIMESTAMP_TZ: case Value.TIMESTAMP_TZ:
t = Value.TIMESTAMP_TZ; t = Value.TIMESTAMP_TZ;
p = d = ValueTimestampTimeZone.DEFAULT_PRECISION; p = ValueTimestampTimeZone.DEFAULT_PRECISION;
} }
} }
break; break;
...@@ -2363,12 +2363,10 @@ public class Function extends Expression implements FunctionCall { ...@@ -2363,12 +2363,10 @@ public class Function extends Expression implements FunctionCall {
t = Value.DECIMAL; t = Value.DECIMAL;
p = ValueLong.PRECISION + ValueTimestamp.MAXIMUM_SCALE; p = ValueLong.PRECISION + ValueTimestamp.MAXIMUM_SCALE;
s = ValueTimestamp.MAXIMUM_SCALE; s = ValueTimestamp.MAXIMUM_SCALE;
d = ValueLong.PRECISION + ValueTimestamp.MAXIMUM_SCALE + 1;
} else { } else {
t = Value.INT; t = Value.INT;
p = ValueInt.PRECISION; p = ValueInt.PRECISION;
s = 0; s = 0;
d = ValueInt.DISPLAY_SIZE;
} }
break; break;
} }
...@@ -2376,10 +2374,10 @@ public class Function extends Expression implements FunctionCall { ...@@ -2376,10 +2374,10 @@ public class Function extends Expression implements FunctionCall {
Expression p1 = args[1]; Expression p1 = args[1];
t = p1.getType().getValueType(); t = p1.getType().getValueType();
if (t == Value.TIMESTAMP_TZ) { if (t == Value.TIMESTAMP_TZ) {
p = d = ValueTimestampTimeZone.DEFAULT_PRECISION; p = ValueTimestampTimeZone.DEFAULT_PRECISION;
} else { } else {
t = Value.TIMESTAMP; t = Value.TIMESTAMP;
p = d = ValueTimestamp.DEFAULT_PRECISION; p = ValueTimestamp.DEFAULT_PRECISION;
} }
s = ValueTimestamp.MAXIMUM_SCALE; s = ValueTimestamp.MAXIMUM_SCALE;
break; break;
...@@ -2392,7 +2390,6 @@ public class Function extends Expression implements FunctionCall { ...@@ -2392,7 +2390,6 @@ public class Function extends Expression implements FunctionCall {
t = Value.UNKNOWN; t = Value.UNKNOWN;
s = 0; s = 0;
p = 0; p = 0;
d = 0;
for (Expression e : args) { for (Expression e : args) {
if (e != ValueExpression.getNull()) { if (e != ValueExpression.getNull()) {
TypeInfo type = e.getType(); TypeInfo type = e.getType();
...@@ -2401,7 +2398,6 @@ public class Function extends Expression implements FunctionCall { ...@@ -2401,7 +2398,6 @@ public class Function extends Expression implements FunctionCall {
t = Value.getHigherOrder(t, valueType); t = Value.getHigherOrder(t, valueType);
s = Math.max(s, type.getScale()); s = Math.max(s, type.getScale());
p = Math.max(p, type.getPrecision()); p = Math.max(p, type.getPrecision());
d = Math.max(d, type.getDisplaySize());
} }
} }
} }
...@@ -2409,7 +2405,6 @@ public class Function extends Expression implements FunctionCall { ...@@ -2409,7 +2405,6 @@ public class Function extends Expression implements FunctionCall {
t = Value.STRING; t = Value.STRING;
s = 0; s = 0;
p = Integer.MAX_VALUE; p = Integer.MAX_VALUE;
d = Integer.MAX_VALUE;
} }
break; break;
} }
...@@ -2418,7 +2413,6 @@ public class Function extends Expression implements FunctionCall { ...@@ -2418,7 +2413,6 @@ public class Function extends Expression implements FunctionCall {
t = Value.UNKNOWN; t = Value.UNKNOWN;
s = 0; s = 0;
p = 0; p = 0;
d = 0;
// (expr, when, then) // (expr, when, then)
// (expr, when, then, else) // (expr, when, then, else)
// (expr, when, then, when, then) // (expr, when, then, when, then)
...@@ -2432,7 +2426,6 @@ public class Function extends Expression implements FunctionCall { ...@@ -2432,7 +2426,6 @@ public class Function extends Expression implements FunctionCall {
t = Value.getHigherOrder(t, valueType); t = Value.getHigherOrder(t, valueType);
s = Math.max(s, type.getScale()); s = Math.max(s, type.getScale());
p = Math.max(p, type.getPrecision()); p = Math.max(p, type.getPrecision());
d = Math.max(d, type.getDisplaySize());
} }
} }
} }
...@@ -2445,7 +2438,6 @@ public class Function extends Expression implements FunctionCall { ...@@ -2445,7 +2438,6 @@ public class Function extends Expression implements FunctionCall {
t = Value.getHigherOrder(t, valueType); t = Value.getHigherOrder(t, valueType);
s = Math.max(s, type.getScale()); s = Math.max(s, type.getScale());
p = Math.max(p, type.getPrecision()); p = Math.max(p, type.getPrecision());
d = Math.max(d, type.getDisplaySize());
} }
} }
} }
...@@ -2453,7 +2445,6 @@ public class Function extends Expression implements FunctionCall { ...@@ -2453,7 +2445,6 @@ public class Function extends Expression implements FunctionCall {
t = Value.STRING; t = Value.STRING;
s = 0; s = 0;
p = Integer.MAX_VALUE; p = Integer.MAX_VALUE;
d = Integer.MAX_VALUE;
} }
break; break;
} }
...@@ -2461,7 +2452,6 @@ public class Function extends Expression implements FunctionCall { ...@@ -2461,7 +2452,6 @@ public class Function extends Expression implements FunctionCall {
TypeInfo t1 = args[1].getType(), t2 = args[2].getType(); TypeInfo t1 = args[1].getType(), t2 = args[2].getType();
t = Value.getHigherOrder(t1.getValueType(), t2.getValueType()); t = Value.getHigherOrder(t1.getValueType(), t2.getValueType());
p = Math.max(t1.getPrecision(), t2.getPrecision()); p = Math.max(t1.getPrecision(), t2.getPrecision());
d = Math.max(t1.getDisplaySize(), t2.getDisplaySize());
s = Math.max(t1.getScale(), t2.getScale()); s = Math.max(t1.getScale(), t2.getScale());
break; break;
} }
...@@ -2479,7 +2469,6 @@ public class Function extends Expression implements FunctionCall { ...@@ -2479,7 +2469,6 @@ public class Function extends Expression implements FunctionCall {
break; break;
} }
p = Math.max(t1.getPrecision(), t2.getPrecision()); p = Math.max(t1.getPrecision(), t2.getPrecision());
d = Math.max(t1.getDisplaySize(), t2.getDisplaySize());
s = Math.max(t1.getScale(), t2.getScale()); s = Math.max(t1.getScale(), t2.getScale());
break; break;
} }
...@@ -2491,10 +2480,9 @@ public class Function extends Expression implements FunctionCall { ...@@ -2491,10 +2480,9 @@ public class Function extends Expression implements FunctionCall {
t = dataType; t = dataType;
p = type.getPrecision(); p = type.getPrecision();
s = type.getScale(); s = type.getScale();
d = type.getDisplaySize();
} else { } else {
t = Value.UNKNOWN; t = Value.UNKNOWN;
p = s = d = 0; p = s = 0;
} }
break; break;
case TRUNCATE: case TRUNCATE:
...@@ -2503,19 +2491,18 @@ public class Function extends Expression implements FunctionCall { ...@@ -2503,19 +2491,18 @@ public class Function extends Expression implements FunctionCall {
case Value.DATE: case Value.DATE:
case Value.TIMESTAMP: case Value.TIMESTAMP:
t = Value.TIMESTAMP; t = Value.TIMESTAMP;
p = d = ValueTimestamp.DEFAULT_PRECISION; p = ValueTimestamp.DEFAULT_PRECISION;
s = 0; s = 0;
break; break;
case Value.TIMESTAMP_TZ: case Value.TIMESTAMP_TZ:
t = Value.TIMESTAMP; t = Value.TIMESTAMP;
p = d = ValueTimestampTimeZone.DEFAULT_PRECISION; p = ValueTimestampTimeZone.DEFAULT_PRECISION;
s = 0; s = 0;
break; break;
default: default:
t = Value.DOUBLE; t = Value.DOUBLE;
s = 0; s = 0;
p = ValueDouble.PRECISION; p = ValueDouble.PRECISION;
d = ValueDouble.DISPLAY_SIZE;
} }
break; break;
case ABS: case ABS:
...@@ -2525,11 +2512,9 @@ public class Function extends Expression implements FunctionCall { ...@@ -2525,11 +2512,9 @@ public class Function extends Expression implements FunctionCall {
t = type.getValueType(); t = type.getValueType();
s = type.getScale(); s = type.getScale();
p = type.getPrecision(); p = type.getPrecision();
d = type.getDisplaySize();
if (t == Value.NULL) { if (t == Value.NULL) {
t = Value.INT; t = Value.INT;
p = ValueInt.PRECISION; p = ValueInt.PRECISION;
d = ValueInt.DISPLAY_SIZE;
s = 0; s = 0;
} }
break; break;
...@@ -2539,7 +2524,6 @@ public class Function extends Expression implements FunctionCall { ...@@ -2539,7 +2524,6 @@ public class Function extends Expression implements FunctionCall {
t = type.getValueType(); t = type.getValueType();
p = type.getPrecision(); p = type.getPrecision();
s = type.getScale(); s = type.getScale();
d = type.getDisplaySize();
if (!(p0 instanceof Variable)) { if (!(p0 instanceof Variable)) {
throw DbException.get( throw DbException.get(
ErrorCode.CAN_ONLY_ASSIGN_TO_VARIABLE_1, p0.getSQL()); ErrorCode.CAN_ONLY_ASSIGN_TO_VARIABLE_1, p0.getSQL());
...@@ -2554,7 +2538,6 @@ public class Function extends Expression implements FunctionCall { ...@@ -2554,7 +2538,6 @@ public class Function extends Expression implements FunctionCall {
} }
p = Integer.MAX_VALUE; p = Integer.MAX_VALUE;
s = 0; s = 0;
d = Integer.MAX_VALUE;
break; break;
} }
case SUBSTRING: case SUBSTRING:
...@@ -2572,7 +2555,6 @@ public class Function extends Expression implements FunctionCall { ...@@ -2572,7 +2555,6 @@ public class Function extends Expression implements FunctionCall {
p = Math.min(p, args[2].getValue(session).getLong()); p = Math.min(p, args[2].getValue(session).getLong());
} }
p = Math.max(0, p); p = Math.max(0, p);
d = MathUtils.convertLongToInt(p);
break; break;
} }
case ENCRYPT: case ENCRYPT:
...@@ -2580,7 +2562,6 @@ public class Function extends Expression implements FunctionCall { ...@@ -2580,7 +2562,6 @@ public class Function extends Expression implements FunctionCall {
t = info.returnDataType; t = info.returnDataType;
TypeInfo type = args[2].getType(); TypeInfo type = args[2].getType();
p = type.getPrecision(); p = type.getPrecision();
d = type.getDisplaySize();
s = 0; s = 0;
break; break;
} }
...@@ -2588,25 +2569,21 @@ public class Function extends Expression implements FunctionCall { ...@@ -2588,25 +2569,21 @@ public class Function extends Expression implements FunctionCall {
t = info.returnDataType; t = info.returnDataType;
TypeInfo type = args[0].getType(); TypeInfo type = args[0].getType();
p = type.getPrecision(); p = type.getPrecision();
d = type.getDisplaySize();
s = 0; s = 0;
break; break;
} }
case CHAR: case CHAR:
t = info.returnDataType; t = info.returnDataType;
p = 1; p = 1;
d = 1;
s = 0; s = 0;
break; break;
case CONCAT: case CONCAT:
t = info.returnDataType; t = info.returnDataType;
p = 0; p = 0;
d = 0;
s = 0; s = 0;
for (Expression e : args) { for (Expression e : args) {
TypeInfo type = e.getType(); TypeInfo type = e.getType();
p += type.getPrecision(); p += type.getPrecision();
d = MathUtils.convertLongToInt((long) d + type.getDisplaySize());
if (p < 0) { if (p < 0) {
p = Long.MAX_VALUE; p = Long.MAX_VALUE;
} }
...@@ -2615,7 +2592,6 @@ public class Function extends Expression implements FunctionCall { ...@@ -2615,7 +2592,6 @@ public class Function extends Expression implements FunctionCall {
case HEXTORAW: case HEXTORAW:
t = info.returnDataType; t = info.returnDataType;
p = (args[0].getType().getPrecision() + 3) / 4; p = (args[0].getType().getPrecision() + 3) / 4;
d = MathUtils.convertLongToInt(p);
s = 0; s = 0;
break; break;
case LCASE: case LCASE:
...@@ -2631,36 +2607,33 @@ public class Function extends Expression implements FunctionCall { ...@@ -2631,36 +2607,33 @@ public class Function extends Expression implements FunctionCall {
t = info.returnDataType; t = info.returnDataType;
TypeInfo type = args[0].getType(); TypeInfo type = args[0].getType();
p = type.getPrecision(); p = type.getPrecision();
d = type.getDisplaySize();
s = 0; s = 0;
break; break;
} }
case RAWTOHEX: case RAWTOHEX:
t = info.returnDataType; t = info.returnDataType;
p = args[0].getType().getPrecision() * 4; p = args[0].getType().getPrecision() * 4;
d = MathUtils.convertLongToInt(p);
s = 0; s = 0;
break; break;
case SOUNDEX: case SOUNDEX:
t = info.returnDataType; t = info.returnDataType;
p = d = 4; p = 4;
s = 0; s = 0;
break; break;
case DAY_NAME: case DAY_NAME:
case MONTH_NAME: case MONTH_NAME:
t = info.returnDataType; t = info.returnDataType;
// day and month names may be long in some languages // day and month names may be long in some languages
p = d = 20; p = 20;
s = 0; s = 0;
break; break;
default: default:
t = info.returnDataType; t = info.returnDataType;
DataType type = DataType.getDataType(t); DataType type = DataType.getDataType(t);
p = type.maxPrecision; p = type.maxPrecision;
d = type.defaultDisplaySize;
s = type.defaultScale; s = type.defaultScale;
} }
type = TypeInfo.getTypeInfo(t, p, s, d, extTypeInfo); type = TypeInfo.getTypeInfo(t, p, s, extTypeInfo);
dataType = t; dataType = t;
if (allConst) { if (allConst) {
Value v = getValue(session); Value v = getValue(session);
......
...@@ -421,8 +421,7 @@ public class ValueDataType implements DataType { ...@@ -421,8 +421,7 @@ public class ValueDataType implements DataType {
TypeInfo columnType = result.getColumnType(i); TypeInfo columnType = result.getColumnType(i);
buff.putVarInt(columnType.getValueType()). buff.putVarInt(columnType.getValueType()).
putVarLong(columnType.getPrecision()). putVarLong(columnType.getPrecision()).
putVarInt(columnType.getScale()). putVarInt(columnType.getScale());
putVarInt(columnType.getDisplaySize());
} }
while (result.next()) { while (result.next()) {
buff.put((byte) 1); buff.put((byte) 1);
...@@ -634,7 +633,7 @@ public class ValueDataType implements DataType { ...@@ -634,7 +633,7 @@ public class ValueDataType implements DataType {
SimpleResult rs = new SimpleResult(); SimpleResult rs = new SimpleResult();
int columns = readVarInt(buff); int columns = readVarInt(buff);
for (int i = 0; i < columns; i++) { for (int i = 0; i < columns; i++) {
rs.addColumn(readString(buff), readString(buff), readVarInt(buff), readVarLong(buff), readVarInt(buff), rs.addColumn(readString(buff), readString(buff), readVarInt(buff), readVarLong(buff),
readVarInt(buff)); readVarInt(buff));
} }
while (buff.get() != 0) { while (buff.get() != 0) {
......
...@@ -31,14 +31,13 @@ public class SimpleResult implements ResultInterface { ...@@ -31,14 +31,13 @@ public class SimpleResult implements ResultInterface {
/** Column type. */ /** Column type. */
final TypeInfo columnType; final TypeInfo columnType;
Column(String alias, String columnName, int columnType, long columnPrecision, int columnScale, Column(String alias, String columnName, int columnType, long columnPrecision, int columnScale) {
int displaySize) {
if (alias == null || columnName == null) { if (alias == null || columnName == null) {
throw new NullPointerException(); throw new NullPointerException();
} }
this.alias = alias; this.alias = alias;
this.columnName = columnName; this.columnName = columnName;
this.columnType = TypeInfo.getTypeInfo(columnType, columnPrecision, columnScale, displaySize, null); this.columnType = TypeInfo.getTypeInfo(columnType, columnPrecision, columnScale, null);
} }
Column(String alias, String columnName, TypeInfo columnType) { Column(String alias, String columnName, TypeInfo columnType) {
...@@ -108,11 +107,9 @@ public class SimpleResult implements ResultInterface { ...@@ -108,11 +107,9 @@ public class SimpleResult implements ResultInterface {
* @param columnType Column's value type. * @param columnType Column's value type.
* @param columnPrecision Column's precision. * @param columnPrecision Column's precision.
* @param columnScale Column's scale. * @param columnScale Column's scale.
* @param displaySize Column's display data size.
*/ */
public void addColumn(String alias, String columnName, int columnType, long columnPrecision, int columnScale, public void addColumn(String alias, String columnName, int columnType, long columnPrecision, int columnScale) {
int displaySize) { addColumn(new Column(alias, columnName, columnType, columnPrecision, columnScale));
addColumn(new Column(alias, columnName, columnType, columnPrecision, columnScale, displaySize));
} }
/** /**
......
...@@ -684,7 +684,6 @@ public class Data { ...@@ -684,7 +684,6 @@ public class Data {
writeVarInt(columnType.getValueType()); writeVarInt(columnType.getValueType());
writeVarLong(columnType.getPrecision()); writeVarLong(columnType.getPrecision());
writeVarInt(columnType.getScale()); writeVarInt(columnType.getScale());
writeVarInt(columnType.getDisplaySize());
} }
while (result.next()) { while (result.next()) {
writeByte((byte) 1); writeByte((byte) 1);
...@@ -908,7 +907,7 @@ public class Data { ...@@ -908,7 +907,7 @@ public class Data {
SimpleResult rs = new SimpleResult(); SimpleResult rs = new SimpleResult();
int columns = readVarInt(); int columns = readVarInt();
for (int i = 0; i < columns; i++) { for (int i = 0; i < columns; i++) {
rs.addColumn(readString(), readString(), readVarInt(), readVarLong(), readVarInt(), readVarInt()); rs.addColumn(readString(), readString(), readVarInt(), readVarLong(), readVarInt());
} }
while (readByte() != 0) { while (readByte() != 0) {
Value[] o = new Value[columns]; Value[] o = new Value[columns];
...@@ -1172,7 +1171,6 @@ public class Data { ...@@ -1172,7 +1171,6 @@ public class Data {
len += getVarIntLen(columnType.getValueType()); len += getVarIntLen(columnType.getValueType());
len += getVarLongLen(columnType.getPrecision()); len += getVarLongLen(columnType.getPrecision());
len += getVarIntLen(columnType.getScale()); len += getVarIntLen(columnType.getScale());
len += getVarIntLen(columnType.getDisplaySize());
} }
while (result.next()) { while (result.next()) {
len++; len++;
......
...@@ -518,14 +518,12 @@ public class Transfer { ...@@ -518,14 +518,12 @@ public class Transfer {
writeString(result.getColumnName(i)); writeString(result.getColumnName(i));
writeInt(columnType.getValueType()); writeInt(columnType.getValueType());
writeLong(columnType.getPrecision()); writeLong(columnType.getPrecision());
writeInt(columnType.getScale());
writeInt(columnType.getDisplaySize());
} else { } else {
writeString(result.getColumnName(i)); writeString(result.getColumnName(i));
writeInt(DataType.getDataType(columnType.getValueType()).sqlType); writeInt(DataType.getDataType(columnType.getValueType()).sqlType);
writeInt(MathUtils.convertLongToInt(columnType.getPrecision())); writeInt(MathUtils.convertLongToInt(columnType.getPrecision()));
writeInt(columnType.getScale());
} }
writeInt(columnType.getScale());
} }
while (result.next()) { while (result.next()) {
writeBoolean(true); writeBoolean(true);
...@@ -739,11 +737,10 @@ public class Transfer { ...@@ -739,11 +737,10 @@ public class Transfer {
int columns = readInt(); int columns = readInt();
for (int i = 0; i < columns; i++) { for (int i = 0; i < columns; i++) {
if (version >= Constants.TCP_PROTOCOL_VERSION_18) { if (version >= Constants.TCP_PROTOCOL_VERSION_18) {
rs.addColumn(readString(), readString(), readInt(), readLong(), readInt(), readInt()); rs.addColumn(readString(), readString(), readInt(), readLong(), readInt());
} else { } else {
String name = readString(); String name = readString();
rs.addColumn(name, name, DataType.convertSQLTypeToValueType(readInt()), readInt(), readInt(), rs.addColumn(name, name, DataType.convertSQLTypeToValueType(readInt()), readInt(), readInt());
Integer.MAX_VALUE);
} }
} }
while (readBoolean()) { while (readBoolean()) {
......
...@@ -227,13 +227,11 @@ public class TypeInfo { ...@@ -227,13 +227,11 @@ public class TypeInfo {
* the precision * the precision
* @param scale * @param scale
* the scale * the scale
* @param displaySize
* the display size in characters
* @param extTypeInfo * @param extTypeInfo
* the extended type information, or null * the extended type information, or null
* @return the data type with parameters object * @return the data type with parameters object
*/ */
public static TypeInfo getTypeInfo(int type, long precision, int scale, int displaySize, ExtTypeInfo extTypeInfo) { public static TypeInfo getTypeInfo(int type, long precision, int scale, ExtTypeInfo extTypeInfo) {
switch (type) { switch (type) {
case Value.NULL: case Value.NULL:
case Value.BOOLEAN: case Value.BOOLEAN:
......
...@@ -58,8 +58,7 @@ public class ValueResultSet extends Value { ...@@ -58,8 +58,7 @@ public class ValueResultSet extends Value {
meta.getColumnTypeName(i + 1)); meta.getColumnTypeName(i + 1));
int precision = meta.getPrecision(i + 1); int precision = meta.getPrecision(i + 1);
int scale = meta.getScale(i + 1); int scale = meta.getScale(i + 1);
int displaySize = meta.getColumnDisplaySize(i + 1); simple.addColumn(alias, name, columnType, precision, scale);
simple.addColumn(alias, name, columnType, precision, scale, displaySize);
} }
for (int i = 0; i < maxrows && rs.next(); i++) { for (int i = 0; i < maxrows && rs.next(); i++) {
Value[] list = new Value[columnCount]; Value[] list = new Value[columnCount];
......
...@@ -208,8 +208,8 @@ public class TestDataPage extends TestBase implements DataHandler { ...@@ -208,8 +208,8 @@ public class TestDataPage extends TestBase implements DataHandler {
ValueInt.get(10) })); ValueInt.get(10) }));
SimpleResult rs = new SimpleResult(); SimpleResult rs = new SimpleResult();
rs.addColumn("ID", "ID", Value.INT, 0, 0, ValueInt.DISPLAY_SIZE); rs.addColumn("ID", "ID", Value.INT, 0, 0);
rs.addColumn("NAME", "NAME", Value.STRING, 255, 0, 255); rs.addColumn("NAME", "NAME", Value.STRING, 255, 0);
rs.addRow(ValueInt.get(1), ValueString.get("Hello")); rs.addRow(ValueInt.get(1), ValueString.get("Hello"));
rs.addRow(ValueInt.get(2), ValueString.get("World")); rs.addRow(ValueInt.get(2), ValueString.get("World"));
rs.addRow(ValueInt.get(3), ValueString.get("Peace")); rs.addRow(ValueInt.get(3), ValueString.get("Peace"));
......
...@@ -205,7 +205,7 @@ public class TestValue extends TestDb { ...@@ -205,7 +205,7 @@ public class TestValue extends TestDb {
assertEquals(10, v.convertPrecision(10, true).getType().getPrecision()); assertEquals(10, v.convertPrecision(10, true).getType().getPrecision());
SimpleResult rs = new SimpleResult(); SimpleResult rs = new SimpleResult();
rs.addColumn("X", "X", Value.INT, 0, 0, ValueInt.DISPLAY_SIZE); rs.addColumn("X", "X", Value.INT, 0, 0);
rs.addRow(ValueInt.get(1)); rs.addRow(ValueInt.get(1));
v = ValueResultSet.get(rs); v = ValueResultSet.get(rs);
assertEquals(Integer.MAX_VALUE, v.getType().getPrecision()); assertEquals(Integer.MAX_VALUE, v.getType().getPrecision());
...@@ -236,8 +236,8 @@ public class TestValue extends TestDb { ...@@ -236,8 +236,8 @@ public class TestValue extends TestDb {
testValueResultSetTest(ValueResultSet.get(null, rs, 2), 2, true); testValueResultSetTest(ValueResultSet.get(null, rs, 2), 2, true);
SimpleResult result = new SimpleResult(); SimpleResult result = new SimpleResult();
result.addColumn("ID", "ID", Value.INT, 0, 0, ValueInt.DISPLAY_SIZE); result.addColumn("ID", "ID", Value.INT, 0, 0);
result.addColumn("NAME", "NAME", Value.STRING, 255, 0, 255); result.addColumn("NAME", "NAME", Value.STRING, 255, 0);
result.addRow(ValueInt.get(1), ValueString.get("Hello")); result.addRow(ValueInt.get(1), ValueString.get("Hello"));
result.addRow(ValueInt.get(2), ValueString.get("World")); result.addRow(ValueInt.get(2), ValueString.get("World"));
result.addRow(ValueInt.get(3), ValueString.get("Peace")); result.addRow(ValueInt.get(3), ValueString.get("Peace"));
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论