added fix for non utf8 query event#146
Open
mastak wants to merge 1 commit into
Open
Conversation
Owner
|
What is the schema of the column creating the issue? |
Collaborator
|
@mastak can you add a test which show cases the error (and the fix)? |
Contributor
Author
|
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")) |
Contributor
Author
|
Could we do something like: |
mastak
force-pushed
the
dev-non-utf8
branch
4 times, most recently
from
July 13, 2016 07:40
854851e to
9ba26bc
Compare
Owner
Contributor
Author
|
Sure, it would be good. |
Contributor
Author
|
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? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I faced with this #132 problem.
Does this solution have a chance to live? (=