mod_storage_sql: Allow higher precision timestamps in SQLite3
authorKim Alvefur <zash@zash.se>
Mon, 17 Jul 2023 04:52:50 +0200
changeset 13225 2a9ce229efac
parent 13224 56decf85db1d
child 13226 cb6a17eaa0e6
mod_storage_sql: Allow higher precision timestamps in SQLite3 Since it doesn't actually do strict typing :)
plugins/mod_storage_sql.lua
--- a/plugins/mod_storage_sql.lua	Mon Jul 17 14:57:27 2023 +0200
+++ b/plugins/mod_storage_sql.lua	Mon Jul 17 04:52:50 2023 +0200
@@ -335,7 +335,11 @@
 	end
 
 	-- FIXME update the schema to allow precision timestamps
-	when = when and math.floor(when) or os.time();
+	when = when or os.time();
+	if engine.params.driver ~= "SQLite3" then
+		-- SQLite3 doesn't enforce types :)
+		when = math.floor(when);
+	end
 	with = with or "";
 	local ok, ret = engine:transaction(function()
 		local delete_sql = [[