modules/query/CalendarTable.js
function(db, date, callback) {

  // Check cache for service exceptions
  let cacheKey = db.id + "-" + date;
  let cache = cache_serviceExceptionsByDate.get(cacheKey);
  if ( cache !== null ) {
    return callback(null, cache);
  }

  // Array of Service Exceptions to return
  let rtn = [];

  // Get service exceptions from calendar_dates
  let select = "SELECT service_id, date, exception_type " +
    "FROM gtfs_calendar_dates WHERE date=" + date + ";";

  // Query the database
  db.select(select, function(err, results) {

    // Database Query Error
    if ( err ) {
      return callback(err);
    }

    // Parse each row in the results
    for ( let i = 0; i < results.length; i++ ) {
      let row = results[i];

      // Create Service Exception
      let se = new ServiceException(
        row.service_id,
        row.date,
        row.exception_type
      );

      // Add Service Exception to return list
      rtn.push(se);
    }

    // Add Service Exceptions to cache
    cache_serviceExceptionsByDate.put(cacheKey, rtn);

    // Return service exceptions with provided callback
    return callback(null, rtn);

  });

}
function(db, date, callback) {

  // Check cache for service exceptions
  let cacheKey = db.id + "-" + date;
  let cache = cache_serviceExceptionsByDate.get(cacheKey);
  if ( cache !== null ) {
    return callback(null, cache);
  }

  // Array of Service Exceptions to return
  let rtn = [];

  // Get service exceptions from calendar_dates
  let select = "SELECT service_id, date, exception_type " +
    "FROM gtfs_calendar_dates WHERE date=" + date + ";";

  // Query the database
  db.select(select, function(err, results) {

    // Database Query Error
    if ( err ) {
      return callback(err);
    }

    // Parse each row in the results
    for ( let i = 0; i < results.length; i++ ) {
      let row = results[i];

      // Create Service Exception
      let se = new ServiceException(
        row.service_id,
        row.date,
        row.exception_type
      );

      // Add Service Exception to return list
      rtn.push(se);
    }

    // Add Service Exceptions to cache
    cache_serviceExceptionsByDate.put(cacheKey, rtn);

    // Return service exceptions with provided callback
    return callback(null, rtn);

  });

}
function ( db , date , callback ) { // Check cache for service exceptions let cacheKey = db . id + "-" + date ; let cache = cache_serviceExceptionsByDate . get ( cacheKey ) ; if ( cache !== null ) { return callback ( null , cache ) ; } // Array of Service Exceptions to return let rtn = [ ] ; // Get service exceptions from calendar_dates let select = "SELECT service_id, date, exception_type " + "FROM gtfs_calendar_dates WHERE date=" + date + ";" ; // Query the database db . select ( select , function ( err , results ) { // Database Query Error if ( err ) { return callback ( err ) ; } // Parse each row in the results for ( let i = 0 ; i < results . length ; i ++ ) { let row = results [ i ] ; // Create Service Exception let se = new ServiceException ( row . service_id , row . date , row . exception_type ) ; // Add Service Exception to return list rtn . push ( se ) ; } // Add Service Exceptions to cache cache_serviceExceptionsByDate . put ( cacheKey , rtn ) ; // Return service exceptions with provided callback return callback ( null , rtn ) ; } ) ; }
Get the Service Exceptions in effect on the specified date.  This includes
Services that are either added or removed on the specified date.

@param {RightTrackDB} db The Right Track Database to query
@param {int} date The date to query (yyyymmdd)
@param {function} callback Callback function
@param {Error} callback.error Database Query Error
@param {ServiceException[]} callback.services The selected Service Exceptions
Get the Service Exceptions in effect on the specified date . This includes Services that are either added or removed on the specified date .