MySQLdb1
MySQLdb1 copied to clipboard
executemany change introduced failure in 1.2.3->HEAD
This query worked in 1.2.3 but now fails.
cursor = conn.cursor()
cursor.executemany(
'INSERT INTO foo (bar, baz) VALUES (%s, LEAST(UNIX_TIMESTAMP(), %s))',
[('bar', 1), ('baz', 2)])
Results in:
Traceback (most recent call last):
File "/home/$USER/mysql-syntax-error.py", line 11, in <module>
[('bar', 1), ('baz', 2)])
File "/...//MySQLdb/cursors.py", line 252, in executemany
r = self._query('\n'.join([query[:p], ',\n'.join(q), query[e:]]))
File "/...//MySQLdb/cursors.py", line 344, in _query
rowcount = self._do_query(q)
File "/...//MySQLdb/cursors.py", line 308, in _do_query
db.query(q)
_mysql_exceptions.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 4")
>>>