Software /
code /
prosody
Diff
plugins/mod_storage_sql.lua @ 5133:1443d1c37c6c
Merge 0.9->trunk
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 19 Sep 2012 12:14:08 +0100 |
parent | 5122:b41c33dc7c36 |
parent | 5132:ce6546f867f9 |
child | 5154:429c8eeea035 |
line wrap: on
line diff
--- a/plugins/mod_storage_sql.lua Thu Sep 13 18:49:25 2012 +0100 +++ b/plugins/mod_storage_sql.lua Wed Sep 19 12:14:08 2012 +0100 @@ -374,10 +374,9 @@ return nil, "unsupported-store"; end -function driver:list_stores(username) -- Not to be confused with the list store type - local sql = (username == true - and "SELECT DISTINCT `store` FROM `prosody` WHERE `host`=? AND `user`!=?" - or "SELECT DISTINCT `store` FROM `prosody` WHERE `host`=? AND `user`=?"); +function driver:stores(username) + local sql = "SELECT DISTINCT `store` FROM `prosody` WHERE `host`=? AND `user`" .. + (username == true and "!=?" or "=?"); if username == true or not username then username = ""; end @@ -385,11 +384,11 @@ if not stmt then return rollback(nil, err); end - local stores = {}; - for row in stmt:rows() do - stores[#stores+1] = row[1]; - end - return commit(stores); + local next = stmt:rows(); + return commit(function() + local row = next(); + return row and row[1]; + end); end function driver:purge(username)