aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2009-07-26 17:51:36 +0500
committerWaqas Hussain <waqas20@gmail.com>2009-07-26 17:51:36 +0500
commit3582b62a763076932e2b9091ea6e7065a16057dd (patch)
tree558f3d5dd53cf29ec779c8c34a3bd5df21a02ddb
parentb46f068a8718dca8ec85643a9dfbca665e9f617b (diff)
downloadprosody-3582b62a763076932e2b9091ea6e7065a16057dd.tar.gz
prosody-3582b62a763076932e2b9091ea6e7065a16057dd.zip
ejabberdsql2prosody: Added support for all mysql escape sequences
-rw-r--r--tools/ejabberdsql2prosody.lua18
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("'");