-
-
Notifications
You must be signed in to change notification settings - Fork 638
Closed
Labels
Description
My transaction code:
try {
const cn = await pool.getConnection()
await cn.beginTransaction()
await cn.execute(' ...
await cn.execute(' ...
await cn.commit()
}
catch {
await cn.rollback()
}
But am I wrong? Should it be:
const cn = await pool.getConnection()
try {
await cn.beginTransaction()
await cn.execute(' ...
await cn.execute(' ...
await cn.commit()
}
catch {
await cn.rollback()
}
But wait! Should it be?
const cn = await pool.getConnection()
await cn.beginTransaction()
try {
await cn.execute(' ...
await cn.execute(' ...
await cn.commit()
}
catch {
await cn.rollback()
}
I'm afraid I don't know the answer. Thanks in advance anyone who can advise. (It may help others also?)