Software /
code /
prosody
Changeset
10002:b6b5b9d7417d
mod_storage_sql: Add support for iterating over users in archive stores
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 05 May 2019 16:26:01 +0200 |
parents | 10001:55f5588d71c6 |
children | 10003:4d702f0c6273 |
files | plugins/mod_storage_sql.lua |
diffstat | 1 files changed, 13 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_storage_sql.lua Sun May 05 16:07:16 2019 +0200 +++ b/plugins/mod_storage_sql.lua Sun May 05 16:26:01 2019 +0200 @@ -509,6 +509,19 @@ 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;