lib/connection/statement.js
function buildResultRequestCallback(
    statementContext, headers, onResultAvailable)
{
  var callback = function(err, body)
  {
    // if the result is not ready yet, extract the result url from the response
    // and issue a GET request to try to fetch the result again
    if (!err && body && (body.code === '333333' || body.code === '333334'))
    {
      // extract the statement id from the response and save it
      statementContext.statementId = body.data.queryId;

      // extract the result url from the response and try to get the result
      // again
      sendSfRequest(statementContext,
      {
        method   : 'GET',
        headers  : headers,
        url      : body.data.getResultUrl,
        callback : callback
      });
    }
    else
    {
      onResultAvailable.call(null, err, body);
    }
  };

  return callback;
}
function buildResultRequestCallback(
    statementContext, headers, onResultAvailable)
{
  var callback = function(err, body)
  {
    // if the result is not ready yet, extract the result url from the response
    // and issue a GET request to try to fetch the result again
    if (!err && body && (body.code === '333333' || body.code === '333334'))
    {
      // extract the statement id from the response and save it
      statementContext.statementId = body.data.queryId;

      // extract the result url from the response and try to get the result
      // again
      sendSfRequest(statementContext,
      {
        method   : 'GET',
        headers  : headers,
        url      : body.data.getResultUrl,
        callback : callback
      });
    }
    else
    {
      onResultAvailable.call(null, err, body);
    }
  };

  return callback;
}
function buildResultRequestCallback ( statementContext , headers , onResultAvailable ) { var callback = function ( err , body ) { // if the result is not ready yet, extract the result url from the response // and issue a GET request to try to fetch the result again if ( ! err && body && ( body . code === '333333' || body . code === '333334' ) ) { // extract the statement id from the response and save it statementContext . statementId = body . data . queryId ; // extract the result url from the response and try to get the result // again sendSfRequest ( statementContext , { method : 'GET' , headers : headers , url : body . data . getResultUrl , callback : callback } ) ; } else { onResultAvailable . call ( null , err , body ) ; } } ; return callback ; }
Builds a callback for use in an exec-statement or fetch-result request.

@param statementContext
@param headers
@param onResultAvailable

@returns {Function}
Builds a callback for use in an exec - statement or fetch - result request .