projects
/
prosody.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a03fd32
)
mod_storage_sql: Make sure all serialization errors are propagated
author
Kim Alvefur
<zash@zash.se>
Mon, 21 Mar 2016 08:33:12 +0000
(09:33 +0100)
committer
Kim Alvefur
<zash@zash.se>
Mon, 21 Mar 2016 08:33:12 +0000
(09:33 +0100)
plugins/mod_storage_sql.lua
patch
|
blob
|
history
diff --git
a/plugins/mod_storage_sql.lua
b/plugins/mod_storage_sql.lua
index 70f1ab83c3a2f40a91f201821a00f7cb21f55ac8..4f46b3f662a5ef2a199ea4cad07240c454ac60da 100644
(file)
--- 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 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
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
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
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);
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);