提交 83d7be8c authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Remove support of TCP protocol version 8

上级 25e6a14d
...@@ -45,12 +45,6 @@ public class Constants { ...@@ -45,12 +45,6 @@ public class Constants {
*/ */
public static final String BUILD_VENDOR_AND_VERSION = null; public static final String BUILD_VENDOR_AND_VERSION = null;
/**
* The TCP protocol version number 8.
* @since 1.2.143 (2010-09-18)
*/
public static final int TCP_PROTOCOL_VERSION_8 = 8;
/** /**
* The TCP protocol version number 9. * The TCP protocol version number 9.
* @since 1.3.158 (2011-07-17) * @since 1.3.158 (2011-07-17)
...@@ -114,7 +108,7 @@ public class Constants { ...@@ -114,7 +108,7 @@ public class Constants {
/** /**
* Minimum supported version of TCP protocol. * Minimum supported version of TCP protocol.
*/ */
public static final int TCP_PROTOCOL_VERSION_MIN_SUPPORTED = TCP_PROTOCOL_VERSION_8; public static final int TCP_PROTOCOL_VERSION_MIN_SUPPORTED = TCP_PROTOCOL_VERSION_9;
/** /**
* Maximum supported version of TCP protocol. * Maximum supported version of TCP protocol.
......
...@@ -14,7 +14,6 @@ import java.io.Reader; ...@@ -14,7 +14,6 @@ import java.io.Reader;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.Socket; import java.net.Socket;
import java.sql.Timestamp;
import org.h2.api.ErrorCode; import org.h2.api.ErrorCode;
import org.h2.api.IntervalQualifier; import org.h2.api.IntervalQualifier;
import org.h2.engine.Constants; import org.h2.engine.Constants;
...@@ -26,7 +25,6 @@ import org.h2.security.SHA256; ...@@ -26,7 +25,6 @@ import org.h2.security.SHA256;
import org.h2.store.Data; import org.h2.store.Data;
import org.h2.store.DataReader; import org.h2.store.DataReader;
import org.h2.util.Bits; import org.h2.util.Bits;
import org.h2.util.DateTimeUtils;
import org.h2.util.IOUtils; import org.h2.util.IOUtils;
import org.h2.util.JdbcUtils; import org.h2.util.JdbcUtils;
import org.h2.util.MathUtils; import org.h2.util.MathUtils;
...@@ -348,31 +346,17 @@ public class Transfer { ...@@ -348,31 +346,17 @@ public class Transfer {
break; break;
case Value.TIME: case Value.TIME:
writeInt(Value.TIME); writeInt(Value.TIME);
if (version >= Constants.TCP_PROTOCOL_VERSION_9) { writeLong(((ValueTime) v).getNanos());
writeLong(((ValueTime) v).getNanos());
} else {
writeLong(DateTimeUtils.getTimeLocalWithoutDst(v.getTime()));
}
break; break;
case Value.DATE: case Value.DATE:
writeInt(Value.DATE); writeInt(Value.DATE);
if (version >= Constants.TCP_PROTOCOL_VERSION_9) { writeLong(((ValueDate) v).getDateValue());
writeLong(((ValueDate) v).getDateValue());
} else {
writeLong(DateTimeUtils.getTimeLocalWithoutDst(v.getDate()));
}
break; break;
case Value.TIMESTAMP: { case Value.TIMESTAMP: {
writeInt(Value.TIMESTAMP); writeInt(Value.TIMESTAMP);
if (version >= Constants.TCP_PROTOCOL_VERSION_9) { ValueTimestamp ts = (ValueTimestamp) v;
ValueTimestamp ts = (ValueTimestamp) v; writeLong(ts.getDateValue());
writeLong(ts.getDateValue()); writeLong(ts.getTimeNanos());
writeLong(ts.getTimeNanos());
} else {
Timestamp ts = v.getTimestamp();
writeLong(DateTimeUtils.getTimeLocalWithoutDst(ts));
writeInt(ts.getNanos() % 1_000_000);
}
break; break;
} }
case Value.TIMESTAMP_TZ: { case Value.TIMESTAMP_TZ: {
...@@ -608,30 +592,13 @@ public class Transfer { ...@@ -608,30 +592,13 @@ public class Transfer {
case Value.BYTE: case Value.BYTE:
return ValueByte.get(readByte()); return ValueByte.get(readByte());
case Value.DATE: case Value.DATE:
if (version >= Constants.TCP_PROTOCOL_VERSION_9) { return ValueDate.fromDateValue(readLong());
return ValueDate.fromDateValue(readLong());
} else {
return ValueDate.fromMillis(DateTimeUtils.getTimeUTCWithoutDst(readLong()));
}
case Value.TIME: case Value.TIME:
if (version >= Constants.TCP_PROTOCOL_VERSION_9) { return ValueTime.fromNanos(readLong());
return ValueTime.fromNanos(readLong()); case Value.TIMESTAMP:
} else { return ValueTimestamp.fromDateValueAndNanos(readLong(), readLong());
return ValueTime.fromMillis(DateTimeUtils.getTimeUTCWithoutDst(readLong()));
}
case Value.TIMESTAMP: {
if (version >= Constants.TCP_PROTOCOL_VERSION_9) {
return ValueTimestamp.fromDateValueAndNanos(
readLong(), readLong());
} else {
return ValueTimestamp.fromMillisNanos(
DateTimeUtils.getTimeUTCWithoutDst(readLong()),
readInt() % 1_000_000);
}
}
case Value.TIMESTAMP_TZ: { case Value.TIMESTAMP_TZ: {
return ValueTimestampTimeZone.fromDateValueAndNanos(readLong(), return ValueTimestampTimeZone.fromDateValueAndNanos(readLong(), readLong(), (short) readInt());
readLong(), (short) readInt());
} }
case Value.DECIMAL: case Value.DECIMAL:
return ValueDecimal.get(new BigDecimal(readString())); return ValueDecimal.get(new BigDecimal(readString()));
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论