Skip to content

Commit

Permalink
Merge pull request #396 from conveyal/add-route-gtfs-id-to-patternsto…
Browse files Browse the repository at this point in the history
…p-error

Add route GTFS shortnames to pattern stop error message
  • Loading branch information
philip-cline authored Sep 27, 2023
2 parents c348533 + d246963 commit 91b0518
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/main/java/com/conveyal/gtfs/loader/JdbcTableWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -1483,6 +1483,11 @@ private String[] parseExceptionListField(int id, String namespace, Table table,
return parsedString.replaceAll("[{}]", "").split("[,]", 0);
}

private String getResultSetString(int column, ResultSet resultSet) throws java.sql.SQLException {
String resultSetString = resultSet.getString(column);
return resultSetString == null ? "" : resultSetString;
}

/**
* Delete all entries in calendar dates associated with a schedule exception.
*/
Expand Down Expand Up @@ -1579,7 +1584,7 @@ private void updateReferencingTables(
connection.rollback();
if (entityClass.getSimpleName().equals("Stop")) {
String patternStopLookup = String.format(
"select distinct p.id, r.id " +
"select distinct p.id, r.id, r.route_short_name, r.route_id " +
"from %s.pattern_stops ps " +
"inner join " +
"%s.patterns p " +
Expand All @@ -1599,7 +1604,12 @@ private void updateReferencingTables(
ResultSet resultSet = patternStopSelectStatement.getResultSet();
while (resultSet.next()) {
patternAndRouteIds.add(
"{" + resultSet.getString(1) + "-" + resultSet.getString(2) + "}"
String.format("{%s-%s-%s-%s}",
getResultSetString(1, resultSet),
getResultSetString(2, resultSet),
getResultSetString(3, resultSet),
getResultSetString(4, resultSet)
)
);
}
}
Expand Down

0 comments on commit 91b0518

Please sign in to comment.