aboutsummaryrefslogtreecommitdiffstats
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
commit3fbc5f1e6e7bd733be056cceae83cbdceaf9dc1c (patch)
tree7b407ba02683da3b0001a11b54ac42a7a1878678
parent08034e198e2eb8587a60d731857242b954b80114 (diff)
downloadprosody-3fbc5f1e6e7bd733be056cceae83cbdceaf9dc1c.tar.gz
prosody-3fbc5f1e6e7bd733be056cceae83cbdceaf9dc1c.zip
plugins/mod_storage_sql2: Return correct arguments from map_store operations
-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 = {}