MonetDB Pool NodeJS
Node module that maintains a connection pool with MonetDB connections.
var MonetDBPool = ; // MonetDBPool now is a constructorvar poolOptions =nrConnections: 8;// For all possible database options, seevar dbOptions =dbname: "mydb";var pool = poolOptions dbOptions;// Execute 1000 queries, which will be divided over all of the connections in the poolforvar i=0; i<1000; ++ipool;// close the pool after finishing all queries.pool;
Constructs a MonetDB connection pool.
|poolOptions||object||yes||Object containing options for this pool.|
|poolOptions.nrConnections||integer||yes||Number of connections to maintain inside this pool.|
|poolOptions.testing||boolean||no||Only used for testing purposes. If set to true, sets some additional methods on the pool object. Defaults to false.|
|dbOptions||object||yes||Object containing database options for this pool. See https://github.com/MonetDB/monetdb-nodejs#options for the options you can use here.|
Calls the connect method on all initialized MonetDBConnection objects.
Returns a promise that resolves when all connections are successfully connected.
MonetDBPool.query(query, [params], [prettyResult])
Returns the promise that is returned by MonetDBConnection.query.
Returns the promise that is returned by MonetDBConnection.prepare.
Gives you a raw MonetDBConnection object from the connection pool. A non-reserved connection with the least outstanding queries will be returned.
|reserve||boolean||no||If set to true, the returned connection will be reserved for usage in your code, meaning this connection will not be used anymore by the connection pool until you call the free() function on it. Note that at the moment you obtain a MonetDBConnection object, it might still be working on other queries so queries that you issue will have to wait in the queue for completion of these earlier queries. If set to false, or omitted, the connection pool will keep on using this connection.|
Returns a MonetDBConnection object with the additional method free(), which should be used when you are done with the connection (only if you reserved the connection). When there are no available (unreserved) connections, this method will return null.
Warning: When you query MonetDBConnection objects directly, the connection pool will not know about these queries. This might result in unfair query loads for the connection object you are using. Hence we advice to keep this kind of usage to a minimum.
Calls the close method on all initialized MonetDBConnection objects.
Returns a promise that resolves when all connections are successfully closed.