aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2014-08-07 18:34:51 -0400
committerdaurnimator <quae@daurnimator.com>2014-08-07 18:34:51 -0400
commit06903bc73909fd1557c326f2cc90404aed4f7dcc (patch)
tree7b407ba02683da3b0001a11b54ac42a7a1878678 /plugins
parentadf4b5a52e544766157ddfef5cef9db76768af4a (diff)
downloadprosody-06903bc73909fd1557c326f2cc90404aed4f7dcc.tar.gz
prosody-06903bc73909fd1557c326f2cc90404aed4f7dcc.zip
plugins/mod_storage_sql2: Return correct arguments from map_store operations
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_storage_sql2.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/plugins/mod_storage_sql2.lua b/plugins/mod_storage_sql2.lua
index ce21d368..c0e2e6cd 100644
--- a/plugins/mod_storage_sql2.lua
+++ b/plugins/mod_storage_sql2.lua
@@ -219,7 +219,7 @@ end
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 @@ function map_store:get(username, key)
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 @@ function map_store:set(username, key, data)
end
return true;
end);
+ if not ok then return nil, result; end
+ return result;
end
local archive_store = {}