Thanks for your time. I'm having trouble with creating a transaction query using the mysql2/promise package.
Here's the query:
await db.execute(`START TRANSACTION`);
await db.execute(`INSERT INTO user VALUES (?, ?, ?, ?, ?, ?)`, [...userDetails]);
await db.execute(`INSERT INTO account VALUES (?, ?, ?, ?, ?, ?)`, [...accountDetails]);
await db.execute(`COMMIT`);
And here's the error I get:
Error: This command is not supported in the prepared statement protocol yet
code: 'ER_UNSUPPORTED_PS',
errno: 1295,
sql: 'START TRANSACTION',
sqlState: 'HY000',
sqlMessage: 'This command is not supported in the prepared statement protocol yet'
I'm wondering if has something to do with my querying? I believe INSERT statements should be perfectly fine in a transaction block. I've also tried combining each query into one string, but that doesn't seem to work either.