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

The new date conversion is actually also problematic.

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