Skip to content

Add some TableMapEvent helper methods #482

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

Merged
merged 5 commits into from
Jun 22, 2020

Conversation

huangjunwen
Copy link
Contributor

This pr adds some type-related helper methods for TableMapEvent. #479

They should behave the same as Table_map_log_event::print_columns (mysqlbinlog --print-table-metadata).

And a flavor field is added to BinlogParser and passed to TableMapEvent to distinguish mysql/mariadb, since there are some differences slightly in checking types.

@IANTHEREAL
Copy link
Collaborator

LGTM

@IANTHEREAL
Copy link
Collaborator

@csuzhangxc PTAL, if there're not any problems, we can merge this PR ASAP

Copy link
Contributor

@csuzhangxc csuzhangxc left a comment

Choose a reason for hiding this comment

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

rest LGTM

func (e *TableMapEvent) realType(i int) byte {

typ := e.ColumnType[i]
meta := e.ColumnMeta[i]
Copy link
Contributor

Choose a reason for hiding this comment

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

How about putting this line above L748?


case MYSQL_TYPE_GEOMETRY:
if e.flavor == "mariadb" {
return true
Copy link
Contributor

Choose a reason for hiding this comment

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

How about highlight this special behavior as the comments of this func (IsCharacterColumn)?

Move some code in TableMapEvent.realType
Copy link
Contributor

@csuzhangxc csuzhangxc left a comment

Choose a reason for hiding this comment

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

LGTM

@IANTHEREAL IANTHEREAL merged commit a8c16ae into go-mysql-org:master Jun 22, 2020
huangjunwen added a commit to huangjunwen/golibs that referenced this pull request Jun 28, 2020
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