aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2017-02-20 01:26:03 +0100
committerKim Alvefur <zash@zash.se>2017-02-20 01:26:03 +0100
commit10bc92f25d1d3e69e3337b389ca9ee2c0c34aaf8 (patch)
tree9b9151186b29d307c03b845e459bcf7b40942fde /plugins
parent04f890a467a18c9f29b7cc49ae85a928984d3344 (diff)
downloadprosody-10bc92f25d1d3e69e3337b389ca9ee2c0c34aaf8.tar.gz
prosody-10bc92f25d1d3e69e3337b389ca9ee2c0c34aaf8.zip
mod_storage_sql: Make archive:append() to return the id (or key) as first return value
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_storage_sql.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/plugins/mod_storage_sql.lua b/plugins/mod_storage_sql.lua
index 07ff4c27..3fa3230b 100644
--- a/plugins/mod_storage_sql.lua
+++ b/plugins/mod_storage_sql.lua
@@ -187,7 +187,7 @@ function archive_store:append(username, key, value, when, with)
when, with, value = value, when, with;
end
local user,store = username,self.store;
- return engine:transaction(function()
+ local ok, key = engine:transaction(function()
if key then
engine:delete("DELETE FROM `prosodyarchive` WHERE `host`=? AND `user`=? AND `store`=? AND `key`=?", host, user or "", store, key);
else
@@ -197,6 +197,8 @@ function archive_store:append(username, key, value, when, with)
engine:insert("INSERT INTO `prosodyarchive` (`host`, `user`, `store`, `when`, `with`, `key`, `type`, `value`) VALUES (?,?,?,?,?,?,?,?)", host, user or "", store, when, with, key, t, value);
return key;
end);
+ if not ok then return ok, key; end
+ return key;
end
-- Helpers for building the WHERE clause