Format CacheExporter

Signed-off-by: Graham <gpe@openrs2.org>
master
Graham 3 years ago
parent 1a78ef3c7d
commit 5c77ee4bd2
  1. 14
      archive/src/main/kotlin/org/openrs2/archive/cache/CacheExporter.kt

@ -375,7 +375,8 @@ public class CacheExporter @Inject constructor(
public suspend fun getFileName(id: Int): String? {
return database.execute { connection ->
// TODO(gpe): what if a cache is from multiple games?
connection.prepareStatement("""
connection.prepareStatement(
"""
SELECT
g.name AS game,
e.name AS environment,
@ -390,7 +391,8 @@ public class CacheExporter @Inject constructor(
WHERE s.cache_id = ?
GROUP BY g.name, e.name, l.iso_code
LIMIT 1
""".trimIndent()).use { stmt ->
""".trimIndent()
).use { stmt ->
stmt.setInt(1, id)
stmt.executeQuery().use { rows ->
@ -413,9 +415,11 @@ public class CacheExporter @Inject constructor(
val timestamp = rows.getTimestamp(5)
if (!rows.wasNull()) {
name.append('-')
name.append(timestamp.toInstant()
.atOffset(ZoneOffset.UTC)
.format(DateTimeFormatter.ofPattern("yyyy-MM-dd-HH-mm-ss")))
name.append(
timestamp.toInstant()
.atOffset(ZoneOffset.UTC)
.format(DateTimeFormatter.ofPattern("yyyy-MM-dd-HH-mm-ss"))
)
}
name.append("-openrs2#")

Loading…
Cancel
Save