提交 40d5af8e authored 作者: Thomas Mueller's avatar Thomas Mueller

The new date conversion is actually also problematic.

上级 cca61783
...@@ -56,11 +56,6 @@ public class Constants { ...@@ -56,11 +56,6 @@ public class Constants {
*/ */
public static final int TCP_PROTOCOL_VERSION_8 = 8; public static final int TCP_PROTOCOL_VERSION_8 = 8;
/**
* The TCP protocol version number 9.
*/
public static final int TCP_PROTOCOL_VERSION_9 = 9;
/** /**
* The major version of this database. * The major version of this database.
*/ */
......
...@@ -94,7 +94,7 @@ public class SessionRemote extends SessionWithState implements DataHandler { ...@@ -94,7 +94,7 @@ public class SessionRemote extends SessionWithState implements DataHandler {
trans.setSSL(ci.isSSL()); trans.setSSL(ci.isSSL());
trans.init(); trans.init();
trans.writeInt(Constants.TCP_PROTOCOL_VERSION_6); trans.writeInt(Constants.TCP_PROTOCOL_VERSION_6);
trans.writeInt(Constants.TCP_PROTOCOL_VERSION_9); trans.writeInt(Constants.TCP_PROTOCOL_VERSION_8);
trans.writeString(db); trans.writeString(db);
trans.writeString(ci.getOriginalURL()); trans.writeString(ci.getOriginalURL());
trans.writeString(ci.getUserName()); trans.writeString(ci.getUserName());
......
...@@ -71,12 +71,12 @@ public class TcpServerThread implements Runnable { ...@@ -71,12 +71,12 @@ public class TcpServerThread implements Runnable {
int minClientVersion = transfer.readInt(); int minClientVersion = transfer.readInt();
if (minClientVersion < Constants.TCP_PROTOCOL_VERSION_6) { if (minClientVersion < Constants.TCP_PROTOCOL_VERSION_6) {
throw DbException.get(ErrorCode.DRIVER_VERSION_ERROR_2, "" + clientVersion, "" + Constants.TCP_PROTOCOL_VERSION_6); throw DbException.get(ErrorCode.DRIVER_VERSION_ERROR_2, "" + clientVersion, "" + Constants.TCP_PROTOCOL_VERSION_6);
} else if (minClientVersion > Constants.TCP_PROTOCOL_VERSION_9) { } else if (minClientVersion > Constants.TCP_PROTOCOL_VERSION_8) {
throw DbException.get(ErrorCode.DRIVER_VERSION_ERROR_2, "" + clientVersion, "" + Constants.TCP_PROTOCOL_VERSION_9); throw DbException.get(ErrorCode.DRIVER_VERSION_ERROR_2, "" + clientVersion, "" + Constants.TCP_PROTOCOL_VERSION_8);
} }
int maxClientVersion = transfer.readInt(); int maxClientVersion = transfer.readInt();
if (maxClientVersion >= Constants.TCP_PROTOCOL_VERSION_9) { if (maxClientVersion >= Constants.TCP_PROTOCOL_VERSION_8) {
clientVersion = Constants.TCP_PROTOCOL_VERSION_9; clientVersion = Constants.TCP_PROTOCOL_VERSION_8;
} else { } else {
clientVersion = minClientVersion; clientVersion = minClientVersion;
} }
......
...@@ -230,7 +230,7 @@ public class FileLock implements Runnable { ...@@ -230,7 +230,7 @@ public class FileLock implements Runnable {
transfer.setSocket(socket); transfer.setSocket(socket);
transfer.init(); transfer.init();
transfer.writeInt(Constants.TCP_PROTOCOL_VERSION_6); transfer.writeInt(Constants.TCP_PROTOCOL_VERSION_6);
transfer.writeInt(Constants.TCP_PROTOCOL_VERSION_9); transfer.writeInt(Constants.TCP_PROTOCOL_VERSION_8);
transfer.writeString(null); transfer.writeString(null);
transfer.writeString(null); transfer.writeString(null);
transfer.writeString(id); transfer.writeString(id);
......
...@@ -320,18 +320,14 @@ public class Transfer { ...@@ -320,18 +320,14 @@ public class Transfer {
writeByte(v.getByte()); writeByte(v.getByte());
break; break;
case Value.TIME: case Value.TIME:
if (version >= Constants.TCP_PROTOCOL_VERSION_9) { if (version >= Constants.TCP_PROTOCOL_VERSION_7) {
writeLong(DateTimeUtils.getTimeLocal(v.getTimeNoCopy()));
} else if (version >= Constants.TCP_PROTOCOL_VERSION_7) {
writeLong(DateTimeUtils.getTimeLocalWithoutDst(v.getTimeNoCopy())); writeLong(DateTimeUtils.getTimeLocalWithoutDst(v.getTimeNoCopy()));
} else { } else {
writeLong(v.getTimeNoCopy().getTime()); writeLong(v.getTimeNoCopy().getTime());
} }
break; break;
case Value.DATE: case Value.DATE:
if (version >= Constants.TCP_PROTOCOL_VERSION_9) { if (version >= Constants.TCP_PROTOCOL_VERSION_7) {
writeLong(DateTimeUtils.getTimeLocal(v.getDateNoCopy()));
} else if (version >= Constants.TCP_PROTOCOL_VERSION_7) {
writeLong(DateTimeUtils.getTimeLocalWithoutDst(v.getDateNoCopy())); writeLong(DateTimeUtils.getTimeLocalWithoutDst(v.getDateNoCopy()));
} else { } else {
writeLong(v.getDateNoCopy().getTime()); writeLong(v.getDateNoCopy().getTime());
...@@ -339,9 +335,7 @@ public class Transfer { ...@@ -339,9 +335,7 @@ public class Transfer {
break; break;
case Value.TIMESTAMP: { case Value.TIMESTAMP: {
Timestamp ts = v.getTimestampNoCopy(); Timestamp ts = v.getTimestampNoCopy();
if (version >= Constants.TCP_PROTOCOL_VERSION_9) { if (version >= Constants.TCP_PROTOCOL_VERSION_7) {
writeLong(DateTimeUtils.getTimeLocal(ts));
} else if (version >= Constants.TCP_PROTOCOL_VERSION_7) {
writeLong(DateTimeUtils.getTimeLocalWithoutDst(ts)); writeLong(DateTimeUtils.getTimeLocalWithoutDst(ts));
} else { } else {
writeLong(ts.getTime()); writeLong(ts.getTime());
...@@ -466,25 +460,17 @@ public class Transfer { ...@@ -466,25 +460,17 @@ 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) { if (version >= Constants.TCP_PROTOCOL_VERSION_7) {
return ValueDate.getNoCopy(new Date(DateTimeUtils.getTimeGMT(readLong())));
} else if (version >= Constants.TCP_PROTOCOL_VERSION_7) {
return ValueDate.getNoCopy(new Date(DateTimeUtils.getTimeGMTWithoutDst(readLong()))); return ValueDate.getNoCopy(new Date(DateTimeUtils.getTimeGMTWithoutDst(readLong())));
} }
return ValueDate.getNoCopy(new Date(readLong())); return ValueDate.getNoCopy(new Date(readLong()));
case Value.TIME: case Value.TIME:
if (version >= Constants.TCP_PROTOCOL_VERSION_9) { if (version >= Constants.TCP_PROTOCOL_VERSION_7) {
return ValueTime.getNoCopy(new Time(DateTimeUtils.getTimeGMT(readLong())));
} else if (version >= Constants.TCP_PROTOCOL_VERSION_7) {
return ValueTime.getNoCopy(new Time(DateTimeUtils.getTimeGMTWithoutDst(readLong()))); return ValueTime.getNoCopy(new Time(DateTimeUtils.getTimeGMTWithoutDst(readLong())));
} }
return ValueTime.getNoCopy(new Time(readLong())); return ValueTime.getNoCopy(new Time(readLong()));
case Value.TIMESTAMP: { case Value.TIMESTAMP: {
if (version >= Constants.TCP_PROTOCOL_VERSION_9) { if (version >= Constants.TCP_PROTOCOL_VERSION_7) {
Timestamp ts = new Timestamp(DateTimeUtils.getTimeGMT(readLong()));
ts.setNanos(readInt());
return ValueTimestamp.getNoCopy(ts);
} else if (version >= Constants.TCP_PROTOCOL_VERSION_7) {
Timestamp ts = new Timestamp(DateTimeUtils.getTimeGMTWithoutDst(readLong())); Timestamp ts = new Timestamp(DateTimeUtils.getTimeGMTWithoutDst(readLong()));
ts.setNanos(readInt()); ts.setNanos(readInt());
return ValueTimestamp.getNoCopy(ts); return ValueTimestamp.getNoCopy(ts);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论