Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
e93d2685
提交
e93d2685
authored
12月 20, 2018
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Send row value as ARRAY and INTERVAL as VARCHAR to old clients
上级
76e61e71
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
45 行增加
和
12 行删除
+45
-12
Transfer.java
h2/src/main/org/h2/value/Transfer.java
+45
-12
没有找到文件。
h2/src/main/org/h2/value/Transfer.java
浏览文件 @
e93d2685
...
@@ -322,27 +322,32 @@ public class Transfer {
...
@@ -322,27 +322,32 @@ public class Transfer {
*/
*/
public
void
writeValue
(
Value
v
)
throws
IOException
{
public
void
writeValue
(
Value
v
)
throws
IOException
{
int
type
=
v
.
getType
();
int
type
=
v
.
getType
();
writeInt
(
type
);
switch
(
type
)
{
switch
(
type
)
{
case
Value
.
NULL
:
case
Value
.
NULL
:
writeInt
(
Value
.
NULL
);
break
;
break
;
case
Value
.
BYTES
:
case
Value
.
BYTES
:
case
Value
.
JAVA_OBJECT
:
case
Value
.
JAVA_OBJECT
:
writeInt
(
type
);
writeBytes
(
v
.
getBytesNoCopy
());
writeBytes
(
v
.
getBytesNoCopy
());
break
;
break
;
case
Value
.
UUID
:
{
case
Value
.
UUID
:
{
writeInt
(
Value
.
UUID
);
ValueUuid
uuid
=
(
ValueUuid
)
v
;
ValueUuid
uuid
=
(
ValueUuid
)
v
;
writeLong
(
uuid
.
getHigh
());
writeLong
(
uuid
.
getHigh
());
writeLong
(
uuid
.
getLow
());
writeLong
(
uuid
.
getLow
());
break
;
break
;
}
}
case
Value
.
BOOLEAN
:
case
Value
.
BOOLEAN
:
writeInt
(
Value
.
BOOLEAN
);
writeBoolean
(
v
.
getBoolean
());
writeBoolean
(
v
.
getBoolean
());
break
;
break
;
case
Value
.
BYTE
:
case
Value
.
BYTE
:
writeInt
(
Value
.
BYTE
);
writeByte
(
v
.
getByte
());
writeByte
(
v
.
getByte
());
break
;
break
;
case
Value
.
TIME
:
case
Value
.
TIME
:
writeInt
(
Value
.
TIME
);
if
(
version
>=
Constants
.
TCP_PROTOCOL_VERSION_9
)
{
if
(
version
>=
Constants
.
TCP_PROTOCOL_VERSION_9
)
{
writeLong
(((
ValueTime
)
v
).
getNanos
());
writeLong
(((
ValueTime
)
v
).
getNanos
());
}
else
{
}
else
{
...
@@ -350,6 +355,7 @@ public class Transfer {
...
@@ -350,6 +355,7 @@ public class Transfer {
}
}
break
;
break
;
case
Value
.
DATE
:
case
Value
.
DATE
:
writeInt
(
Value
.
DATE
);
if
(
version
>=
Constants
.
TCP_PROTOCOL_VERSION_9
)
{
if
(
version
>=
Constants
.
TCP_PROTOCOL_VERSION_9
)
{
writeLong
(((
ValueDate
)
v
).
getDateValue
());
writeLong
(((
ValueDate
)
v
).
getDateValue
());
}
else
{
}
else
{
...
@@ -357,6 +363,7 @@ public class Transfer {
...
@@ -357,6 +363,7 @@ public class Transfer {
}
}
break
;
break
;
case
Value
.
TIMESTAMP
:
{
case
Value
.
TIMESTAMP
:
{
writeInt
(
Value
.
TIMESTAMP
);
if
(
version
>=
Constants
.
TCP_PROTOCOL_VERSION_9
)
{
if
(
version
>=
Constants
.
TCP_PROTOCOL_VERSION_9
)
{
ValueTimestamp
ts
=
(
ValueTimestamp
)
v
;
ValueTimestamp
ts
=
(
ValueTimestamp
)
v
;
writeLong
(
ts
.
getDateValue
());
writeLong
(
ts
.
getDateValue
());
...
@@ -369,6 +376,7 @@ public class Transfer {
...
@@ -369,6 +376,7 @@ public class Transfer {
break
;
break
;
}
}
case
Value
.
TIMESTAMP_TZ
:
{
case
Value
.
TIMESTAMP_TZ
:
{
writeInt
(
Value
.
TIMESTAMP_TZ
);
ValueTimestampTimeZone
ts
=
(
ValueTimestampTimeZone
)
v
;
ValueTimestampTimeZone
ts
=
(
ValueTimestampTimeZone
)
v
;
writeLong
(
ts
.
getDateValue
());
writeLong
(
ts
.
getDateValue
());
writeLong
(
ts
.
getTimeNanos
());
writeLong
(
ts
.
getTimeNanos
());
...
@@ -376,29 +384,37 @@ public class Transfer {
...
@@ -376,29 +384,37 @@ public class Transfer {
break
;
break
;
}
}
case
Value
.
DECIMAL
:
case
Value
.
DECIMAL
:
writeInt
(
Value
.
DECIMAL
);
writeString
(
v
.
getString
());
writeString
(
v
.
getString
());
break
;
break
;
case
Value
.
DOUBLE
:
case
Value
.
DOUBLE
:
writeInt
(
Value
.
DOUBLE
);
writeDouble
(
v
.
getDouble
());
writeDouble
(
v
.
getDouble
());
break
;
break
;
case
Value
.
FLOAT
:
case
Value
.
FLOAT
:
writeInt
(
Value
.
FLOAT
);
writeFloat
(
v
.
getFloat
());
writeFloat
(
v
.
getFloat
());
break
;
break
;
case
Value
.
INT
:
case
Value
.
INT
:
writeInt
(
Value
.
INT
);
writeInt
(
v
.
getInt
());
writeInt
(
v
.
getInt
());
break
;
break
;
case
Value
.
LONG
:
case
Value
.
LONG
:
writeInt
(
Value
.
LONG
);
writeLong
(
v
.
getLong
());
writeLong
(
v
.
getLong
());
break
;
break
;
case
Value
.
SHORT
:
case
Value
.
SHORT
:
writeInt
(
Value
.
SHORT
);
writeInt
(
v
.
getShort
());
writeInt
(
v
.
getShort
());
break
;
break
;
case
Value
.
STRING
:
case
Value
.
STRING
:
case
Value
.
STRING_IGNORECASE
:
case
Value
.
STRING_IGNORECASE
:
case
Value
.
STRING_FIXED
:
case
Value
.
STRING_FIXED
:
writeInt
(
type
);
writeString
(
v
.
getString
());
writeString
(
v
.
getString
());
break
;
break
;
case
Value
.
BLOB
:
{
case
Value
.
BLOB
:
{
writeInt
(
Value
.
BLOB
);
if
(
version
>=
Constants
.
TCP_PROTOCOL_VERSION_11
)
{
if
(
version
>=
Constants
.
TCP_PROTOCOL_VERSION_11
)
{
if
(
v
instanceof
ValueLobDb
)
{
if
(
v
instanceof
ValueLobDb
)
{
ValueLobDb
lob
=
(
ValueLobDb
)
v
;
ValueLobDb
lob
=
(
ValueLobDb
)
v
;
...
@@ -429,6 +445,7 @@ public class Transfer {
...
@@ -429,6 +445,7 @@ public class Transfer {
break
;
break
;
}
}
case
Value
.
CLOB
:
{
case
Value
.
CLOB
:
{
writeInt
(
Value
.
CLOB
);
if
(
version
>=
Constants
.
TCP_PROTOCOL_VERSION_11
)
{
if
(
version
>=
Constants
.
TCP_PROTOCOL_VERSION_11
)
{
if
(
v
instanceof
ValueLobDb
)
{
if
(
v
instanceof
ValueLobDb
)
{
ValueLobDb
lob
=
(
ValueLobDb
)
v
;
ValueLobDb
lob
=
(
ValueLobDb
)
v
;
...
@@ -456,6 +473,7 @@ public class Transfer {
...
@@ -456,6 +473,7 @@ public class Transfer {
break
;
break
;
}
}
case
Value
.
ARRAY
:
{
case
Value
.
ARRAY
:
{
writeInt
(
Value
.
ARRAY
);
ValueArray
va
=
(
ValueArray
)
v
;
ValueArray
va
=
(
ValueArray
)
v
;
Value
[]
list
=
va
.
getList
();
Value
[]
list
=
va
.
getList
();
int
len
=
list
.
length
;
int
len
=
list
.
length
;
...
@@ -472,6 +490,7 @@ public class Transfer {
...
@@ -472,6 +490,7 @@ public class Transfer {
break
;
break
;
}
}
case
Value
.
ROW
:
{
case
Value
.
ROW
:
{
writeInt
(
version
>=
Constants
.
TCP_PROTOCOL_VERSION_18
?
Value
.
ROW
:
Value
.
ARRAY
);
ValueRow
va
=
(
ValueRow
)
v
;
ValueRow
va
=
(
ValueRow
)
v
;
Value
[]
list
=
va
.
getList
();
Value
[]
list
=
va
.
getList
();
int
len
=
list
.
length
;
int
len
=
list
.
length
;
...
@@ -482,11 +501,13 @@ public class Transfer {
...
@@ -482,11 +501,13 @@ public class Transfer {
break
;
break
;
}
}
case
Value
.
ENUM
:
{
case
Value
.
ENUM
:
{
writeInt
(
Value
.
ENUM
);
writeInt
(
v
.
getInt
());
writeInt
(
v
.
getInt
());
writeString
(
v
.
getString
());
writeString
(
v
.
getString
());
break
;
break
;
}
}
case
Value
.
RESULT_SET
:
{
case
Value
.
RESULT_SET
:
{
writeInt
(
Value
.
RESULT_SET
);
ResultInterface
result
=
((
ValueResultSet
)
v
).
getResult
();
ResultInterface
result
=
((
ValueResultSet
)
v
).
getResult
();
int
columnCount
=
result
.
getVisibleColumnCount
();
int
columnCount
=
result
.
getVisibleColumnCount
();
writeInt
(
columnCount
);
writeInt
(
columnCount
);
...
@@ -516,6 +537,7 @@ public class Transfer {
...
@@ -516,6 +537,7 @@ public class Transfer {
break
;
break
;
}
}
case
Value
.
GEOMETRY
:
case
Value
.
GEOMETRY
:
writeInt
(
Value
.
GEOMETRY
);
if
(
version
>=
Constants
.
TCP_PROTOCOL_VERSION_14
)
{
if
(
version
>=
Constants
.
TCP_PROTOCOL_VERSION_14
)
{
writeBytes
(
v
.
getBytesNoCopy
());
writeBytes
(
v
.
getBytesNoCopy
());
}
else
{
}
else
{
...
@@ -526,12 +548,17 @@ public class Transfer {
...
@@ -526,12 +548,17 @@ public class Transfer {
case
Value
.
INTERVAL_MONTH
:
case
Value
.
INTERVAL_MONTH
:
case
Value
.
INTERVAL_DAY
:
case
Value
.
INTERVAL_DAY
:
case
Value
.
INTERVAL_HOUR
:
case
Value
.
INTERVAL_HOUR
:
case
Value
.
INTERVAL_MINUTE
:
{
case
Value
.
INTERVAL_MINUTE
:
if
(
version
>=
Constants
.
TCP_PROTOCOL_VERSION_18
)
{
writeInt
(
type
);
ValueInterval
interval
=
(
ValueInterval
)
v
;
ValueInterval
interval
=
(
ValueInterval
)
v
;
writeBoolean
(
interval
.
isNegative
());
writeBoolean
(
interval
.
isNegative
());
writeLong
(
interval
.
getLeading
());
writeLong
(
interval
.
getLeading
());
break
;
}
else
{
writeInt
(
Value
.
STRING
);
writeString
(
v
.
getString
());
}
}
break
;
case
Value
.
INTERVAL_SECOND
:
case
Value
.
INTERVAL_SECOND
:
case
Value
.
INTERVAL_YEAR_TO_MONTH
:
case
Value
.
INTERVAL_YEAR_TO_MONTH
:
case
Value
.
INTERVAL_DAY_TO_HOUR
:
case
Value
.
INTERVAL_DAY_TO_HOUR
:
...
@@ -539,15 +566,21 @@ public class Transfer {
...
@@ -539,15 +566,21 @@ public class Transfer {
case
Value
.
INTERVAL_DAY_TO_SECOND
:
case
Value
.
INTERVAL_DAY_TO_SECOND
:
case
Value
.
INTERVAL_HOUR_TO_MINUTE
:
case
Value
.
INTERVAL_HOUR_TO_MINUTE
:
case
Value
.
INTERVAL_HOUR_TO_SECOND
:
case
Value
.
INTERVAL_HOUR_TO_SECOND
:
case
Value
.
INTERVAL_MINUTE_TO_SECOND
:
{
case
Value
.
INTERVAL_MINUTE_TO_SECOND
:
if
(
version
>=
Constants
.
TCP_PROTOCOL_VERSION_18
)
{
writeInt
(
type
);
ValueInterval
interval
=
(
ValueInterval
)
v
;
ValueInterval
interval
=
(
ValueInterval
)
v
;
writeBoolean
(
interval
.
isNegative
());
writeBoolean
(
interval
.
isNegative
());
writeLong
(
interval
.
getLeading
());
writeLong
(
interval
.
getLeading
());
writeLong
(
interval
.
getRemaining
());
writeLong
(
interval
.
getRemaining
());
break
;
}
else
{
writeInt
(
Value
.
STRING
);
writeString
(
v
.
getString
());
}
}
break
;
default
:
default
:
if
(
JdbcUtils
.
customDataTypesHandler
!=
null
)
{
if
(
JdbcUtils
.
customDataTypesHandler
!=
null
)
{
writeInt
(
type
);
writeBytes
(
v
.
getBytesNoCopy
());
writeBytes
(
v
.
getBytesNoCopy
());
break
;
break
;
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论