Add test for #449
This commit is contained in:
@@ -99,3 +99,16 @@ class CursorTest(base.PyMySQLTestCase):
|
|||||||
data_dict = [{'data': i} for i in xrange(10)]
|
data_dict = [{'data': i} for i in xrange(10)]
|
||||||
cursor.executemany("insert into test (data) values (%(data)s)", data_dict)
|
cursor.executemany("insert into test (data) values (%(data)s)", data_dict)
|
||||||
self.assertTrue(cursor._executed.endswith(",(7),(8),(9)"), 'execute many with %(data)s not in one query')
|
self.assertTrue(cursor._executed.endswith(",(7),(8),(9)"), 'execute many with %(data)s not in one query')
|
||||||
|
|
||||||
|
# %% in column set
|
||||||
|
cursor.execute("""\
|
||||||
|
CREATE TABLE percent_test (
|
||||||
|
`A%` INTEGER,
|
||||||
|
`B%` INTEGER)""")
|
||||||
|
try:
|
||||||
|
q = "INSERT INTO percent_test (`A%%`, `B%%`) VALUES (%s, %s)"
|
||||||
|
self.assertIsNotNone(pymysql.cursors.RE_INSERT_VALUES.match(q)
|
||||||
|
cursor.executemany(q, [(3, 4), (5, 6)])
|
||||||
|
self.assertTrue(cursor._executed.endswith("(3, 4),(5, 6)"), "executemany with %% not in one query")
|
||||||
|
finally:
|
||||||
|
cursor.execute("DROP TABLE IF EXISTS percent_test")
|
||||||
|
|||||||
Reference in New Issue
Block a user