Software /
code /
prosody
Diff
plugins/mod_storage_sql.lua @ 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 |
parent | 9904:bf061f5512f7 |
child | 10017:994cccebb597 |
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;