#26140: BinaryField value must be declared "binary" in queries to avoid MySQL
5.7+
warning
-------------------------------------+-------------------------------------
Reporter: timgraham | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Database | Version: master
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
There are a couple warnings with running the Django test suite on MySQL
5.7:
{{{
test_json_serializer (serializers.test_data.SerializerDataTests) ...
/media/sf_django/django/db/backends/mysql/base.py:112: Warning: Invalid
utf8 character string: 'FD00'
return self.cursor.execute(query, args)
test_set_and_retrieve (model_fields.tests.BinaryFieldTests) ...
/media/sf_django/django/db/backends/mysql/base.py:112: Warning: Invalid
utf8 character string: 'FE'
}}}
I think these are both fixed by changing our queries from something like
{{{
cursor.execute("""
INSERT INTO `field` (binary)
VALUES (%s)
""", data)
}}}
to:
{{{
cursor.execute("""
INSERT INTO `field` (binary)
VALUES (_binary %s)
""", data)
}}}
The "_binary" tells MySQL that the following string is to be interpreted
as binary, not to be interpreted/validated as utf8.
http://dev.mysql.com/doc/refman/5.7/en/charset-literal.html
There's some background in #26139.
--
Ticket URL: <https://code.djangoproject.com/ticket/26140>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/052.d4788ea19bc484aa7afec385c82451e5%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.