diff options
author | Matthew Wild <mwild1@gmail.com> | 2015-06-24 23:25:42 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2015-06-24 23:25:42 +0100 |
commit | ccfc7900288dc532248ef19aa5f391c2616e4264 (patch) | |
tree | c3a512e02be8ed2296e8c10b92e7b68c33de8ee8 /plugins | |
parent | 78cab72c6ab519accbde9ae83bee734476f1bf29 (diff) | |
parent | 1c3f1e910f9be92570e45cd09f5a0063699748c7 (diff) | |
download | prosody-ccfc7900288dc532248ef19aa5f391c2616e4264.tar.gz prosody-ccfc7900288dc532248ef19aa5f391c2616e4264.zip |
Merge with 0.10
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_storage_sql2.lua | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/plugins/mod_storage_sql2.lua b/plugins/mod_storage_sql2.lua index 5411e500..7c797447 100644 --- a/plugins/mod_storage_sql2.lua +++ b/plugins/mod_storage_sql2.lua @@ -126,10 +126,13 @@ end --- Archive store API 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 + when, with, value = value, when, with; end local user,store = username,self.store; return engine:transaction(function() @@ -192,7 +195,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` = ?", }; @@ -224,7 +227,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 |