projects
/
prosody.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
util.httpstream: A little cleanup of the HTTP path.
[prosody.git]
/
plugins
/
mod_storage_sql.lua
diff --git
a/plugins/mod_storage_sql.lua
b/plugins/mod_storage_sql.lua
index 593acd3151813f3d05d12a51808ccf3f3a731202..3d5aa0a371e3714d424dbf8df7a6f7ba48d5a033 100644
(file)
--- a/
plugins/mod_storage_sql.lua
+++ b/
plugins/mod_storage_sql.lua
@@
-25,7
+25,7
@@
local tonumber = tonumber;
local pairs = pairs;
local next = next;
local setmetatable = setmetatable;
local pairs = pairs;
local next = next;
local setmetatable = setmetatable;
-local json = { stringify = function(s) return require"util.serialization".serialize(s) end, parse = require"util.serialization".deserialze };
+local json = { stringify = function(s) return require"util.serialization".serialize(s) end, parse = require"util.serialization".deserial
i
ze };
local connection = ...;
local host,user,store = module.host;
local connection = ...;
local host,user,store = module.host;
@@
-74,12
+74,12
@@
local function serialize(value)
return nil, "Unhandled value type: "..t;
end
local function deserialize(t, value)
return nil, "Unhandled value type: "..t;
end
local function deserialize(t, value)
- if t == "string" then return
t
;
+ if t == "string" then return
value
;
elseif t == "boolean" then
if value == "true" then return true;
elseif value == "false" then return false; end
elseif t == "number" then return tonumber(value);
elseif t == "boolean" then
if value == "true" then return true;
elseif value == "false" then return false; end
elseif t == "number" then return tonumber(value);
- elseif
value
== "json" then
+ elseif
t
== "json" then
return json.parse(value);
end
end
return json.parse(value);
end
end
@@
-115,7
+115,7
@@
local keyval_store = {};
keyval_store.__index = keyval_store;
function keyval_store:get(username)
user,store = username,self.store;
keyval_store.__index = keyval_store;
function keyval_store:get(username)
user,store = username,self.store;
- local stmt, err = getsql("SELECT * FROM Prosody WHERE host
=? AND user=? AND store=? AND subkey=
NULL");
+ local stmt, err = getsql("SELECT * FROM Prosody WHERE host
IS ? AND user IS ? AND store IS ? AND subkey IS
NULL");
if not stmt then return nil, err; end
local haveany;
if not stmt then return nil, err; end
local haveany;
@@
-137,7
+137,7
@@
end
function keyval_store:set(username, data)
user,store = username,self.store;
-- start transaction
function keyval_store:set(username, data)
user,store = username,self.store;
-- start transaction
- local affected, err = setsql("DELETE FROM Prosody WHERE host
=? AND user=? AND store=? AND subkey=
NULL");
+ local affected, err = setsql("DELETE FROM Prosody WHERE host
IS ? AND user IS ? AND store IS ? AND subkey IS
NULL");
if data and next(data) ~= nil then
local extradata = {};
if data and next(data) ~= nil then
local extradata = {};
@@
-165,7
+165,7
@@
local map_store = {};
map_store.__index = map_store;
function map_store:get(username, key)
user,store = username,self.store;
map_store.__index = map_store;
function map_store:get(username, key)
user,store = username,self.store;
- local stmt, err = getsql("SELECT * FROM Prosody WHERE host
=? AND user=? AND store=? AND key=
?", key);
+ local stmt, err = getsql("SELECT * FROM Prosody WHERE host
IS ? AND user IS ? AND store IS ? AND key IS
?", key);
if not stmt then return nil, err; end
local haveany;
if not stmt then return nil, err; end
local haveany;
@@
-187,7
+187,7
@@
end
function map_store:set(username, key, data)
user,store = username,self.store;
-- start transaction
function map_store:set(username, key, data)
user,store = username,self.store;
-- start transaction
- local affected, err = setsql("DELETE FROM Prosody WHERE host
=? AND user=? AND store=? AND key=
?", key);
+ local affected, err = setsql("DELETE FROM Prosody WHERE host
IS ? AND user IS ? AND store IS ? AND key IS
?", key);
if data and next(data) ~= nil then
local extradata = {};
if data and next(data) ~= nil then
local extradata = {};
@@
-219,10
+219,10
@@
function list_store:scan(username, from, to, jid, typ)
local cols = {"from", "to", "jid", "typ"};
local vals = { from , to , jid , typ };
local stmt, err;
local cols = {"from", "to", "jid", "typ"};
local vals = { from , to , jid , typ };
local stmt, err;
- local query = "SELECT * FROM ProsodyArchive WHERE host
=? AND user=? AND store=
?";
+ local query = "SELECT * FROM ProsodyArchive WHERE host
IS ? AND user IS ? AND store IS
?";
query = query.." ORDER BY time";
query = query.." ORDER BY time";
- --local stmt, err = getsql("SELECT * FROM Prosody WHERE host
=? AND user=? AND store=? AND key=
?", key);
+ --local stmt, err = getsql("SELECT * FROM Prosody WHERE host
IS ? AND user IS ? AND store IS ? AND key IS
?", key);
return nil, "not-implemented"
end
return nil, "not-implemented"
end