-
Notifications
You must be signed in to change notification settings - Fork 42
Closed
Description
Most the samples involving transactions use a singular connection.
I'm however using a pool.
My worry is following
let pool = new mssql.Pool(config)
pool.open()
/* later */
async function doSomething() {
let promises = pool.promises
try {
await promises.query('BEGIN TRANSACTION')
/* do select and locking and updating here */
await promises.query('COMMIT')
} catch (err) {
await promises.query('ROLLBACK')
throw err
}
}My problem is, the nature of pooling, I'm not sure all my queries will be running on the same connection. And if they aren't, then that's a recipe for disaster since transaction are connection-scoped.
Is there a way to grab a specific connection from a pool?
I couldn't find it in the api or the documentations.
Metadata
Metadata
Assignees
Labels
No labels