Skip to content

Commit 37bcd47

Browse files
committed
Insert with values as args
1 parent d140fc4 commit 37bcd47

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

pymysqlreplication/tests/base.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ def execute(self, query):
8585
c = self.conn_control.cursor()
8686
c.execute(query)
8787
return c
88+
89+
def execute_with_args(self, query, args):
90+
c = self.conn_control.cursor()
91+
c.execute(query, args)
92+
return c
8893

8994
def resetBinLog(self):
9095
self.execute("RESET MASTER")

pymysqlreplication/tests/test_basic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ def test_ignore_decode_errors(self):
685685
self.execute("INSERT INTO test VALUES (1, 'A value')")
686686
self.execute("COMMIT")
687687
self.execute("ALTER TABLE test MODIFY COLUMN data VARCHAR(50) CHARACTER SET utf8mb4")
688-
self.execute(f"INSERT INTO test VALUES (2, '{problematic_unicode_string}')")
688+
self.execute_with_args("INSERT INTO test (id, data) VALUES (%s, %s)", (2, problematic_unicode_string))
689689
self.execute("COMMIT")
690690

691691
self.stream = BinLogStreamReader(

0 commit comments

Comments
 (0)