Skip to content

Commit

Permalink
refactor(JdbcTableWriter): allow nulls
Browse files Browse the repository at this point in the history
  • Loading branch information
philip-cline committed Sep 26, 2023
1 parent b685f83 commit a7bcafc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/java/com/conveyal/gtfs/loader/JdbcTableWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -1483,6 +1483,10 @@ 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 {
return resultSet.getString(column) == null ? "" : resultSet.getString(resultSet.getString(1) == null ? "" : resultSet.getString(1));
}

/**
* Delete all entries in calendar dates associated with a schedule exception.
*/
Expand Down Expand Up @@ -1599,7 +1603,7 @@ private void updateReferencingTables(
ResultSet resultSet = patternStopSelectStatement.getResultSet();
while (resultSet.next()) {
patternAndRouteIds.add(
"{" + resultSet.getString(1) + "-" + resultSet.getString(2) + "-" + resultSet.getString(3) + "-" + resultSet.getString(3) + "}"
"{" + getResultSetString(1, resultSet) + "-" + getResultSetString(2, resultSet) + "-" + getResultSetString(3, resultSet)+ "-" + getResultSetString(4, resultSet) + "}"
);
}
}
Expand Down

0 comments on commit a7bcafc

Please sign in to comment.