Skip to content

Commit 08b7e32

Browse files
committed
Add test for PyMySQL#494
1 parent 3517eb7 commit 08b7e32

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

tests/default.cnf

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
[MySQLdb-tests]
66
host = 127.0.0.1
7-
user = test
7+
user = root
88
database = test
99
#password =
1010
default-character-set = utf8

tests/test_cursor.py

+21
Original file line numberDiff line numberDiff line change
@@ -222,3 +222,24 @@ def test_cursor_discard_result(Cursor):
222222
"SELECT * FROM test_cursor_discard_result WHERE id BETWEEN 31 AND 40"
223223
)
224224
assert cursor.fetchone() == (31, "row 31")
225+
226+
227+
def test_binary_prefix():
228+
# https://github.com/PyMySQL/mysqlclient/issues/494
229+
conn = connect(binary_prefix=True)
230+
cursor = conn.cursor()
231+
232+
cursor.execute("DROP TABLE IF EXISTS test_binary_prefix")
233+
cursor.execute(
234+
"""\
235+
CREATE TABLE test_binary_prefix (
236+
id INTEGER NOT NULL AUTO_INCREMENT,
237+
json JSON NOT NULL,
238+
PRIMARY KEY (id)
239+
) CHARSET=utf8mb4"""
240+
)
241+
242+
cursor.executemany(
243+
"INSERT INTO test_binary_prefix (id, json) VALUES (%(id)s, %(json)s)",
244+
({"id": 1, "json": "{}"}, {"id": 2, "json": "{}"}),
245+
)

0 commit comments

Comments
 (0)