SQLite persistence: Wrap rewrite in transaction

master
Lars Mueller 2022-03-01 12:03:56 +01:00
parent 5bce5c79cc
commit b7ae328aab
1 changed files with 2 additions and 0 deletions

View File

@ -230,11 +230,13 @@ CREATE TABLE IF NOT EXISTS table_entries (
end
function ptab:rewrite()
exec(self, "BEGIN EXCLUSIVE TRANSACTION")
exec(self, "DELETE FROM table_entries")
self.highest_table_id = 0
self.table_ids = {}
self.counts = {}
add_table(self, self.root)
exec(self, "COMMIT TRANSACTION")
end
function ptab:set(table, key, value)