paul-rouse / mysql-simple

A mid-level client library for the MySQL database, intended to be fast and easy to use.
Other
91 stars 35 forks source link

executeMany fails with UPDATE query #28

Open timmyw opened 8 years ago

timmyw commented 8 years ago

executeMany expects a string VALUES (?,?,?...) in the query, which requires the underlying values() function (which is provided by PostgreSQL, but not MySQL). The regex used in the source for formatMany just looks for VALUES (?,?,?...) substring. A MySQL update would require it to support a query of the form UPDATE table SET x = ?, y = ? WHERE z = ?. MySQL doesn't support any way (that I could find) that would allow an update query that used the VALUES(?,?,?...) form. The documentation just needs changing to specify that executeMany only works with insert queries, and not update queries.