Fix all_checksums() for media import

Entries of deleted files are nulled, not removed.
This commit is contained in:
RumovZ 2022-04-25 08:24:11 +02:00
parent c316996a23
commit e6dbe5b7f8

View file

@ -222,10 +222,10 @@ delete from media where fname=?"
Ok(map?) Ok(map?)
} }
/// Error if any checksums are missing or broken. /// Returns all filenames and checksums, where the checksum is not null.
pub(super) fn all_checksums(&mut self) -> Result<HashMap<String, [u8; 20]>> { pub(super) fn all_checksums(&mut self) -> Result<HashMap<String, [u8; 20]>> {
self.db self.db
.prepare("SELECT fname, csum FROM media")? .prepare("SELECT fname, csum FROM media WHERE csum IS NOT NULL")?
.query_and_then([], row_to_name_and_checksum)? .query_and_then([], row_to_name_and_checksum)?
.collect() .collect()
} }