Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
Shardingsphere
提交
685933da
Shardingsphere
项目概览
apache
/
Shardingsphere
通知
56
Star
3
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Shardingsphere
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
685933da
编写于
8月 29, 2018
作者:
ShardingSphere
提交者:
GitHub
8月 29, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1200 from tuohai666/dev
#1199, Lost the BinaryResultSetRowPacket when there's null value
上级
1f7dafcd
80b476ac
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
14 addition
and
7 deletion
+14
-7
sharding-proxy/src/main/java/io/shardingsphere/proxy/transport/mysql/packet/command/query/binary/execute/BinaryProtocolValue.java
...ket/command/query/binary/execute/BinaryProtocolValue.java
+12
-5
sharding-proxy/src/test/java/io/shardingsphere/proxy/transport/mysql/packet/command/query/binary/execute/BinaryResultSetRowPacketTest.java
...nd/query/binary/execute/BinaryResultSetRowPacketTest.java
+2
-2
未找到文件。
sharding-proxy/src/main/java/io/shardingsphere/proxy/transport/mysql/packet/command/query/binary/execute/BinaryProtocolValue.java
浏览文件 @
685933da
...
...
@@ -91,6 +91,9 @@ public final class BinaryProtocolValue {
* @param binaryData binary data to be written
*/
public
void
write
(
final
Object
binaryData
)
{
if
(
null
==
binaryData
)
{
return
;
}
switch
(
columnType
)
{
case
MYSQL_TYPE_STRING:
case
MYSQL_TYPE_VARCHAR:
...
...
@@ -108,11 +111,7 @@ public final class BinaryProtocolValue {
payload
.
writeStringLenenc
(
binaryData
.
toString
());
break
;
case
MYSQL_TYPE_LONGLONG:
if
(
binaryData
instanceof
BigDecimal
)
{
payload
.
writeInt8
(((
BigDecimal
)
binaryData
).
longValue
());
}
else
{
payload
.
writeInt8
((
Long
)
binaryData
);
}
writeInt8
(
binaryData
);
break
;
case
MYSQL_TYPE_LONG:
case
MYSQL_TYPE_INT24:
...
...
@@ -143,4 +142,12 @@ public final class BinaryProtocolValue {
throw
new
IllegalArgumentException
(
String
.
format
(
"Cannot find MySQL type '%s' in column type when write binary protocol value"
,
columnType
));
}
}
private
void
writeInt8
(
final
Object
binaryData
)
{
if
(
binaryData
instanceof
BigDecimal
)
{
payload
.
writeInt8
(((
BigDecimal
)
binaryData
).
longValue
());
}
else
{
payload
.
writeInt8
((
Long
)
binaryData
);
}
}
}
sharding-proxy/src/test/java/io/shardingsphere/proxy/transport/mysql/packet/command/query/binary/execute/BinaryResultSetRowPacketTest.java
浏览文件 @
685933da
...
...
@@ -39,13 +39,13 @@ public final class BinaryResultSetRowPacketTest {
private
MySQLPacketPayload
payload
;
@Test
@Ignore
public
void
assertWrite
()
{
BinaryResultSetRowPacket
actual
=
new
BinaryResultSetRowPacket
(
1
,
2
,
Arrays
.<
Object
>
asList
(
"value"
,
null
),
Arrays
.
asList
(
ColumnType
.
MYSQL_TYPE_STRING
,
ColumnType
.
MYSQL_TYPE_STRING
));
assertThat
(
actual
.
getSequenceId
(),
is
(
1
));
assertThat
(
actual
.
getData
(),
is
(
Arrays
.<
Object
>
asList
(
"value"
,
null
)));
actual
.
write
(
payload
);
verify
(
payload
,
times
(
2
)).
writeInt1
(
0x00
);
verify
(
payload
).
writeInt1
(
0x00
);
verify
(
payload
).
writeInt1
(
0x08
);
verify
(
payload
).
writeStringLenenc
(
"value"
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录