src/main/java/com/conveyal/gtfs/loader/JdbcTableWriter.java
private int updateStopTimesForPatternStop(ObjectNode patternStop, int previousTravelTime) throws SQLException {
        String sql = String.format(
            "update %s.stop_times st set arrival_time = ?, departure_time = ? from %s.trips t " +
                "where st.trip_id = t.trip_id AND t.pattern_id = ? AND st.stop_sequence = ?",
            tablePrefix,
            tablePrefix
        );
        // Prepare the statement and set statement parameters
        PreparedStatement statement = connection.prepareStatement(sql);
        int oneBasedIndex = 1;
        int travelTime = patternStop.get("default_travel_time").asInt();
        int arrivalTime = previousTravelTime + travelTime;
        statement.setInt(oneBasedIndex++, arrivalTime);
        int dwellTime = patternStop.get("default_dwell_time").asInt();
        statement.setInt(oneBasedIndex++, arrivalTime + dwellTime);
        // Set "where clause" with value for pattern_id and stop_sequence
        statement.setString(oneBasedIndex++, patternStop.get("pattern_id").asText());
        // In the editor, we can depend on stop_times#stop_sequence matching pattern_stops#stop_sequence because we
        // normalize stop sequence values for stop times during snapshotting for the editor.
        statement.setInt(oneBasedIndex++, patternStop.get("stop_sequence").asInt());
        // Log query, execute statement, and log result.
        LOG.debug(statement.toString());
        int entitiesUpdated = statement.executeUpdate();
        LOG.debug("{} stop_time arrivals/departures updated", entitiesUpdated);
        return travelTime + dwellTime;
    }
private int updateStopTimesForPatternStop(ObjectNode patternStop, int previousTravelTime) throws SQLException {
        String sql = String.format(
            "update %s.stop_times st set arrival_time = ?, departure_time = ? from %s.trips t " +
                "where st.trip_id = t.trip_id AND t.pattern_id = ? AND st.stop_sequence = ?",
            tablePrefix,
            tablePrefix
        );
        // Prepare the statement and set statement parameters
        PreparedStatement statement = connection.prepareStatement(sql);
        int oneBasedIndex = 1;
        int travelTime = patternStop.get("default_travel_time").asInt();
        int arrivalTime = previousTravelTime + travelTime;
        statement.setInt(oneBasedIndex++, arrivalTime);
        int dwellTime = patternStop.get("default_dwell_time").asInt();
        statement.setInt(oneBasedIndex++, arrivalTime + dwellTime);
        // Set "where clause" with value for pattern_id and stop_sequence
        statement.setString(oneBasedIndex++, patternStop.get("pattern_id").asText());
        // In the editor, we can depend on stop_times#stop_sequence matching pattern_stops#stop_sequence because we
        // normalize stop sequence values for stop times during snapshotting for the editor.
        statement.setInt(oneBasedIndex++, patternStop.get("stop_sequence").asInt());
        // Log query, execute statement, and log result.
        LOG.debug(statement.toString());
        int entitiesUpdated = statement.executeUpdate();
        LOG.debug("{} stop_time arrivals/departures updated", entitiesUpdated);
        return travelTime + dwellTime;
    }
private int updateStopTimesForPatternStop ( ObjectNode patternStop , int previousTravelTime ) throws SQLException { String sql = String . format ( "update %s.stop_times st set arrival_time = ?, departure_time = ? from %s.trips t " + "where st.trip_id = t.trip_id AND t.pattern_id = ? AND st.stop_sequence = ?" , tablePrefix , tablePrefix ) ; // Prepare the statement and set statement parameters PreparedStatement statement = connection . prepareStatement ( sql ) ; int oneBasedIndex = 1 ; int travelTime = patternStop . get ( "default_travel_time" ) . asInt ( ) ; int arrivalTime = previousTravelTime + travelTime ; statement . setInt ( oneBasedIndex ++ , arrivalTime ) ; int dwellTime = patternStop . get ( "default_dwell_time" ) . asInt ( ) ; statement . setInt ( oneBasedIndex ++ , arrivalTime + dwellTime ) ; // Set "where clause" with value for pattern_id and stop_sequence statement . setString ( oneBasedIndex ++ , patternStop . get ( "pattern_id" ) . asText ( ) ) ; // In the editor, we can depend on stop_times#stop_sequence matching pattern_stops#stop_sequence because we // normalize stop sequence values for stop times during snapshotting for the editor. statement . setInt ( oneBasedIndex ++ , patternStop . get ( "stop_sequence" ) . asInt ( ) ) ; // Log query, execute statement, and log result. LOG . debug ( statement . toString ( ) ) ; int entitiesUpdated = statement . executeUpdate ( ) ; LOG . debug ( "{} stop_time arrivals/departures updated" , entitiesUpdated ) ; return travelTime + dwellTime ; }
Updates the stop times that reference the specified pattern stop.
@param patternStop the pattern stop for which to update stop times
@param previousTravelTime the travel time accumulated up to the previous stop_time's departure time (or the
previous pattern stop's dwell time)
@return the travel and dwell time added by this pattern stop
@throws SQLException
Updates the stop times that reference the specified pattern stop .