Closed carlosfer02 closed 1 year ago
How can I commit a query only if the call to another method is successful?
I am trying something like this:
const transaction = await mysql.connection.transaction(); await transaction.query("UPDATE employees SET name=? WHERE id=3", [name]); let result = await CognitoAccessToken.signUp(); if (result == true) { await transaction.commit(); } else { await transaction.rollback(); } await mysql.connection.end();
But for some reason, only after executing the query twice, it makes the employee update.
PS: I am using node.js
Maybe #85 is what you are looking for.
How can I commit a query only if the call to another method is successful?
I am trying something like this:
But for some reason, only after executing the query twice, it makes the employee update.
PS: I am using node.js