Lucas-307 commented on a change in pull request #7725:
URL: https://github.com/apache/shardingsphere/pull/7725#discussion_r502736666



##########
File path: 
shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/binlog/row/column/value/string/MySQLStringBinlogProtocolValue.java
##########
@@ -31,18 +31,32 @@
     
     @Override
     public Serializable read(final MySQLBinlogColumnDef columnDef, final 
MySQLPacketPayload payload) {
-        switch (MySQLColumnType.valueOf(columnDef.getColumnMeta() >> 8)) {
+        int type = columnDef.getColumnMeta() >> 8;
+        int length = columnDef.getColumnMeta() & 0xff;
+        // unpack type & length, see https://bugs.mysql.com/bug.php?id=37426.
+        if ((type & 0x30) != 0x30) {
+            length += ((type & 0x30) ^ 0x30) << 4;
+            type |= 0x30;
+        }
+        switch (MySQLColumnType.valueOf(type)) {
             case MYSQL_TYPE_ENUM:
-                return readEnumValue(columnDef.getColumnMeta() & 0xff, 
payload);
+                return readEnumValue(length, payload);
             case MYSQL_TYPE_SET:
                 return payload.getByteBuf().readByte();
             case MYSQL_TYPE_STRING:
-                return 
payload.readStringFix(payload.getByteBuf().readUnsignedByte());
+                return payload.readStringFix(readActualLength(payload, 
length));

Review comment:
       please make sure args is in the same order.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to