Replies: 1 comment 1 reply
-
if I read your code correctly @jwpegram const pool = require('./lib/services/database');
async function test() {
const conn = await pool.connection()
try {
await conn.beginTransaction();
const [rows] = await conn.query('SELECT * FROM mytable');
console.log(rows);
await conn.commit();
} catch(error) {
await conn.rollback();
}
finally {
conn.release();
}
}
test().catch(console.error); |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Not sure exactly what I am doing wrong, it looks like this should work but here goes.
/lib/services/database.js
test-promise-query.js (works)
test-promise-transaction.js (fails)
The promise transaction test fails with:
error: uncaughtException: conn.beginTransaction is not a function
I'm sure I'm not doing something correctly.. anyone got any ideas?
Beta Was this translation helpful? Give feedback.
All reactions