# HG changeset patch # User Kim Alvefur # Date 1343620901 -7200 # Node ID d466d2088a61d1c1ab63f248f63fe205053d3eb3 # Parent 97385c45e67090f34ff58caf70733e4eef5160e3 mod_storage_sql: Complete transactions in list_stores and purge diff -r 97385c45e670 -r d466d2088a61 plugins/mod_storage_sql.lua --- 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);