aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2012-02-05 00:10:13 +0500
committerWaqas Hussain <waqas20@gmail.com>2012-02-05 00:10:13 +0500
commit84090686e42fa1e0ea3da654e5270d95fcf97434 (patch)
tree5d5f88f818cde5b88d47445615dddd4fa8789e7e
parent45bce504d83275ed3b91f1523582f936bac34010 (diff)
downloadprosody-84090686e42fa1e0ea3da654e5270d95fcf97434.tar.gz
prosody-84090686e42fa1e0ea3da654e5270d95fcf97434.zip
tools/ejabberdsql2prosody: Handle INSERT statement form where column list is specified (by skipping the column list).
-rw-r--r--tools/ejabberdsql2prosody.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/ejabberdsql2prosody.lua b/tools/ejabberdsql2prosody.lua
index 576f4436..c64faee0 100644
--- a/tools/ejabberdsql2prosody.lua
+++ b/tools/ejabberdsql2prosody.lua
@@ -129,7 +129,12 @@ local function readInsert()
end
end
local tname = readTableName();
- for ch in ("` VALUES "):gmatch(".") do read(ch); end -- expect this
+ read("`"); read(" ") -- expect this
+ if peek() == "(" then -- skip column list
+ repeat until read() == ")";
+ read(" ");
+ end
+ for ch in ("VALUES "):gmatch(".") do read(ch); end -- expect this
local tuples = readTuples();
read(";"); read("\n");
return tname, tuples;