Software /
code /
prosody
Changeset
6335:eaf6e7986934
plugins/mod_storage_sql2: Return correct arguments from map_store operations
author | daurnimator <quae@daurnimator.com> |
---|---|
date | Thu, 07 Aug 2014 18:34:51 -0400 |
parents | 6334:ba2555e06c7c |
children | 6336:11510d4d3b57 |
files | plugins/mod_storage_sql2.lua |
diffstat | 1 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_storage_sql2.lua Thu Aug 07 18:03:31 2014 -0400 +++ b/plugins/mod_storage_sql2.lua Thu Aug 07 18:34:51 2014 -0400 @@ -219,7 +219,7 @@ local map_store = {}; map_store.__index = map_store; function map_store:get(username, key) - return engine:transaction(function() + local ok, result = engine:transaction(function() if type(key) == "string" and key ~= "" then local iter, state, first = engine:select("SELECT * FROM `prosody` WHERE `host`=? AND `user`=? AND `store`=? AND `key`=?", host, username, self.store, key or ""); @@ -233,9 +233,11 @@ error("TODO: non-string keys"); end end); + if not ok then return nil, result; end + return result; end function map_store:set(username, key, data) - return engine:transaction(function() + local ok, result = engine:transaction(function() if data == nil then engine:delete("DELETE FROM `prosody` WHERE `host`=? AND `user`=? AND `store`=? AND `key`=?", host, username, self.store, key or ""); @@ -248,6 +250,8 @@ end return true; end); + if not ok then return nil, result; end + return result; end local archive_store = {}