From 2ce05805c86e5c8115ece28d44a265552bc68dfc Mon Sep 17 00:00:00 2001 From: Joy Yeh Date: Mon, 15 Jul 2019 21:32:27 +0900 Subject: [PATCH] Made charset and error behaviour class members of QueryEvent. Re-pushed because I forgot to add self. to charset and on_errors. Also added keywords to make it more explicit. --- pymysqlreplication/event.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pymysqlreplication/event.py b/pymysqlreplication/event.py index 97ff5817..1c3ce061 100644 --- a/pymysqlreplication/event.py +++ b/pymysqlreplication/event.py @@ -155,6 +155,8 @@ def _dump(self): class QueryEvent(BinLogEvent): + charset = 'utf-8' + on_errors = 'strict' '''This evenement is trigger when a query is run of the database. Only replicated queries are logged.''' def __init__(self, from_packet, event_size, table_map, ctl_connection, **kwargs): @@ -174,7 +176,8 @@ def __init__(self, from_packet, event_size, table_map, ctl_connection, **kwargs) self.packet.advance(1) self.query = self.packet.read(event_size - 13 - self.status_vars_length - - self.schema_length - 1).decode("utf-8") + - self.schema_length - 1).decode( + encoding=self.charset, errors=self.on_errors) #string[EOF] query def _dump(self):