Skip to content

Commit

Permalink
Merge tag '2.2.28-sbollie-2' into 2.2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
thebarbershop committed Jul 20, 2023
2 parents f383c4d + d909e45 commit a874657
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion django/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.utils.version import get_version

VERSION = (2, 2, 29, 'alpha', 0)
VERSION = (2, 2, 30, 'alpha', 0)

__version__ = get_version(VERSION)

Expand Down
4 changes: 2 additions & 2 deletions django/db/backends/mysql/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
from .validation import DatabaseValidation # isort:skip

version = Database.version_info
if version < (1, 3, 13):
raise ImproperlyConfigured('mysqlclient 1.3.13 or newer is required; you have %s.' % Database.__version__)
# if version < (1, 3, 13):
# raise ImproperlyConfigured('mysqlclient 1.3.13 or newer is required; you have %s.' % Database.__version__)


# MySQLdb returns TIME columns as timedelta -- they are more like timedelta in
Expand Down
7 changes: 3 additions & 4 deletions django/db/backends/mysql/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from django.db.backends.base.operations import BaseDatabaseOperations
from django.utils import timezone
from django.utils.duration import duration_microseconds
from django.utils.encoding import force_str


class DatabaseOperations(BaseDatabaseOperations):
Expand Down Expand Up @@ -141,10 +142,8 @@ def last_executed_query(self, cursor, sql, params):
# With MySQLdb, cursor objects have an (undocumented) "_executed"
# attribute where the exact query sent to the database is saved.
# See MySQLdb/cursors.py in the source distribution.
query = getattr(cursor, '_executed', None)
if query is not None:
query = query.encode(errors='replace')
return query
# MySQLdb returns string, PyMySQL bytes.
return force_str(getattr(cursor, '_last_executed', None), errors='replace')

def no_limit_value(self):
# 2**64 - 1, as recommended by the MySQL documentation
Expand Down
3 changes: 2 additions & 1 deletion django/db/backends/mysql/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):

def quote_value(self, value):
self.connection.ensure_connection()
# MySQLdb escapes to string, PyMySQL to bytes.
quoted = self.connection.connection.escape(value, self.connection.connection.encoders)
if isinstance(value, str):
if isinstance(value, str) and isinstance(quoted, bytes):
quoted = quoted.decode()
return quoted

Expand Down

0 comments on commit a874657

Please sign in to comment.