# HG changeset patch # User daurnimator # Date 1407450891 14400 # Node ID eaf6e7986934d1c3ac8f1c2132f1d78eecae7d19 # Parent ba2555e06c7cff432b43bf8db84f714e6469b301 plugins/mod_storage_sql2: Return correct arguments from map_store operations diff -r ba2555e06c7c -r eaf6e7986934 plugins/mod_storage_sql2.lua --- 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 = {}