Skip to content

Commit 70962a0

Browse files
committed
Auto merge of #631 - Mark-Simulacrum:autopurge, r=Mark-Simulacrum
Fix compatibility with an sqlite without delete limit support
2 parents 6ff4468 + 0799622 commit 70962a0

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/results/db.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,16 @@ impl<'a> DatabaseDB<'a> {
5353
// tables as this is just simpler and the results dominate the storage
5454
// size anyway. In the future we might expand this to other tables, but
5555
// for now that wouldn't really add enough value to be worth it.
56+
//
57+
// The query here would be simpler if rusqlite came with delete .. limit
58+
// support compiled in, but that's not likely to happen (see
59+
// https://github.com/rusqlite/rusqlite/issues/1111).
5660
self.db.execute(
57-
"delete from results where experiment in (select name from experiments where status = 'completed') limit 100",
61+
"delete from results where rowid in (
62+
select rowid from results where \
63+
experiment in (select name from experiments where status = 'completed') \
64+
limit 100
65+
)",
5866
&[],
5967
)?;
6068
Ok(())

0 commit comments

Comments
 (0)