CodeFoodPixels / node-promise-mysql

A wrapper for mysqljs/mysql that wraps function calls with Bluebird promises.
MIT License
338 stars 63 forks source link

Added connection pool #9

Closed naturalethic closed 8 years ago

CodeFoodPixels commented 8 years ago

Thanks for this Joshua, it all seems to make sense. One thing before I merge, do you have an example of it working?

naturalethic commented 8 years ago

Nope, I tested against a private project. Perhaps you could add some unit tests. :)

Or -- did you mean an example of how to use it for the docs? If so, everything from before worked as documented. The new stuff is:

var mysql = require('promise-mysql')
var pool = mysql.createPool(config) // Returns a connection pool (not a promise)
pool.getConnection().then(function(connection))
connection.release()
pool.end().then(function)
naturalethic commented 8 years ago

Unit tests should be written before you merge for sure. I just fixed a bug in the PR.

pdaether commented 8 years ago

I only saw the old dev/pool branch and somehow overlooked this pull request. :-( So I also added a working implementation of the connection pool ( https://github.com/pdaether/node-promise-mysql/tree/dev/pool ) and created some basic tests with mocha.

Maybe we can combine our efforts to get the tests and this feature into the main branch?

naturalethic commented 8 years ago

As your contribution is more thorough, I recommend it be merged over mine.

CodeFoodPixels commented 8 years ago

@pdaether Can you submit a pull request with your changes? I'll do a review and merge it if it all looks good.

CodeFoodPixels commented 8 years ago

Merged #10 instead