Comparison

plugins/mod_storage_sql.lua @ 3891:f82af9f7f1cd

mod_storage_sql: Fix a couple of bugs in "JSON" decoding
author Matthew Wild <mwild1@gmail.com>
date Sat, 18 Dec 2010 03:25:31 +0000
parent 3864:345f1d5b7022
child 3974:af40a7ce4f77
comparison
equal deleted inserted replaced
3890:5cdcb5741075 3891:f82af9f7f1cd
23 local tostring = tostring; 23 local tostring = tostring;
24 local tonumber = tonumber; 24 local tonumber = tonumber;
25 local pairs = pairs; 25 local pairs = pairs;
26 local next = next; 26 local next = next;
27 local setmetatable = setmetatable; 27 local setmetatable = setmetatable;
28 local json = { stringify = function(s) return require"util.serialization".serialize(s) end, parse = require"util.serialization".deserialze }; 28 local json = { stringify = function(s) return require"util.serialization".serialize(s) end, parse = require"util.serialization".deserialize };
29 29
30 local connection = ...; 30 local connection = ...;
31 local host,user,store = module.host; 31 local host,user,store = module.host;
32 32
33 do -- process options to get a db connection 33 do -- process options to get a db connection
77 if t == "string" then return value; 77 if t == "string" then return value;
78 elseif t == "boolean" then 78 elseif t == "boolean" then
79 if value == "true" then return true; 79 if value == "true" then return true;
80 elseif value == "false" then return false; end 80 elseif value == "false" then return false; end
81 elseif t == "number" then return tonumber(value); 81 elseif t == "number" then return tonumber(value);
82 elseif value == "json" then 82 elseif t == "json" then
83 return json.parse(value); 83 return json.parse(value);
84 end 84 end
85 end 85 end
86 86
87 local function getsql(sql, ...) 87 local function getsql(sql, ...)