Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
let transaction = sql.transaction();
transaction.begin((err) = > {
if(err)
return console.log(err);
sql.request(transaction)
.input('Nome', 'Gustavo')
.input('NomeDaMae', 'Joana')
.execute('BuscarUsuario', (err, recordset) => {
//Se acontecer algum erro, ROLLBACK na transaction
if(err) {
transaction.rollback(() => {
console.log(err);
});
//Caso contrário, COMMIT
} else {
transaction.commit(() => {
console.log(recordset);
});
}
});
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.