Software /
code /
prosody
Diff
plugins/mod_storage_sql.lua @ 5055:d466d2088a61
mod_storage_sql: Complete transactions in list_stores and purge
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 30 Jul 2012 06:01:41 +0200 |
parent | 5054:97385c45e670 |
child | 5056:a125daa42ad4 |
line wrap: on
line diff
--- a/plugins/mod_storage_sql.lua Mon Jul 30 01:54:07 2012 +0200 +++ b/plugins/mod_storage_sql.lua Mon Jul 30 06:01:41 2012 +0200 @@ -383,21 +383,21 @@ end local stmt, err = dosql(sql, host, username); if not stmt then - return nil, err; + return rollback(nil, err); end local stores = {}; for row in stmt:rows() do stores[#stores+1] = row[1]; end - return stores; + return commit(stores); end function driver:purge(username) local stmt, err = dosql("DELETE FROM `prosody` WHERE `host`=? AND `user`=?", host, username); - if not stmt then return stmt, err; end + if not stmt then return rollback(stmt, err); end local changed, err = stmt:affected(); - if not changed then return changed, err; end - return true, changed; + if not changed then return rollback(changed, err); end + return commit(true, changed); end module:add_item("data-driver", driver);