diff options
author | Kim Alvefur <zash@zash.se> | 2019-05-05 16:26:01 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2019-05-05 16:26:01 +0200 |
commit | 696da1f571e723216a1e6b74d793eed4fe98dbd8 (patch) | |
tree | 65fec0bca3f59d8b78c60b263118ae65d839c95c /plugins | |
parent | 017e7f74389c0e20a1baaae682fd85b825975592 (diff) | |
download | prosody-696da1f571e723216a1e6b74d793eed4fe98dbd8.tar.gz prosody-696da1f571e723216a1e6b74d793eed4fe98dbd8.zip |
mod_storage_sql: Add support for iterating over users in archive stores
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_storage_sql.lua | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/plugins/mod_storage_sql.lua b/plugins/mod_storage_sql.lua index ffe48ab8..596687ae 100644 --- a/plugins/mod_storage_sql.lua +++ b/plugins/mod_storage_sql.lua @@ -509,6 +509,19 @@ function archive_store:delete(username, query) return ok and stmt:affected(), stmt; end +function archive_store:users() + local ok, result = engine:transaction(function() + local select_sql = [[ + SELECT DISTINCT "user" + FROM "prosodyarchive" + WHERE "host"=? AND "store"=?; + ]]; + return engine:select(select_sql, host, self.store); + end); + if not ok then error(result); end + return iterator(result); +end + local stores = { keyval = keyval_store; map = map_store; |