mirror of
https://github.com/PyMySQL/mysqlclient.git
synced 2025-08-15 19:31:54 +08:00
Add comment.
This commit is contained in:
@ -177,6 +177,14 @@ class BaseCursor(object):
|
|||||||
"""
|
"""
|
||||||
del self.messages[:]
|
del self.messages[:]
|
||||||
db = self._get_db()
|
db = self._get_db()
|
||||||
|
|
||||||
|
# NOTE:
|
||||||
|
# Python 2: query should be bytes when executing %.
|
||||||
|
# All unicode in args should be encoded to bytes on Python 2.
|
||||||
|
# Python 3: query should be str (unicode) when executing %.
|
||||||
|
# All bytes in args should be decoded with ascii and surrogateescape on Python 3.
|
||||||
|
# db.literal(obj) always returns str.
|
||||||
|
|
||||||
if PY2 and isinstance(query, unicode):
|
if PY2 and isinstance(query, unicode):
|
||||||
query = query.encode(db.unicode_literal.charset)
|
query = query.encode(db.unicode_literal.charset)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user