code: function(pool, sql, values, isBatch) {
      if (closed) {
        return Promise.reject(
          Errors.createError(
            'pool is closed',
            false,
            null,
            'HY000',
            Errors.ER_POOL_ALREADY_CLOSED,
            undefined,
            false
          )
        );
      }
  
      return getIdleValidConnection(pool).then(
        conn => processTask(conn, sql, values, isBatch),
        () => {
          //no idle connection available
          //create a new connection if limit is not reached
          ensurePoolSize(pool);
  
          //connections are all used, stack demand.
          return new Promise((resolve, reject) => {
            const task = {
              timeout: Date.now() + opts.acquireTimeout,
              reject: reject,
              resolve: resolve,
              sql: sql,
              values: values,
              isBatch: isBatch
            };
            if (!firstTaskTimeout) {
              firstTaskTimeout = setTimeout(
                rejectAndResetTimeout,
                opts.acquireTimeout,
                task
              );
            }
            taskQueue.push(task);
          });
        }
      );
    }
docs: ***************************************************************** internal methods ***************************************************************** 
  Get a connection from pool / execute query
  
  @param pool      current pool
  @param sql       sql value (not mandatory)
  @param values    sql parameter (not mandatory)
  @param isBatch   is batch request
  @return {*}