Skip to content

Developed UserVarEvent and Added Statement-Based Logging Test - #466

Merged
julien-duponchelle merged 7 commits into
julien-duponchelle:mainfrom
python-mysql-replication-kr:feature/add-user-var-event
Sep 1, 2023
Merged

julien-duponchelle merged 7 commits into
julien-duponchelle:mainfrom
python-mysql-replication-kr:feature/add-user-var-event

Conversation

@mjs1995

@mjs1995 mjs1995 commented Sep 1, 2023

Copy link
Copy Markdown
Contributor

Overview

This Pull Request introduces the UserVarEvent class, aimed at providing robust handling for MySQL/MariaDB binary log events related to user variables. To validate the effectiveness of this implementation, TestStatementConnectionSetting, has been added to focus on statement-based logging scenarios.


Description

UserVarEvent Class

The UserVarEvent class has been implemented following the official documentation of MySQL and MariaDB. It supports various user variable event types, including:

  • STRING_RESULT
  • REAL_RESULT
  • INT_RESULT
  • ROW_RESULT (Currently not in use)
  • DECIMAL_RESULT

Type-Specific Value Parsing

  • STRING, REAL, INT, ROW, DECIMAL Types: Each data type has its dedicated function to parse values appropriately.

  • DECIMAL Type: Introduced a specialized bit-parsing function to handle decimal types.

  • INT Type: Utilized flags to distinguish between signed and unsigned integers.

    • Test Cases include:
      • Unsigned Maximum: 18446744073709551615
      • Signed Maximum: 9223372036854775807
      • Signed Minimum: -9223372036854775808
      • Near Zero: -1

TestStatementConnectionSetting Class

A new test was added to cater specifically to the testing requirements of UserVarEvent under statement-based logging.


Additional Method

_set_value_from_temp_buffer Method

This method serves to populate a designated class attribute with an accurately parsed value extracted from a temporary buffer. Utilizing a dictionary as a mapping mechanism, it correlates each event type code to its specific value-parsing function.

_parse_decimal_from_bytes Method

This static method has been introduced to parse decimal numbers from bytes.


Reference

@mjs1995 mjs1995 closed this Sep 1, 2023
@mjs1995 mjs1995 reopened this Sep 1, 2023
@julien-duponchelle

Copy link
Copy Markdown
Owner

Wow great work

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