aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2015-05-19 23:23:44 +0200
committerKim Alvefur <zash@zash.se>2015-05-19 23:23:44 +0200
commit022944ecc4e5d4d8ece338f05eb8fe4366c11155 (patch)
tree97a0b19f4d7e35f96455b0bd3b5c47457c88ff74
parent326cc2e44d412a5a9ea46309bf923282220cf0b6 (diff)
parent720a6a5deb52fbc3944bb7a9a5f46a3dd33f46f8 (diff)
downloadprosody-022944ecc4e5d4d8ece338f05eb8fe4366c11155.tar.gz
prosody-022944ecc4e5d4d8ece338f05eb8fe4366c11155.zip
Merge 0.10->trunk
-rw-r--r--plugins/mod_storage_sql2.lua13
1 files changed, 8 insertions, 5 deletions
diff --git a/plugins/mod_storage_sql2.lua b/plugins/mod_storage_sql2.lua
index a637c9dc..8d5d948b 100644
--- a/plugins/mod_storage_sql2.lua
+++ b/plugins/mod_storage_sql2.lua
@@ -248,10 +248,13 @@ function map_store:set(username, key, data)
end
local archive_store = {}
+archive_store.caps = {
+ total = true;
+};
archive_store.__index = archive_store
-function archive_store:append(username, key, when, with, value)
- if value == nil then -- COMPAT early versions
- when, with, value, key = key, when, with, value
+function archive_store:append(username, key, value, when, with)
+ if type(when) ~= "number" then
+ value, when, with = when, with, value;
end
local user,store = username,self.store;
return engine:transaction(function()
@@ -314,7 +317,7 @@ function archive_store:find(username, query)
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` = ?", };
@@ -346,7 +349,7 @@ function archive_store:find(username, query)
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