Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse NULL-bitmask in table map event #361

Merged

Conversation

dongwook-chan
Copy link
Collaborator

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

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
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
"""
create_query = "CREATE TABLE test (id INTEGER)"
event = self.create_table(create_query)
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
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
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
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.

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