mod_storage_sql: Add some TODO comments for future UPSERT work
authorKim Alvefur <zash@zash.se>
Sun, 11 Jun 2023 20:25:50 +0200
changeset 13155 7ebb3d6afcd1
parent 13154 9e6ede86d35d
child 13156 792f360a582b
mod_storage_sql: Add some TODO comments for future UPSERT work
plugins/mod_storage_sql.lua
--- a/plugins/mod_storage_sql.lua	Sun Jun 11 20:05:32 2023 +0200
+++ b/plugins/mod_storage_sql.lua	Sun Jun 11 20:25:50 2023 +0200
@@ -217,6 +217,7 @@
 		LIMIT 1;
 		]];
 		for key, data in pairs(keydatas) do
+			-- TODO Test UPSERT in PostgreSQL before enabling it.
 			if type(key) == "string" and key ~= "" and engine.params.driver == "SQLite3" and data ~= self.remove then
 				local t, value = assert(serialize(data));
 				engine:insert(upsert_sql, host, username or "", self.store, key, t, value, t, value);
@@ -348,6 +349,7 @@
 		VALUES (?,?,?,?,?,?,?,?);
 		]];
 		if key then
+			-- TODO use UPSERT like map store
 			local result = engine:delete(delete_sql, host, user or "", store, key);
 			if result and item_count then
 				item_count = item_count - result:affected();