mirror of
https://github.com/appgurueu/modlib.git
synced 2024-11-25 00:33:44 +01:00
SQLite3 persistence: Wrap :set in a transaction
This commit is contained in:
parent
318e737a08
commit
597666f3e3
@ -240,6 +240,7 @@ function ptab:rewrite()
|
||||
end
|
||||
|
||||
function ptab:set(table, key, value)
|
||||
exec(self, "BEGIN EXCLUSIVE TRANSACTION")
|
||||
local previous_value = table[key]
|
||||
if previous_value == value then
|
||||
-- no change
|
||||
@ -247,6 +248,7 @@ function ptab:set(table, key, value)
|
||||
end
|
||||
set(self, table, key, value)
|
||||
table[key] = value
|
||||
exec(self, "COMMIT TRANSACTION")
|
||||
end
|
||||
|
||||
function ptab:set_root(key, value)
|
||||
|
Loading…
Reference in New Issue
Block a user