Software /
code /
prosody
Diff
plugins/mod_storage_sql2.lua @ 6740:99b3f29c3c71
Merge with 0.10
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 24 Jun 2015 23:25:42 +0100 |
parent | 6739:6216743c188c |
parent | 6728:db28b8639737 |
child | 6745:6728ad041761 |
child | 6746:5e8a8319699d |
line wrap: on
line diff
--- a/plugins/mod_storage_sql2.lua Wed Jun 24 23:24:32 2015 +0100 +++ b/plugins/mod_storage_sql2.lua Wed Jun 24 23:25:42 2015 +0100 @@ -126,10 +126,13 @@ --- 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 @@ 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 @@ 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