Closed DanHulton closed 7 years ago
I'm sorry I've not done anything with this yet. I am aware of the pull request, I just need to run some tests before I can merge
On Sun, 21 Aug 2016 at 03:04 Dan Hulton notifications@github.com wrote:
DB_POOL.getConnection().then(function(connection) { connection.query('SELECT * FROM characters WHERE uid = ?', [id]).then(function(rows) { // Release the connection back into the pool connection.release(); ... }); });
You can view, comment on, or merge this pull request online at:
https://github.com/lukeb-uk/node-promise-mysql/pull/22 Commit Summary
- Added release() function to connection to enable better-behaved pooled connections.
File Changes
- M lib/connection.js https://github.com/lukeb-uk/node-promise-mysql/pull/22/files#diff-0 (4)
Patch Links:
- https://github.com/lukeb-uk/node-promise-mysql/pull/22.patch
- https://github.com/lukeb-uk/node-promise-mysql/pull/22.diff
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/lukeb-uk/node-promise-mysql/pull/22, or mute the thread https://github.com/notifications/unsubscribe-auth/AEjy1NlyQRGTIOE5kmiwnJ2mltHsS-Ldks5qh7I6gaJpZM4JpNN0 .
Thanks!
First off, thanks for your support in creating and maintaining this library. Question regarding the connection pools,
const pool = await mysql.createPool(...);
const connection = await pool.getConnection();
await connection.query(...);
await connection.release();
This would be the workflow, in an async-await
environment for taking a connection from a pool, querying against it, and then returning the connection back to the pool so it may be consumed by other services?
I believe that is correct, yes.
On Thu, 24 Aug 2017, 19:14 Patrick Zawadzki notifications@github.com wrote:
First off, thanks for your support in creating and maintaining this library. Question regarding the connection pools,
const pool = await mysql.createPool(...); const connection = await pool.getConnection(); await connection.query(...); await connection.release();
This would be the workflow, in an async-await environment for taking a connection from a pool, querying against it, and then returning the connection back to the pool so it may be consumed by other services?
— You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub https://github.com/lukeb-uk/node-promise-mysql/pull/22#issuecomment-324714578, or mute the thread https://github.com/notifications/unsubscribe-auth/AEjy1GhYo5lxdCYGP_TDEKfcKar2uv2Oks5sbb2QgaJpZM4JpNN0 .