Skip to content

Commit

Permalink
mGTFS > fix update trips
Browse files Browse the repository at this point in the history
  • Loading branch information
mmathieum committed Dec 10, 2024
1 parent 124bebb commit 4d51544
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/java/org/mtransit/commons/gtfs/sql/TripSQL.kt
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,10 @@ object TripSQL : CommonSQL<Trip>(), TableSQL {
val sql = buildString {
append("UPDATE $T_TRIP ")
append("SET $T_TRIP_K_DIRECTION_ID = $directionId ")
append("JOIN $T_TRIP_IDS ON $T_TRIP.$T_TRIP_K_ID_INT = $T_TRIP_IDS.$T_TRIP_IDS_K_ID_INT ")
append("WHERE $T_TRIP_IDS.$T_TRIP_IDS_K_ID IN (${tripIds.joinToString { SQLUtils.escape(it) }})")
append("WHERE EXISTS ( ")
append("SELECT 1 FROM $T_TRIP, $T_TRIP_IDS WHERE $T_TRIP.$T_TRIP_K_ID_INT = $T_TRIP_IDS.$T_TRIP_IDS_K_ID_INT ")
append("AND $T_TRIP_IDS.$T_TRIP_IDS_K_ID IN (${tripIds.joinToString { SQLUtils.escape(it) }}) ")
append(")")
}
return statement.executeUpdate(sql) > 0
}
Expand Down

0 comments on commit 4d51544

Please sign in to comment.