Skip to content

Parse NULL-bitmask in table map event - #361

Merged
julien-duponchelle merged 1 commit into
julien-duponchelle:mainfrom
dongwook-chan:null-bitmask
Oct 18, 2021
Merged

julien-duponchelle merged 1 commit into
julien-duponchelle:mainfrom
dongwook-chan:null-bitmask

Conversation

@dongwook-chan

@dongwook-chan dongwook-chan commented Oct 16, 2021 •

Copy link
Copy Markdown
Collaborator

This PR adds null-bitmask attribute to table map event.
The attribute is a bit mask where (i - 1) th bit is set if i th column is nullable.
Added and passed relevant tests.

This feature is suggested in the following comments:
https://github.com/noplay/python-mysql-replication/blob/f70f05bc143bbf50dad5461dcb3a2a47a7f67202/pymysqlreplication/row_event.py#L651-L652

References

MySQL Documentation

mysql-server source code

@julien-duponchelle

Copy link
Copy Markdown
Owner

I will ship a new release with your work. Thanks a lot

@julien-duponchelle
julien-duponchelle merged commit f028364 into julien-duponchelle:main Oct 18, 2021
self.assertEqual(event.catalog_nz_code, b'std')
self.assertEqual(event.mts_accessed_db_names, [b'pymysqlreplication_test'])

def test_null_bitmask(self)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

def test_null_bitmask(self):

for i in range(16):
values.append('0')

insert_query += f' ({",".join(values)})')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

insert_query += f' ({",".join(values)})'

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the comment. 👍👍
I will have these fixed in a separate PR.

@dongwook-chan

Copy link
Copy Markdown
Collaborator Author

Thanks for the null-bitmask review. Both syntax corrections in the test are valid: the function definition needs its trailing colon, and the INSERT construction must not have the extra closing parenthesis. I acknowledged one of these earlier but did not provide a follow-up commit in this discussion. Since this PR is already merged, I am recording that gap rather than claiming the old review was fully implemented.

Review threads addressed in this reply:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants