Repository: apache/shardingsphere
Issue: No result from SQL "SELECT COUNT(*) FROM t_order" in prepared statement

For English only, other languages we will close it directly.

Please answer these questions before submitting your issue. Thanks!

### Which version of Sharding-Sphere do you using?
3.0.0.M3-SNAPSHOT

### Which project do you using? Sharding-JDBC or Sharding-Proxy?
Sharding-Proxy

### Expected behavior
Return the row count of table `t_order`.

### Actual behavior
No return result.

### Reason analyze
Lost "Packet Number: 4".

Packets in wireshark:

Frame 2568: 94 bytes on wire (752 bits), 49 bytes captured (392 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1, Dst: 127.0.0.1
Transmission Control Protocol, Src Port: 3307, Dst Port: 54133, Seq: 1053, Ack: 1220, Len: 5
MySQL Protocol
    Packet Length: 1
    Packet Number: 1
    Number of fields: 1

Frame 2570: 168 bytes on wire (1344 bits), 86 bytes captured (688 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1, Dst: 127.0.0.1
Transmission Control Protocol, Src Port: 3307, Dst Port: 54133, Seq: 1058, Ack: 1220, Len: 42
MySQL Protocol
    Packet Length: 38
    Packet Number: 2
    Catalog: def
    Database: 
    Table: 
    Original table: 
    Name: COUNT(*)
    Original name: COUNT(*)
    Charset number: utf8 COLLATE utf8_general_ci (33)
    Length: 21
    Type: FIELD_TYPE_LONGLONG (8)
    Flags: 0x0000
    Decimals: 0

Frame 2572: 102 bytes on wire (816 bits), 53 bytes captured (424 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1, Dst: 127.0.0.1
Transmission Control Protocol, Src Port: 3307, Dst Port: 54133, Seq: 1100, Ack: 1220, Len: 9
MySQL Protocol
    Packet Length: 5
    Packet Number: 3
    EOF marker: 254
    Warnings: 0
    Server Status: 0x0002

Frame 2574: 102 bytes on wire (816 bits), 53 bytes captured (424 bits) on interface 0
Null/Loopback
Internet Protocol Version 4, Src: 127.0.0.1, Dst: 127.0.0.1
Transmission Control Protocol, Src Port: 3307, Dst Port: 54133, Seq: 1109, Ack: 1220, Len: 9
MySQL Protocol
    Packet Length: 5
    Packet Number: 5
    EOF marker: 254
    Warnings: 0
    Server Status: 0x0002


### Steps to reproduce the behavior
Execute SQL "SELECT COUNT(*) FROM t_order"  in prepared statement.

### For bug report, please *MUST* provide the reproduce example codes (such as a github link).
Since it's straightforward to reproduce, you can add this SQL in the raw example.

Changed files:
sharding-proxy/src/main/java/io/shardingsphere/proxy/transport/mysql/packet/command/query/binary/execute/BinaryProtocolValue.java

diff --git a/sharding-proxy/src/main/java/io/shardingsphere/proxy/transport/mysql/packet/command/query/binary/execute/BinaryProtocolValue.java b/sharding-proxy/src/main/java/io/shardingsphere/proxy/transport/mysql/packet/command/query/binary/execute/BinaryProtocolValue.java
index 0bf8206c81b..4d21232c407 100644
--- a/sharding-proxy/src/main/java/io/shardingsphere/proxy/transport/mysql/packet/command/query/binary/execute/BinaryProtocolValue.java
+++ b/sharding-proxy/src/main/java/io/shardingsphere/proxy/transport/mysql/packet/command/query/binary/execute/BinaryProtocolValue.java
@@ -21,6 +21,7 @@ import io.shardingsphere.proxy.transport.mysql.constant.ColumnType;
 import io.shardingsphere.proxy.transport.mysql.packet.MySQLPacketPayload;
 import lombok.RequiredArgsConstructor;
 
+import java.math.BigDecimal;
 import java.sql.Timestamp;
 import java.util.Date;
 
@@ -107,7 +108,7 @@ public final class BinaryProtocolValue {
                 payload.writeStringLenenc(binaryData.toString());
                 break;
             case MYSQL_TYPE_LONGLONG:
-                payload.writeInt8((Long) binaryData);
+                payload.writeInt8(((BigDecimal) binaryData).longValue());
                 break;
             case MYSQL_TYPE_LONG:
             case MYSQL_TYPE_INT24: