aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_storage_sql.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2016-03-21 09:33:12 +0100
committerKim Alvefur <zash@zash.se>2016-03-21 09:33:12 +0100
commitc42992594da7b524f633894841fca8791d9f55a1 (patch)
treeb0fd6d130f5c0fbd581552f7e7c48af29b094ca0 /plugins/mod_storage_sql.lua
parent487f77d6ef7b64fccb2bb73a0710c6e669399153 (diff)
downloadprosody-c42992594da7b524f633894841fca8791d9f55a1.tar.gz
prosody-c42992594da7b524f633894841fca8791d9f55a1.zip
mod_storage_sql: Make sure all serialization errors are propagated
Diffstat (limited to 'plugins/mod_storage_sql.lua')
-rw-r--r--plugins/mod_storage_sql.lua8
1 files changed, 3 insertions, 5 deletions
diff --git a/plugins/mod_storage_sql.lua b/plugins/mod_storage_sql.lua
index 70f1ab83..4f46b3f6 100644
--- a/plugins/mod_storage_sql.lua
+++ b/plugins/mod_storage_sql.lua
@@ -82,16 +82,14 @@ local function keyval_store_set(data)
local extradata = {};
for key, value in pairs(data) do
if type(key) == "string" and key ~= "" then
- local t, value = serialize(value);
- assert(t, value);
+ local t, value = assert(serialize(value));
engine:insert("INSERT INTO `prosody` (`host`,`user`,`store`,`key`,`type`,`value`) VALUES (?,?,?,?,?,?)", host, user or "", store, key, t, value);
else
extradata[key] = value;
end
end
if next(extradata) ~= nil then
- local t, extradata = serialize(extradata);
- assert(t, extradata);
+ local t, extradata = assert(serialize(extradata));
engine:insert("INSERT INTO `prosody` (`host`,`user`,`store`,`key`,`type`,`value`) VALUES (?,?,?,?,?,?)", host, user or "", store, "", t, extradata);
end
end
@@ -197,7 +195,7 @@ function archive_store:append(username, key, value, when, with)
else
key = uuid.generate();
end
- local t, value = serialize(value);
+ local t, value = assert(serialize(value));
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);