Software /
code /
prosody
Comparison
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 |
comparison
equal
deleted
inserted
replaced
10001:55f5588d71c6 | 10002:b6b5b9d7417d |
---|---|
507 local cache_key = jid_join(username, host, self.store); | 507 local cache_key = jid_join(username, host, self.store); |
508 archive_item_count_cache:set(cache_key, nil); | 508 archive_item_count_cache:set(cache_key, nil); |
509 return ok and stmt:affected(), stmt; | 509 return ok and stmt:affected(), stmt; |
510 end | 510 end |
511 | 511 |
512 function archive_store:users() | |
513 local ok, result = engine:transaction(function() | |
514 local select_sql = [[ | |
515 SELECT DISTINCT "user" | |
516 FROM "prosodyarchive" | |
517 WHERE "host"=? AND "store"=?; | |
518 ]]; | |
519 return engine:select(select_sql, host, self.store); | |
520 end); | |
521 if not ok then error(result); end | |
522 return iterator(result); | |
523 end | |
524 | |
512 local stores = { | 525 local stores = { |
513 keyval = keyval_store; | 526 keyval = keyval_store; |
514 map = map_store; | 527 map = map_store; |
515 archive = archive_store; | 528 archive = archive_store; |
516 }; | 529 }; |