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 | 40040cdfbca7a934bb5e1256a9fdd403350eeaae (patch) | |
tree | 65fec0bca3f59d8b78c60b263118ae65d839c95c | |
parent | ef95de88710184351f130090685c5bc7ae7fbcaf (diff) | |
download | prosody-40040cdfbca7a934bb5e1256a9fdd403350eeaae.tar.gz prosody-40040cdfbca7a934bb5e1256a9fdd403350eeaae.zip |
mod_storage_sql: Add support for iterating over users in archive stores
-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; |