diff --git a/pymysqlreplication/binlogstream.py b/pymysqlreplication/binlogstream.py index 793f98e8..bbb0161f 100644 --- a/pymysqlreplication/binlogstream.py +++ b/pymysqlreplication/binlogstream.py @@ -616,7 +616,8 @@ def __get_table_information(self, schema, table): cur.execute(""" SELECT COLUMN_NAME, COLLATION_NAME, CHARACTER_SET_NAME, - COLUMN_COMMENT, COLUMN_TYPE, COLUMN_KEY, ORDINAL_POSITION + COLUMN_COMMENT, COLUMN_TYPE, COLUMN_KEY, ORDINAL_POSITION, + DATA_TYPE, CHARACTER_OCTET_LENGTH FROM information_schema.columns WHERE diff --git a/pymysqlreplication/column.py b/pymysqlreplication/column.py index 71eaf63f..faa1ab7e 100644 --- a/pymysqlreplication/column.py +++ b/pymysqlreplication/column.py @@ -26,6 +26,12 @@ def __parse_column_definition(self, column_type, column_schema, packet): self.type_is_bool = False self.is_primary = column_schema["COLUMN_KEY"] == "PRI" + # Check for fixed-length binary type. When that's the case then we need + # to zero-pad the values to full length at read time. + self.fixed_binary_length = None + if column_schema["DATA_TYPE"] == "binary": + self.fixed_binary_length = column_schema["CHARACTER_OCTET_LENGTH"] + if self.type == FIELD_TYPE.VARCHAR: self.max_length = struct.unpack('