Skip to content

Commit

Permalink
Add sizeOfStopTimes query (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
ksharma-xyz authored Sep 6, 2024
1 parent 12f210a commit d87b70c
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
9 changes: 1 addition & 8 deletions app/src/main/java/xyz/ksharma/krail/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,8 @@ class MainActivity : ComponentActivity() {
val diff = ChronoUnit.SECONDS.between(startTime, endTime)
Timber.d("Time taken - $diff")

/*
val dataSize = realSydneyTrainsStaticDb.getStopTimes().size
val dataSize = realSydneyTrainsStaticDb.stopTimesSize()
Timber.d("DATA SIZE: $dataSize")
*/
/*
realSydneyTrainsStaticDb.insertStopTimes()
val x = realSydneyTrainsStaticDb.getStopTimes()
Timber.d("$x")
*/
}

setContent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ interface SydneyTrainsStaticDB {
suspend fun getStopTimes(): List<StopTimes>

suspend fun insertStopTimesBatch(stopTimesList: List<StopTimes>)

suspend fun stopTimesSize(): Long
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ VALUES (?, ?, ?, ?, ?, ?, ?, ?);

selectAll:
SELECT * FROM stopTimes;

sizeOfStopTimes:
SELECT COUNT(*) FROM stopTimes;
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ class RealSydneyTrainsStaticDb @Inject constructor(
}
}

override suspend fun stopTimesSize(): Long = getSydneyTrainsDb().stoptimesQueries.sizeOfStopTimes().executeAsOne()

override suspend fun clearStopTimes() {
TODO("Not yet implemented")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ object StopTimesParser {
while (true) {
line = reader.readLine() ?: break

val fieldsList = line.split(",").map { it.trim('\"') }
val fieldsList = line.split(",").trimQuotes()

stopTimesList.add(
StopTimes(
Expand Down

0 comments on commit d87b70c

Please sign in to comment.