From 4f034c3b7a9640e6e2174cbfde57a6ad435f2daa Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Wed, 26 Aug 2015 14:32:20 +0200 Subject: util.hex: Normalize hex to lowercase and discard non-hex input --- util/hex.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'util') diff --git a/util/hex.lua b/util/hex.lua index e41f4863..4cc28d33 100644 --- a/util/hex.lua +++ b/util/hex.lua @@ -1,6 +1,7 @@ local s_char = string.char; local s_format = string.format; local s_gsub = string.gsub; +local s_lower = string.lower; local char_to_hex = {}; local hex_to_char = {}; @@ -19,7 +20,7 @@ local function to(s) end local function from(s) - return (s_gsub(s, "..", hex_to_char)); + return (s_gsub(s_lower(s), "%X*(%x%x)%X*", hex_to_char)); end return { to = to, from = from } -- cgit v1.2.3 From 90f5cf4cc12a0a64a92f9985cd6ea24a4198c885 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 30 Aug 2015 13:45:36 +0200 Subject: util.sql: Log when transactions begin --- util/sql.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'util') diff --git a/util/sql.lua b/util/sql.lua index 70e103df..64f7c7fc 100644 --- a/util/sql.lua +++ b/util/sql.lua @@ -180,6 +180,7 @@ function engine:_transaction(func, ...) --assert(not self.__transaction, "Recursive transactions not allowed"); local args, n_args = {...}, select("#", ...); local function f() return func(unpack(args, 1, n_args)); end + log("debug", "SQL transaction begin [%s]", tostring(func)); self.__transaction = true; local success, a, b, c = xpcall(f, debug_traceback); self.__transaction = nil; -- cgit v1.2.3 From 28202ed1c93c2a67e237f924c8305102bc40fa72 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Wed, 2 Sep 2015 14:14:22 +0200 Subject: util.sql: Export db2uri (mod_storage_sql2 command uses it) (thanks mike) --- util/sql.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'util') diff --git a/util/sql.lua b/util/sql.lua index 64f7c7fc..2d5e1774 100644 --- a/util/sql.lua +++ b/util/sql.lua @@ -329,4 +329,5 @@ return { Table = Table; Index = Index; create_engine = create_engine; + db2uri = db2uri; }; -- cgit v1.2.3