diff --git a/pymysqlreplication/binlogstream.py b/pymysqlreplication/binlogstream.py index 85c9df6a..c4c3efb3 100644 --- a/pymysqlreplication/binlogstream.py +++ b/pymysqlreplication/binlogstream.py @@ -287,6 +287,7 @@ def __init__( else: self.pymysql_wrapper = pymysql.connect self.mysql_version = (0, 0, 0) + self.dbms = None def close(self): if self.__connected_stream: @@ -748,14 +749,12 @@ def _allowed_event_list( def __get_dbms(self): if not self.__connected_ctl: self.__connect_to_ctl() - - cur = self._ctl_connection.cursor() - cur.execute("SELECT VERSION();") - - version_info = cur.fetchone().get("VERSION()", "") - - if "MariaDB" in version_info: + if self.dbms: + return self.dbms + if "MariaDB" in self._ctl_connection.get_server_info(): + self.dbms = "mariadb" return "mariadb" + self.dbms = "mysql" return "mysql" def __log_valid_parameters(self): diff --git a/pymysqlreplication/event.py b/pymysqlreplication/event.py index 82b89974..73e36051 100644 --- a/pymysqlreplication/event.py +++ b/pymysqlreplication/event.py @@ -43,6 +43,7 @@ def __init__( self._processed = True self.complete = True self._verify_event() + self.dbms = self._ctl_connection._get_dbms() def _read_table_id(self): # Table ID is 6 byte @@ -368,10 +369,26 @@ def __init__(self, from_packet, event_size, table_map, ctl_connection, **kwargs) self.mysql_version_str = self.packet.read(50).rstrip(b"\0").decode() numbers = self.mysql_version_str.split("-")[0] self.mysql_version = tuple(map(int, numbers.split("."))) + self.created = struct.unpack("