diff options
author | Waqas Hussain <waqas20@gmail.com> | 2009-07-26 17:51:36 +0500 |
---|---|---|
committer | Waqas Hussain <waqas20@gmail.com> | 2009-07-26 17:51:36 +0500 |
commit | 3582b62a763076932e2b9091ea6e7065a16057dd (patch) | |
tree | 558f3d5dd53cf29ec779c8c34a3bd5df21a02ddb | |
parent | b46f068a8718dca8ec85643a9dfbca665e9f617b (diff) | |
download | prosody-3582b62a763076932e2b9091ea6e7065a16057dd.tar.gz prosody-3582b62a763076932e2b9091ea6e7065a16057dd.zip |
ejabberdsql2prosody: Added support for all mysql escape sequences
-rw-r--r-- | tools/ejabberdsql2prosody.lua | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/tools/ejabberdsql2prosody.lua b/tools/ejabberdsql2prosody.lua index 2943103f..90990b64 100644 --- a/tools/ejabberdsql2prosody.lua +++ b/tools/ejabberdsql2prosody.lua @@ -36,11 +36,21 @@ local function peek() return last; end +local escapes = { + ["\\0"] = "\0"; + ["\\'"] = "'"; + ["\\\""] = "\""; + ["\\b"] = "\b"; + ["\\n"] = "\n"; + ["\\r"] = "\r"; + ["\\t"] = "\t"; + ["\\Z"] = "\26"; + ["\\\\"] = "\\"; + ["\\%"] = "%"; + ["\\_"] = "_"; +} local function unescape(s) - if s == "\\'" then return "'"; end - if s == "\\n" then return "\n"; end - if s == "\\\\" then return "\\"; end - error("Unknown escape sequence: "..s); + return escapes[s] or error("Unknown escape sequence: "..s); end local function readString() read("'"); |