A pool of its own
createMysqlStore takes only a pool created with multipleStatements: true, and throws a TypeError
for any other: the store sends a transaction as one multi-statement query, so that it costs one round
trip. There is no other way to send them.
Give Motoko a pool that nothing else uses. Multiple statements widen what an SQL injection can do: a query that splices untrusted text into its SQL lets that text end the statement and run others of its own, where without the flag it could only change the one statement. Motoko splices no value: it binds every one as a parameter. Code that shares the pool may not, so it would run with that wider blast radius.
mysql2 escapes bound parameters into the query text itself, with backslashes, which is sound only while
the server's sql_mode lacks NO_BACKSLASH_ESCAPES. Every app that sends parameters through mysql2's
query() assumes this; with multiple statements, a server that breaks it lets a value run statements.