Add lengths and uncompressed checksum to index_groups

Signed-off-by: Graham <gpe@openrs2.org>
bzip2
Graham 4 years ago
parent f90b9df505
commit 6a87159f30
  1. 21
      archive/src/main/kotlin/org/openrs2/archive/cache/CacheImporter.kt
  2. 3
      archive/src/main/resources/org/openrs2/archive/V1__init.sql

@ -427,8 +427,11 @@ public class CacheImporter @Inject constructor(
connection.prepareStatement(
"""
INSERT INTO index_groups (container_id, group_id, crc32, whirlpool, version, name_hash)
VALUES (?, ?, ?, ?, ?, ?)
INSERT INTO index_groups (
container_id, group_id, crc32, whirlpool, version, name_hash, length, uncompressed_length,
uncompressed_crc32
)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
""".trimIndent()
).use { stmt ->
for (group in index.index) {
@ -444,6 +447,20 @@ public class CacheImporter @Inject constructor(
stmt.setNull(6, Types.INTEGER)
}
if (index.index.hasLengths) {
stmt.setInt(7, group.length)
stmt.setInt(8, group.uncompressedLength)
} else {
stmt.setNull(7, Types.INTEGER)
stmt.setNull(8, Types.INTEGER)
}
if (index.index.hasUncompressedChecksums) {
stmt.setInt(9, group.uncompressedChecksum)
} else {
stmt.setNull(9, Types.INTEGER)
}
stmt.addBatch()
}

@ -67,6 +67,9 @@ CREATE TABLE index_groups (
whirlpool BYTEA NULL,
version INTEGER NOT NULL,
name_hash INTEGER NULL,
length INTEGER NULL,
uncompressed_length INTEGER NULL,
uncompressed_crc32 INTEGER NULL,
PRIMARY KEY (container_id, group_id)
);

Loading…
Cancel
Save