Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/main/java/org/mtransit/commons/FeatureFlags.kt
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,8 @@ object FeatureFlags {
// const val F_USE_TRIP_IS_FOR_SERVICE_UPDATES = false
const val F_USE_TRIP_IS_FOR_SERVICE_UPDATES = true // WIP

const val F_EXPORT_DIRECTION_STOP_LAST = false
// const val F_EXPORT_DIRECTION_STOP_LAST = true // WIP

// @formatter:on
}
7 changes: 7 additions & 0 deletions src/main/java/org/mtransit/commons/GTFSCommons.kt
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ object GTFSCommons {
const val T_DIRECTION_STOPS_K_STOP_ID = "stop_id"
const val T_DIRECTION_STOPS_K_STOP_SEQUENCE = "stop_sequence"
const val T_DIRECTION_STOPS_K_NO_PICKUP = "decent_only"
const val T_DIRECTION_STOPS_K_ALWAYS_LAST_TRIP_STOP = "last_stop"

@JvmStatic
val T_DIRECTION_STOPS_SQL_CREATE = SQLCreateBuilder.getNew(T_DIRECTION_STOPS).apply {
Expand All @@ -221,6 +222,9 @@ object GTFSCommons {
appendColumn(T_DIRECTION_STOPS_K_STOP_ID, SQLUtils.INT)
appendColumn(T_DIRECTION_STOPS_K_STOP_SEQUENCE, SQLUtils.INT)
appendColumn(T_DIRECTION_STOPS_K_NO_PICKUP, SQLUtils.INT)
if (FeatureFlags.F_EXPORT_DIRECTION_STOP_LAST) {
appendColumn(T_DIRECTION_STOPS_K_ALWAYS_LAST_TRIP_STOP, SQLUtils.INT) // as BOOLEAN
}
appendForeignKey(T_DIRECTION_STOPS_K_DIRECTION_ID, T_DIRECTION, T_DIRECTION_K_ID)
appendForeignKey(T_DIRECTION_STOPS_K_STOP_ID, T_STOP, T_STOP_K_ID)
}.build()
Expand All @@ -231,6 +235,9 @@ object GTFSCommons {
appendColumn(T_DIRECTION_STOPS_K_STOP_ID)
appendColumn(T_DIRECTION_STOPS_K_STOP_SEQUENCE)
appendColumn(T_DIRECTION_STOPS_K_NO_PICKUP)
if (FeatureFlags.F_EXPORT_DIRECTION_STOP_LAST) {
appendColumn(T_DIRECTION_STOPS_K_ALWAYS_LAST_TRIP_STOP)
}
}.build()

@JvmStatic
Expand Down
8 changes: 2 additions & 6 deletions src/main/java/org/mtransit/commons/sql/SQLExt.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,9 @@ import java.sql.ResultSet
import java.sql.SQLException
import java.sql.Statement

fun Boolean.toSQL(): Int {
return SQLUtils.toSQLBoolean(this)
}
fun Boolean.toSQL(): Int = SQLUtils.toSQLBoolean(this)

fun Int.fromSQL(): Boolean {
return SQLUtils.fromSQLBoolean(this)
}
fun Int.fromSQL(): Boolean = SQLUtils.fromSQLBoolean(this)

fun ResultSet.getStringOrNull(columnLabel: String) = this.getString(columnLabel).takeIf { it != SQL_NULL }?.takeIf { it.isNotBlank() }

Expand Down