Diff

plugins/mod_storage_sql2.lua @ 6724:a8dbfa14e1a8

mod_storage_sql2: Include 'with' field from iterator like some 3rd party archive-capable storage modules
author Kim Alvefur <zash@zash.se>
date Tue, 19 May 2015 18:21:23 +0200
parent 6532:a966efeb6cb3
child 6725:41725f3df3cc
line wrap: on
line diff
--- a/plugins/mod_storage_sql2.lua	Tue May 19 15:33:20 2015 +0200
+++ b/plugins/mod_storage_sql2.lua	Tue May 19 18:21:23 2015 +0200
@@ -281,7 +281,7 @@
 	local user,store = username,self.store;
 	local total;
 	local ok, result = engine:transaction(function()
-		local sql_query = "SELECT `key`, `type`, `value`, `when` FROM `prosodyarchive` WHERE %s ORDER BY `sort_id` %s%s;";
+		local sql_query = "SELECT `key`, `type`, `value`, `when`, `with` FROM `prosodyarchive` WHERE %s ORDER BY `sort_id` %s%s;";
 		local args = { host, user or "", store, };
 		local where = { "`host` = ?", "`user` = ?", "`store` = ?", };
 
@@ -313,7 +313,7 @@
 	return function()
 		local row = result();
 		if row ~= nil then
-			return row[1], deserialize(row[2], row[3]), row[4];
+			return row[1], deserialize(row[2], row[3]), row[4], row[5];
 		end
 	end, total;
 end