Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
Shardingsphere
提交
667747a2
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,发现更多精彩内容 >>
未验证
提交
667747a2
编写于
5月 09, 2019
作者:
L
Liang Zhang
提交者:
GitHub
5月 09, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2357 from cherrylzhao/dev
for #2303 support COM_STMT_RESET for proxy
上级
0879686e
fa9a0b9c
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
211 addition
and
30 deletion
+211
-30
sharding-proxy/sharding-proxy-frontend/sharding-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/shardingproxy/frontend/mysql/command/MySQLCommandExecutorFactory.java
...y/frontend/mysql/command/MySQLCommandExecutorFactory.java
+4
-0
sharding-proxy/sharding-proxy-frontend/sharding-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/shardingproxy/frontend/mysql/command/query/binary/reset/MySQLComStmtResetExecutor.java
...command/query/binary/reset/MySQLComStmtResetExecutor.java
+44
-0
sharding-proxy/sharding-proxy-frontend/sharding-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/shardingproxy/frontend/mysql/command/query/binary/reset/MySQLComStmtResetExecutorTest.java
...and/query/binary/reset/MySQLComStmtResetExecutorTest.java
+47
-0
sharding-proxy/sharding-proxy-transport/sharding-proxy-transport-mysql/src/main/java/org/apache/shardingsphere/shardingproxy/transport/mysql/packet/command/MySQLCommandPacketFactory.java
...sport/mysql/packet/command/MySQLCommandPacketFactory.java
+3
-0
sharding-proxy/sharding-proxy-transport/sharding-proxy-transport-mysql/src/main/java/org/apache/shardingsphere/shardingproxy/transport/mysql/packet/command/MySQLCommandPacketType.java
...ransport/mysql/packet/command/MySQLCommandPacketType.java
+28
-28
sharding-proxy/sharding-proxy-transport/sharding-proxy-transport-mysql/src/main/java/org/apache/shardingsphere/shardingproxy/transport/mysql/packet/command/query/binary/close/MySQLComStmtClosePacket.java
...t/command/query/binary/close/MySQLComStmtClosePacket.java
+1
-1
sharding-proxy/sharding-proxy-transport/sharding-proxy-transport-mysql/src/main/java/org/apache/shardingsphere/shardingproxy/transport/mysql/packet/command/query/binary/reset/MySQLComStmtResetPacket.java
...t/command/query/binary/reset/MySQLComStmtResetPacket.java
+41
-0
sharding-proxy/sharding-proxy-transport/sharding-proxy-transport-mysql/src/test/java/org/apache/shardingsphere/shardingproxy/transport/mysql/packet/command/AllMySQLMySQLCommandPacketTests.java
...mysql/packet/command/AllMySQLMySQLCommandPacketTests.java
+2
-0
sharding-proxy/sharding-proxy-transport/sharding-proxy-transport-mysql/src/test/java/org/apache/shardingsphere/shardingproxy/transport/mysql/packet/command/MySQLMySQLCommandPacketFactoryTest.java
...ql/packet/command/MySQLMySQLCommandPacketFactoryTest.java
+2
-1
sharding-proxy/sharding-proxy-transport/sharding-proxy-transport-mysql/src/test/java/org/apache/shardingsphere/shardingproxy/transport/mysql/packet/command/query/binary/reset/MySQLComStmtResetPacketTest.java
...mmand/query/binary/reset/MySQLComStmtResetPacketTest.java
+39
-0
未找到文件。
sharding-proxy/sharding-proxy-frontend/sharding-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/shardingproxy/frontend/mysql/command/MySQLCommandExecutorFactory.java
浏览文件 @
667747a2
...
...
@@ -29,6 +29,7 @@ import org.apache.shardingsphere.shardingproxy.frontend.mysql.command.generic.My
import
org.apache.shardingsphere.shardingproxy.frontend.mysql.command.query.binary.close.MySQLComStmtCloseExecutor
;
import
org.apache.shardingsphere.shardingproxy.frontend.mysql.command.query.binary.execute.MySQLComStmtExecuteExecutor
;
import
org.apache.shardingsphere.shardingproxy.frontend.mysql.command.query.binary.prepare.MySQLComStmtPrepareExecutor
;
import
org.apache.shardingsphere.shardingproxy.frontend.mysql.command.query.binary.reset.MySQLComStmtResetExecutor
;
import
org.apache.shardingsphere.shardingproxy.frontend.mysql.command.query.text.fieldlist.MySQLComFieldListPacketExecutor
;
import
org.apache.shardingsphere.shardingproxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor
;
import
org.apache.shardingsphere.shardingproxy.transport.mysql.packet.command.MySQLCommandPacketType
;
...
...
@@ -36,6 +37,7 @@ import org.apache.shardingsphere.shardingproxy.transport.mysql.packet.command.ad
import
org.apache.shardingsphere.shardingproxy.transport.mysql.packet.command.query.binary.close.MySQLComStmtClosePacket
;
import
org.apache.shardingsphere.shardingproxy.transport.mysql.packet.command.query.binary.execute.MySQLComStmtExecutePacket
;
import
org.apache.shardingsphere.shardingproxy.transport.mysql.packet.command.query.binary.prepare.MySQLComStmtPreparePacket
;
import
org.apache.shardingsphere.shardingproxy.transport.mysql.packet.command.query.binary.reset.MySQLComStmtResetPacket
;
import
org.apache.shardingsphere.shardingproxy.transport.mysql.packet.command.query.text.fieldlist.MySQLComFieldListPacket
;
import
org.apache.shardingsphere.shardingproxy.transport.mysql.packet.command.query.text.query.MySQLComQueryPacket
;
import
org.apache.shardingsphere.shardingproxy.transport.packet.CommandPacket
;
...
...
@@ -72,6 +74,8 @@ public final class MySQLCommandExecutorFactory {
return
new
MySQLComStmtPrepareExecutor
((
MySQLComStmtPreparePacket
)
commandPacket
,
backendConnection
);
case
COM_STMT_EXECUTE:
return
new
MySQLComStmtExecuteExecutor
((
MySQLComStmtExecutePacket
)
commandPacket
,
backendConnection
);
case
COM_STMT_RESET:
return
new
MySQLComStmtResetExecutor
((
MySQLComStmtResetPacket
)
commandPacket
);
case
COM_STMT_CLOSE:
return
new
MySQLComStmtCloseExecutor
((
MySQLComStmtClosePacket
)
commandPacket
);
case
COM_PING:
...
...
sharding-proxy/sharding-proxy-frontend/sharding-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/shardingproxy/frontend/mysql/command/query/binary/reset/MySQLComStmtResetExecutor.java
0 → 100644
浏览文件 @
667747a2
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.apache.shardingsphere.shardingproxy.frontend.mysql.command.query.binary.reset
;
import
lombok.RequiredArgsConstructor
;
import
org.apache.shardingsphere.shardingproxy.frontend.api.CommandExecutor
;
import
org.apache.shardingsphere.shardingproxy.transport.mysql.packet.command.query.binary.reset.MySQLComStmtResetPacket
;
import
org.apache.shardingsphere.shardingproxy.transport.mysql.packet.generic.MySQLOKPacket
;
import
org.apache.shardingsphere.shardingproxy.transport.packet.DatabasePacket
;
import
java.util.Collection
;
import
java.util.Collections
;
/**
* COM_STMT_RESET command executor for MySQL.
*
* @author zhaojun
*/
@RequiredArgsConstructor
public
final
class
MySQLComStmtResetExecutor
implements
CommandExecutor
{
private
final
MySQLComStmtResetPacket
packet
;
@Override
public
Collection
<
DatabasePacket
>
execute
()
{
// TODO we should implement the stmt reset after supporting COM_STMT_SEND_LONG_DATA
return
Collections
.<
DatabasePacket
>
singletonList
(
new
MySQLOKPacket
(
1
));
}
}
sharding-proxy/sharding-proxy-frontend/sharding-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/shardingproxy/frontend/mysql/command/query/binary/reset/MySQLComStmtResetExecutorTest.java
0 → 100644
浏览文件 @
667747a2
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.apache.shardingsphere.shardingproxy.frontend.mysql.command.query.binary.reset
;
import
org.apache.shardingsphere.shardingproxy.transport.mysql.packet.command.query.binary.reset.MySQLComStmtResetPacket
;
import
org.apache.shardingsphere.shardingproxy.transport.mysql.packet.generic.MySQLOKPacket
;
import
org.apache.shardingsphere.shardingproxy.transport.packet.DatabasePacket
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.mockito.Mock
;
import
org.mockito.junit.MockitoJUnitRunner
;
import
java.util.Collection
;
import
static
org
.
hamcrest
.
CoreMatchers
.
instanceOf
;
import
static
org
.
hamcrest
.
CoreMatchers
.
is
;
import
static
org
.
junit
.
Assert
.
assertThat
;
@RunWith
(
MockitoJUnitRunner
.
class
)
public
class
MySQLComStmtResetExecutorTest
{
@Mock
private
MySQLComStmtResetPacket
packet
;
@Test
public
void
assertExecute
()
{
MySQLComStmtResetExecutor
mySQLComStmtResetExecutor
=
new
MySQLComStmtResetExecutor
(
packet
);
Collection
<
DatabasePacket
>
actual
=
mySQLComStmtResetExecutor
.
execute
();
assertThat
(
actual
.
size
(),
is
(
1
));
assertThat
(
actual
.
iterator
().
next
(),
instanceOf
(
MySQLOKPacket
.
class
));
}
}
sharding-proxy/sharding-proxy-transport/sharding-proxy-transport-mysql/src/main/java/org/apache/shardingsphere/shardingproxy/transport/mysql/packet/command/MySQLCommandPacketFactory.java
浏览文件 @
667747a2
...
...
@@ -26,6 +26,7 @@ import org.apache.shardingsphere.shardingproxy.transport.mysql.packet.command.ad
import
org.apache.shardingsphere.shardingproxy.transport.mysql.packet.command.query.binary.close.MySQLComStmtClosePacket
;
import
org.apache.shardingsphere.shardingproxy.transport.mysql.packet.command.query.binary.execute.MySQLComStmtExecutePacket
;
import
org.apache.shardingsphere.shardingproxy.transport.mysql.packet.command.query.binary.prepare.MySQLComStmtPreparePacket
;
import
org.apache.shardingsphere.shardingproxy.transport.mysql.packet.command.query.binary.reset.MySQLComStmtResetPacket
;
import
org.apache.shardingsphere.shardingproxy.transport.mysql.packet.command.query.text.fieldlist.MySQLComFieldListPacket
;
import
org.apache.shardingsphere.shardingproxy.transport.mysql.packet.command.query.text.query.MySQLComQueryPacket
;
import
org.apache.shardingsphere.shardingproxy.transport.mysql.payload.MySQLPacketPayload
;
...
...
@@ -64,6 +65,8 @@ public final class MySQLCommandPacketFactory {
return
new
MySQLComStmtPreparePacket
(
payload
);
case
COM_STMT_EXECUTE:
return
new
MySQLComStmtExecutePacket
(
payload
);
case
COM_STMT_RESET:
return
new
MySQLComStmtResetPacket
(
payload
);
case
COM_STMT_CLOSE:
return
new
MySQLComStmtClosePacket
(
payload
);
case
COM_PING:
...
...
sharding-proxy/sharding-proxy-transport/sharding-proxy-transport-mysql/src/main/java/org/apache/shardingsphere/shardingproxy/transport/mysql/packet/command/MySQLCommandPacketType.java
浏览文件 @
667747a2
...
...
@@ -33,21 +33,21 @@ public enum MySQLCommandPacketType implements CommandPacketType {
/**
* COM_SLEEP.
*
* @see <a href="https://dev.mysql.com/doc/internals/en/com-sleep.html
#packet-COM_SLEEP
">COM_SLEEP</a>
* @see <a href="https://dev.mysql.com/doc/internals/en/com-sleep.html">COM_SLEEP</a>
*/
COM_SLEEP
(
0x00
),
/**
* COM_QUIT.
*
* @see <a href="https://dev.mysql.com/doc/internals/en/com-
sleep.html#packet-COM_QUIT
">COM_QUIT</a>
* @see <a href="https://dev.mysql.com/doc/internals/en/com-
quit.html
">COM_QUIT</a>
*/
COM_QUIT
(
0x01
),
/**
* COM_INIT_DB.
*
* @see <a href="https://dev.mysql.com/doc/internals/en/com-
sleep.html#packet-COM_INIT_DB
">COM_INIT_DB</a>
* @see <a href="https://dev.mysql.com/doc/internals/en/com-
init-db.html
">COM_INIT_DB</a>
*/
COM_INIT_DB
(
0x02
),
...
...
@@ -75,77 +75,77 @@ public enum MySQLCommandPacketType implements CommandPacketType {
/**
* COM_DROP_DB.
*
* @see <a href="https://dev.mysql.com/doc/internals/en/com-
sleep.html#packet-COM_DROP_DB
">COM_DROP_DB</a>
* @see <a href="https://dev.mysql.com/doc/internals/en/com-
create-db.html
">COM_DROP_DB</a>
*/
COM_DROP_DB
(
0x06
),
/**
* COM_REFRESH.
*
* @see <a href="https://dev.mysql.com/doc/internals/en/com-
sleep.html#packet-COM_REFRESH
">COM_REFRESH</a>
* @see <a href="https://dev.mysql.com/doc/internals/en/com-
refresh.html
">COM_REFRESH</a>
*/
COM_REFRESH
(
0x07
),
/**
* COM_SHUTDOWN.
*
* @see <a href="https://dev.mysql.com/doc/internals/en/com-s
leep.html#packet-COM_SHUTDOWN
">COM_SHUTDOWN</a>
* @see <a href="https://dev.mysql.com/doc/internals/en/com-s
hutdown.html
">COM_SHUTDOWN</a>
*/
COM_SHUTDOWN
(
0x08
),
/**
* COM_STATISTICS.
*
* @see <a href="https://dev.mysql.com/doc/internals/en/com-s
leep
.html#packet-COM_STATISTICS">COM_STATISTICS</a>
* @see <a href="https://dev.mysql.com/doc/internals/en/com-s
tatistics
.html#packet-COM_STATISTICS">COM_STATISTICS</a>
*/
COM_STATISTICS
(
0x09
),
/**
* COM_PROCESS_INFO.
*
* @see <a href="https://dev.mysql.com/doc/internals/en/com-
sleep.html#packet-COM_PROCESS_INFO
">COM_PROCESS_INFO</a>
* @see <a href="https://dev.mysql.com/doc/internals/en/com-
process-info.html
">COM_PROCESS_INFO</a>
*/
COM_PROCESS_INFO
(
0x0a
),
/**
* COM_CONNECT.
*
* @see <a href="https://dev.mysql.com/doc/internals/en/com-
sleep.html#packet-COM_CONNECT
">COM_CONNECT</a>
* @see <a href="https://dev.mysql.com/doc/internals/en/com-
connect.html
">COM_CONNECT</a>
*/
COM_CONNECT
(
0x0b
),
/**
* COM_PROCESS_KILL.
*
* @see <a href="https://dev.mysql.com/doc/internals/en/com-
sleep.html#packet-COM_PROCESS_KILL
">COM_PROCESS_KILL</a>
* @see <a href="https://dev.mysql.com/doc/internals/en/com-
process-kill.html
">COM_PROCESS_KILL</a>
*/
COM_PROCESS_KILL
(
0x0c
),
/**
* COM_DEBUG.
*
* @see <a href="https://dev.mysql.com/doc/internals/en/com-
sleep.html#packet-COM_DEBUG
">COM_DEBUG</a>
* @see <a href="https://dev.mysql.com/doc/internals/en/com-
debug.html
">COM_DEBUG</a>
*/
COM_DEBUG
(
0x0d
),
/**
* COM_PING.
*
* @see <a href="https://dev.mysql.com/doc/internals/en/com-
sleep.html#packet-COM_PING
">COM_PING</a>
* @see <a href="https://dev.mysql.com/doc/internals/en/com-
ping.html
">COM_PING</a>
*/
COM_PING
(
0x0e
),
/**
* COM_TIME.
*
* @see <a href="https://dev.mysql.com/doc/internals/en/com-
sleep.html#packet-COM_TIME
">COM_TIME</a>
* @see <a href="https://dev.mysql.com/doc/internals/en/com-
time.html
">COM_TIME</a>
*/
COM_TIME
(
0x0f
),
/**
* COM_DELAYED_INSERT.
*
* @see <a href="https://dev.mysql.com/doc/internals/en/com-
sleep.html#packet-COM_DELAYED_INSERT
">COM_DELAYED_INSERT</a>
* @see <a href="https://dev.mysql.com/doc/internals/en/com-
time.html
">COM_DELAYED_INSERT</a>
*/
COM_DELAYED_INSERT
(
0x10
),
...
...
@@ -159,98 +159,98 @@ public enum MySQLCommandPacketType implements CommandPacketType {
/**
* COM_BINLOG_DUMP.
*
* @see <a href="https://dev.mysql.com/doc/internals/en/com-
sleep.html#packet-COM_BINLOG_DUMP
">COM_BINLOG_DUMP</a>
* @see <a href="https://dev.mysql.com/doc/internals/en/com-
change-user.html
">COM_BINLOG_DUMP</a>
*/
COM_BINLOG_DUMP
(
0x12
),
/**
* COM_TABLE_DUMP.
*
* @see <a href="https://dev.mysql.com/doc/internals/en/com-
sleep.html#packet-COM_TABLE_DUMP
">COM_TABLE_DUMP</a>
* @see <a href="https://dev.mysql.com/doc/internals/en/com-
table-dump.html
">COM_TABLE_DUMP</a>
*/
COM_TABLE_DUMP
(
0x13
),
/**
* COM_CONNECT_OUT.
*
* @see <a href="https://dev.mysql.com/doc/internals/en/com-
sleep.html#packet-COM_CONNECT_OUT
">COM_CONNECT_OUT</a>
* @see <a href="https://dev.mysql.com/doc/internals/en/com-
connect-out.html
">COM_CONNECT_OUT</a>
*/
COM_CONNECT_OUT
(
0x14
),
/**
* COM_REGISTER_SLAVE.
*
* @see <a href="https://dev.mysql.com/doc/internals/en/com-
sleep.html#packet-COM_REGISTER_SLAVE
">COM_REGISTER_SLAVE</a>
* @see <a href="https://dev.mysql.com/doc/internals/en/com-
register-slave.html
">COM_REGISTER_SLAVE</a>
*/
COM_REGISTER_SLAVE
(
0x15
),
/**
* COM_STMT_PREPARE.
*
* @see <a href="https://dev.mysql.com/doc/internals/en/com-s
leep.html#packet-COM_STMT_PREPARE
">COM_STMT_PREPARE</a>
* @see <a href="https://dev.mysql.com/doc/internals/en/com-s
tmt-prepare.html
">COM_STMT_PREPARE</a>
*/
COM_STMT_PREPARE
(
0x16
),
/**
* COM_STMT_EXECUTE.
*
* @see <a href="https://dev.mysql.com/doc/internals/en/com-s
leep.html#packet-COM_STMT_EXECUTE
">COM_STMT_EXECUTE</a>
* @see <a href="https://dev.mysql.com/doc/internals/en/com-s
tmt-execute.html
">COM_STMT_EXECUTE</a>
*/
COM_STMT_EXECUTE
(
0x17
),
/**
* COM_STMT_SEND_LONG_DATA.
*
* @see <a href="https://dev.mysql.com/doc/internals/en/com-s
leep.html#packet-COM_STMT_SEND_LONG_DATA
">COM_STMT_SEND_LONG_DATA</a>
* @see <a href="https://dev.mysql.com/doc/internals/en/com-s
tmt-send-long-data.html
">COM_STMT_SEND_LONG_DATA</a>
*/
COM_STMT_SEND_LONG_DATA
(
0x18
),
/**
* COM_STMT_CLOSE.
*
* @see <a href="https://dev.mysql.com/doc/internals/en/com-s
leep.html#packet-COM_STMT_CLOSE
">COM_STMT_CLOSE</a>
* @see <a href="https://dev.mysql.com/doc/internals/en/com-s
tmt-close.html
">COM_STMT_CLOSE</a>
*/
COM_STMT_CLOSE
(
0x19
),
/**
* COM_STMT_RESET.
*
* @see <a href="https://dev.mysql.com/doc/internals/en/com-s
leep.html#packet-COM_STMT_RESET
">COM_STMT_RESET</a>
* @see <a href="https://dev.mysql.com/doc/internals/en/com-s
tmt-reset.html
">COM_STMT_RESET</a>
*/
COM_STMT_RESET
(
0x1a
),
/**
* COM_SET_OPTION.
*
* @see <a href="https://dev.mysql.com/doc/internals/en/com-s
leep.html#packet-COM_SET_OPTION
">COM_SET_OPTION</a>
* @see <a href="https://dev.mysql.com/doc/internals/en/com-s
et-option.html
">COM_SET_OPTION</a>
*/
COM_SET_OPTION
(
0x1b
),
/**
* COM_STMT_FETCH.
*
* @see <a href="https://dev.mysql.com/doc/internals/en/com-s
leep.html#packet-COM_STMT_FETCH
">COM_STMT_FETCH</a>
* @see <a href="https://dev.mysql.com/doc/internals/en/com-s
tmt-fetch.html
">COM_STMT_FETCH</a>
*/
COM_STMT_FETCH
(
0x1c
),
/**
* COM_DAEMON.
*
* @see <a href="https://dev.mysql.com/doc/internals/en/com-
sleep.html#packet-COM_DAEMON
">COM_DAEMON</a>
* @see <a href="https://dev.mysql.com/doc/internals/en/com-
daemon.html
">COM_DAEMON</a>
*/
COM_DAEMON
(
0x1d
),
/**
* COM_BINLOG_DUMP_GTID.
*
* @see <a href="https://dev.mysql.com/doc/internals/en/com-
sleep.html#packet-COM_BINLOG_DUMP_GTID
">COM_BINLOG_DUMP_GTID</a>
* @see <a href="https://dev.mysql.com/doc/internals/en/com-
binlog-dump-gtid.html
">COM_BINLOG_DUMP_GTID</a>
*/
COM_BINLOG_DUMP_GTID
(
0x1e
),
/**
* COM_RESET_CONNECTION.
*
* @see <a href="https://dev.mysql.com/doc/internals/en/com-
sleep.html#packet-COM_RESET_CONNECTION
">COM_RESET_CONNECTION</a>
* @see <a href="https://dev.mysql.com/doc/internals/en/com-
reset-connection.html
">COM_RESET_CONNECTION</a>
*/
COM_RESET_CONNECTION
(
0x1f
);
...
...
sharding-proxy/sharding-proxy-transport/sharding-proxy-transport-mysql/src/main/java/org/apache/shardingsphere/shardingproxy/transport/mysql/packet/command/query/binary/close/MySQLComStmtClosePacket.java
浏览文件 @
667747a2
...
...
@@ -27,7 +27,7 @@ import org.apache.shardingsphere.shardingproxy.transport.mysql.payload.MySQLPack
/**
* COM_STMT_CLOSE command packet for MySQL.
*
* @see <a href="https://dev.mysql.com/doc/internals/en/com-stmt-close.html">COM_
QUERY
</a>
* @see <a href="https://dev.mysql.com/doc/internals/en/com-stmt-close.html">COM_
STMT_CLOSE
</a>
*
* @author zhangyonglun
*/
...
...
sharding-proxy/sharding-proxy-transport/sharding-proxy-transport-mysql/src/main/java/org/apache/shardingsphere/shardingproxy/transport/mysql/packet/command/query/binary/reset/MySQLComStmtResetPacket.java
0 → 100644
浏览文件 @
667747a2
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.apache.shardingsphere.shardingproxy.transport.mysql.packet.command.query.binary.reset
;
import
lombok.Getter
;
import
org.apache.shardingsphere.shardingproxy.transport.mysql.packet.command.MySQLCommandPacket
;
import
org.apache.shardingsphere.shardingproxy.transport.mysql.packet.command.MySQLCommandPacketType
;
import
org.apache.shardingsphere.shardingproxy.transport.mysql.payload.MySQLPacketPayload
;
/**
* COM_STMT_RESET command packet for MySQL.
*
* @see <a href="https://dev.mysql.com/doc/internals/en/com-stmt-reset.html">COM_STMT_RESET</a>
*
* @author zhaojun
*/
@Getter
public
class
MySQLComStmtResetPacket
extends
MySQLCommandPacket
{
private
final
int
statementId
;
public
MySQLComStmtResetPacket
(
final
MySQLPacketPayload
payload
)
{
super
(
MySQLCommandPacketType
.
COM_STMT_RESET
);
statementId
=
payload
.
readInt4
();
}
}
sharding-proxy/sharding-proxy-transport/sharding-proxy-transport-mysql/src/test/java/org/apache/shardingsphere/shardingproxy/transport/mysql/packet/command/AllMySQLMySQLCommandPacketTests.java
浏览文件 @
667747a2
...
...
@@ -31,6 +31,7 @@ import org.apache.shardingsphere.shardingproxy.transport.mysql.packet.command.qu
import
org.apache.shardingsphere.shardingproxy.transport.mysql.packet.command.query.binary.execute.protocol.AllMySQLBinaryProtocolTests
;
import
org.apache.shardingsphere.shardingproxy.transport.mysql.packet.command.query.binary.prepare.MySQLComStmtPrepareMySQLOKPacketTest
;
import
org.apache.shardingsphere.shardingproxy.transport.mysql.packet.command.query.binary.prepare.MySQLComStmtPreparePacketTest
;
import
org.apache.shardingsphere.shardingproxy.transport.mysql.packet.command.query.binary.reset.MySQLComStmtResetPacketTest
;
import
org.apache.shardingsphere.shardingproxy.transport.mysql.packet.command.query.text.MySQLTextResultSetRowPacketTest
;
import
org.apache.shardingsphere.shardingproxy.transport.mysql.packet.command.query.text.fieldlist.MySQLComFieldListPacketTest
;
import
org.apache.shardingsphere.shardingproxy.transport.mysql.packet.command.query.text.query.MySQLComQueryPacketTest
;
...
...
@@ -53,6 +54,7 @@ import org.junit.runners.Suite.SuiteClasses;
MySQLComQueryPacketTest
.
class
,
MySQLComStmtPreparePacketTest
.
class
,
MySQLComStmtPrepareMySQLOKPacketTest
.
class
,
MySQLComStmtResetPacketTest
.
class
,
MySQLBinaryResultSetRowPacketTest
.
class
,
MySQLComStmtExecutePacketTest
.
class
,
MySQLComStmtClosePacketTest
.
class
,
...
...
sharding-proxy/sharding-proxy-transport/sharding-proxy-transport-mysql/src/test/java/org/apache/shardingsphere/shardingproxy/transport/mysql/packet/command/MySQLMySQLCommandPacketFactoryTest.java
浏览文件 @
667747a2
...
...
@@ -26,6 +26,7 @@ import org.apache.shardingsphere.shardingproxy.transport.mysql.packet.command.qu
import
org.apache.shardingsphere.shardingproxy.transport.mysql.packet.command.query.binary.close.MySQLComStmtClosePacket
;
import
org.apache.shardingsphere.shardingproxy.transport.mysql.packet.command.query.binary.execute.MySQLComStmtExecutePacket
;
import
org.apache.shardingsphere.shardingproxy.transport.mysql.packet.command.query.binary.prepare.MySQLComStmtPreparePacket
;
import
org.apache.shardingsphere.shardingproxy.transport.mysql.packet.command.query.binary.reset.MySQLComStmtResetPacket
;
import
org.apache.shardingsphere.shardingproxy.transport.mysql.packet.command.query.text.fieldlist.MySQLComFieldListPacket
;
import
org.apache.shardingsphere.shardingproxy.transport.mysql.packet.command.query.text.query.MySQLComQueryPacket
;
import
org.apache.shardingsphere.shardingproxy.transport.mysql.payload.MySQLPacketPayload
;
...
...
@@ -182,7 +183,7 @@ public final class MySQLMySQLCommandPacketFactoryTest {
@Test
public
void
assertNewInstanceWithComStmtResetPacket
()
throws
SQLException
{
assertThat
(
MySQLCommandPacketFactory
.
newInstance
(
MySQLCommandPacketType
.
COM_STMT_RESET
,
payload
),
instanceOf
(
MySQL
UnsupportedCommand
Packet
.
class
));
assertThat
(
MySQLCommandPacketFactory
.
newInstance
(
MySQLCommandPacketType
.
COM_STMT_RESET
,
payload
),
instanceOf
(
MySQL
ComStmtReset
Packet
.
class
));
}
@Test
...
...
sharding-proxy/sharding-proxy-transport/sharding-proxy-transport-mysql/src/test/java/org/apache/shardingsphere/shardingproxy/transport/mysql/packet/command/query/binary/reset/MySQLComStmtResetPacketTest.java
0 → 100644
浏览文件 @
667747a2
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.apache.shardingsphere.shardingproxy.transport.mysql.packet.command.query.binary.reset
;
import
org.apache.shardingsphere.shardingproxy.transport.mysql.payload.MySQLPacketPayload
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.mockito.Mock
;
import
org.mockito.junit.MockitoJUnitRunner
;
import
static
org
.
mockito
.
Mockito
.
verify
;
@RunWith
(
MockitoJUnitRunner
.
class
)
public
class
MySQLComStmtResetPacketTest
{
@Mock
private
MySQLPacketPayload
payload
;
@Test
public
void
assertGetStatementId
()
{
new
MySQLComStmtResetPacket
(
payload
);
verify
(
payload
).
readInt4
();
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录