public static int getNextStop(int busStop, int route)
  {
    if (busStop == 0) throw new InvalidQueryException("Nonexistent bus stop");
    if (route   == 0) throw new InvalidQueryException("Nonexistent route");
    database db       = database.busDatabase;
    String   source   = "path As path1 Inner Join path As path2 On (path1.sequence + 1 = path2.sequence)";
    String   criteria = "path1.route = " + route + " And path2.route = " + route + " And path1.bus_stop = " + busStop;
    db.select("path2.bus_stop", source, criteria, "");
    if (db.move_first()) return (Integer)db.get_field("path2.bus_stop"); else return 0;
  }