diff options
author | daurnimator <quae@daurnimator.com> | 2014-08-07 18:34:51 -0400 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2014-08-07 18:34:51 -0400 |
commit | 06903bc73909fd1557c326f2cc90404aed4f7dcc (patch) | |
tree | 7b407ba02683da3b0001a11b54ac42a7a1878678 /plugins | |
parent | adf4b5a52e544766157ddfef5cef9db76768af4a (diff) | |
download | prosody-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.lua | 8 |
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 = {} |