X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=plugins%2Fmod_storage_sql2.lua;h=21299f334f9bc932f3f051ad67b49856611d2780;hb=41af377cf0cda243c3c1bfa6231b4276dfacbc79;hp=d5e0494faf5636f18a0dc0eb43fca331332a57b8;hpb=a3ca7e93a3af9f8f10592d1ad416fe183a07ca60;p=prosody.git diff --git a/plugins/mod_storage_sql2.lua b/plugins/mod_storage_sql2.lua index d5e0494f..21299f33 100644 --- a/plugins/mod_storage_sql2.lua +++ b/plugins/mod_storage_sql2.lua @@ -215,10 +215,13 @@ function keyval_store:users() 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() @@ -281,7 +284,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` = ?", }; @@ -313,7 +316,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