src/connections/open.js
function handleConnectionCallback(err, resolve, reject, key, connection) {
  debug('handleConnectionCallback','start');

  //error, remove cached entry, reject the promise
  if (err) {
    debug('handleConnectionCallback','error',err);
    delete promises[key];
    return reject(err);
  }

  //patch close method for caching
  shadowClose(connection);

  //create a reference to the original connection for cleanup
  connection._mssqlngKey = key;

  //add connection to the pool
  connections[connection._mssqlngKey] = connection;

  //resolve the promise
  debug('handleConnectionCallback','success');
  return resolve(connection);
}
function handleConnectionCallback(err, resolve, reject, key, connection) {
  debug('handleConnectionCallback','start');

  //error, remove cached entry, reject the promise
  if (err) {
    debug('handleConnectionCallback','error',err);
    delete promises[key];
    return reject(err);
  }

  //patch close method for caching
  shadowClose(connection);

  //create a reference to the original connection for cleanup
  connection._mssqlngKey = key;

  //add connection to the pool
  connections[connection._mssqlngKey] = connection;

  //resolve the promise
  debug('handleConnectionCallback','success');
  return resolve(connection);
}
function handleConnectionCallback ( err , resolve , reject , key , connection ) { debug ( 'handleConnectionCallback' , 'start' ) ; //error, remove cached entry, reject the promise if ( err ) { debug ( 'handleConnectionCallback' , 'error' , err ) ; delete promises [ key ] ; return reject ( err ) ; } //patch close method for caching shadowClose ( connection ) ; //create a reference to the original connection for cleanup connection . _mssqlngKey = key ; //add connection to the pool connections [ connection . _mssqlngKey ] = connection ; //resolve the promise debug ( 'handleConnectionCallback' , 'success' ) ; return resolve ( connection ) ; }
handle promise resolution for connection callback
handle promise resolution for connection callback