-
Notifications
You must be signed in to change notification settings - Fork 679
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
added fix for non utf8 query event #146
base: master
Are you sure you want to change the base?
Conversation
What is the schema of the column creating the issue? |
@mastak can you add a test which show cases the error (and the fix)? |
Sorry, guys, that I'm so slowly. def test_encoding_latin1_statement(self):
db = copy.copy(self.database)
db["charset"] = "latin1"
self.connect_conn_control(db)
create_query = "CREATE TABLE test (test CHAR(12)) CHARACTER SET latin1 COLLATE latin1_bin;"
insert_query = b"INSERT INTO test VALUES('\x96')"
self.execute(create_query)
self.execute(insert_query)
self.execute("COMMIT")
self.assertIsInstance(self.stream.fetchone(), RotateEvent)
self.assertIsInstance(self.stream.fetchone(), FormatDescriptionEvent)
# QueryEvent for the Create Table
self.assertIsInstance(self.stream.fetchone(), QueryEvent)
# QueryEvent for the BEGIN
self.assertIsInstance(self.stream.fetchone(), QueryEvent)
event = self.stream.fetchone()
self.assertIsInstance(event, QueryEvent)
self.assertEqual(event.query, insert_query.decode("latin-1")) |
Could we do something like: |
854851e
to
9ba26bc
Compare
Sure, it would be good. |
We can't return bytes (even only in case with error) because it will break existing systems. But what if add some method like: def _decode_query(self, query)
return query.decode("utf-8") and then everyone can overwrite it. What do you think? |
I faced with this #132 problem.
Does this solution have a chance to live? (=