Comparison

plugins/mod_storage_sql.lua @ 13221:2a9ce229efac

mod_storage_sql: Allow higher precision timestamps in SQLite3 Since it doesn't actually do strict typing :)
author Kim Alvefur <zash@zash.se>
date Mon, 17 Jul 2023 04:52:50 +0200
parent 13213:50324f66ca2a
child 13222:cb6a17eaa0e6
comparison
equal deleted inserted replaced
13220:56decf85db1d 13221:2a9ce229efac
333 return nil, "quota-limit"; 333 return nil, "quota-limit";
334 end 334 end
335 end 335 end
336 336
337 -- FIXME update the schema to allow precision timestamps 337 -- FIXME update the schema to allow precision timestamps
338 when = when and math.floor(when) or os.time(); 338 when = when or os.time();
339 if engine.params.driver ~= "SQLite3" then
340 -- SQLite3 doesn't enforce types :)
341 when = math.floor(when);
342 end
339 with = with or ""; 343 with = with or "";
340 local ok, ret = engine:transaction(function() 344 local ok, ret = engine:transaction(function()
341 local delete_sql = [[ 345 local delete_sql = [[
342 DELETE FROM "prosodyarchive" 346 DELETE FROM "prosodyarchive"
343 WHERE "host"=? AND "user"=? AND "store"=? AND "key"=?; 347 WHERE "host"=? AND "user"=? AND "store"=? AND "key"=?;