Repository: apache/shardingsphere
Issue: null and pagination question

## Question

I am using the sharding-proxy, the PreparedStatement setString, I set the field to be null object not the 'null' string, the sharding-proxy will treat it as a string to be inserted into table,which is not my expected result is also not the same as in jdbc.
for the pagination, it is not support the sql like  'limit 20 offset 0' ;only support the 'limit 0,20'. if this limit offset statement can be supported in the future?


Changed files:
sharding-proxy/sharding-proxy-transport/sharding-proxy-transport-mysql/src/test/java/org/apache/shardingsphere/shardingproxy/transport/mysql/packet/command/query/binary/execute/protocol/MySQLMySQLBinaryProtocolValueFactoryTest.java
sharding-proxy/sharding-proxy-transport/sharding-proxy-transport-mysql/src/main/java/org/apache/shardingsphere/shardingproxy/transport/mysql/packet/command/query/binary/execute/protocol/MySQLBinaryProtocolValueFactory.java

diff --git a/sharding-proxy/sharding-proxy-transport/sharding-proxy-transport-mysql/src/main/java/org/apache/shardingsphere/shardingproxy/transport/mysql/packet/command/query/binary/execute/protocol/MySQLBinaryProtocolValueFactory.java b/sharding-proxy/sharding-proxy-transport/sharding-proxy-transport-mysql/src/main/java/org/apache/shardingsphere/shardingproxy/transport/mysql/packet/command/query/binary/execute/protocol/MySQLBinaryProtocolValueFactory.java
index 2096db93c05..c761768d170 100644
--- a/sharding-proxy/sharding-proxy-transport/sharding-proxy-transport-mysql/src/main/java/org/apache/shardingsphere/shardingproxy/transport/mysql/packet/command/query/binary/execute/protocol/MySQLBinaryProtocolValueFactory.java
+++ b/sharding-proxy/sharding-proxy-transport/sharding-proxy-transport-mysql/src/main/java/org/apache/shardingsphere/shardingproxy/transport/mysql/packet/command/query/binary/execute/protocol/MySQLBinaryProtocolValueFactory.java
@@ -45,6 +45,7 @@ public final class MySQLBinaryProtocolValueFactory {
         setFloatBinaryProtocolValue();
         setDateBinaryProtocolValue();
         setTimeBinaryProtocolValue();
+        setNullBinaryProtocolValue();
     }
     
     private static void setStringLenencBinaryProtocolValue() {
@@ -108,6 +109,10 @@ public final class MySQLBinaryProtocolValueFactory {
         BINARY_PROTOCOL_VALUES.put(MySQLColumnType.MYSQL_TYPE_TIME, binaryProtocolValue);
     }
     
+    private static void setNullBinaryProtocolValue() {
+        BINARY_PROTOCOL_VALUES.put(MySQLColumnType.MYSQL_TYPE_NULL, null);
+    }
+    
     /**
      * Get binary protocol value.
      * 
diff --git a/sharding-proxy/sharding-proxy-transport/sharding-proxy-transport-mysql/src/test/java/org/apache/shardingsphere/shardingproxy/transport/mysql/packet/command/query/binary/execute/protocol/MySQLMySQLBinaryProtocolValueFactoryTest.java b/sharding-proxy/sharding-proxy-transport/sharding-proxy-transport-mysql/src/test/java/org/apache/shardingsphere/shardingproxy/transport/mysql/packet/command/query/binary/execute/protocol/MySQLMySQLBinaryProtocolValueFactoryTest.java
index e30d9a3daa4..e2d542a1403 100644
--- a/sharding-proxy/sharding-proxy-transport/sharding-proxy-transport-mysql/src/test/java/org/apache/shardingsphere/shardingproxy/transport/mysql/packet/command/query/binary/execute/protocol/MySQLMySQLBinaryProtocolValueFactoryTest.java
+++ b/sharding-proxy/sharding-proxy-transport/sharding-proxy-transport-mysql/src/test/java/org/apache/shardingsphere/shardingproxy/transport/mysql/packet/command/query/binary/execute/protocol/MySQLMySQLBinaryProtocolValueFactoryTest.java
@@ -21,6 +21,8 @@ import org.apache.shardingsphere.shardingproxy.transport.mysql.constant.MySQLCol
 import org.junit.Test;
 
 import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.nullValue;
 import static org.junit.Assert.assertThat;
 
 public final class MySQLMySQLBinaryProtocolValueFactoryTest {
@@ -150,8 +152,13 @@ public final class MySQLMySQLBinaryProtocolValueFactoryTest {
         assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLColumnType.MYSQL_TYPE_TIME), instanceOf(MySQLTimeBinaryProtocolValue.class));
     }
     
+    @Test
+    public void assertGetBinaryProtocolValueWithMySQLTypeNull() {
+        assertThat(MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLColumnType.MYSQL_TYPE_NULL), is(nullValue()));
+    }
+    
     @Test(expected = IllegalArgumentException.class)
     public void assertGetBinaryProtocolValueWithUnsupportedType() {
-        MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(MySQLColumnType.MYSQL_TYPE_NULL);
+        MySQLBinaryProtocolValueFactory.getBinaryProtocolValue(null);
     }
 }