GithubHelp home page GithubHelp logo

simple_pool's Introduction

simple_pool

A very simple pooling service built to work with mariasql.

Was created for an isolated use-case where using acquire + queuing connections in generic-pool wasn't as optimal as just sending them to the next connection, even if its busy.

var simple_pool = require('simple_pool');


// Instantiate the pool. Use a maximum of 3 connections.
var pool = new simple_pool(3, {
  user: 'user',
  password: 'pwd',
  host: '127.0.0.1',
  db: 'db',
  log: true
});

var r = [];
pool.getConnection(function(e, conn){
    if(e){
      console.log('some err', e)
      return e;
    }
    console.log('received conn threadId: ',conn.threadId);
    conn.query(query)
      .on('result', function(res) {
        res.on('row', function(row) {
           console.log('Result row: ' + inspect(row));
          r.push(row);
        })
          .on('error', function(err) {
              console.log('Result error: ' + inspect(err));
            
          })
          .on('end', function(info) {
            //  console.log('Result finished successfully');
          });
      })
      .on('end', function() {
        console.log('Done with all results');
       
      });
  });

simple_pool's People

Contributors

lrossy avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.