Skip to content

Commit 232e74b

Browse files
mickeybaloo
authored andcommitted
Insert NULL in a boolean column returns no rows #288
1 parent 72db07f commit 232e74b

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Diff for: pymysqlreplication/row_event.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ def _fetch_rows(self):
418418
if not self.complete:
419419
return
420420

421-
while self.packet.read_bytes + 1 < self.event_size:
421+
while self.packet.read_bytes < self.event_size:
422422
self.__rows.append(self._fetch_one_row())
423423

424424
@property

Diff for: pymysqlreplication/tests/test_data_type.py

+6
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,12 @@ def test_tiny_maps_to_none(self):
169169
self.assertEqual(type(event.rows[0]["values"]["test"]), type(None))
170170
self.assertEqual(event.rows[0]["values"]["test"], None)
171171

172+
def test_tiny_maps_to_none_2(self):
173+
create_query = "CREATE TABLE test (test BOOLEAN)"
174+
insert_query = "INSERT INTO test VALUES(NULL)"
175+
event = self.create_and_insert_value(create_query, insert_query)
176+
self.assertEqual(event.rows[0]["values"]["test"], None)
177+
172178
def test_short(self):
173179
create_query = "CREATE TABLE test (id SMALLINT UNSIGNED NOT NULL, test SMALLINT)"
174180
insert_query = "INSERT INTO test VALUES(65535, -32768)"

0 commit comments

Comments
 (0)