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
commit86dbec26c8257844a032ac1b53188ef41452c1cb (patch)
tree5d5f88f818cde5b88d47445615dddd4fa8789e7e
parentcccbf349e4040d88501188515f0c4557795edd53 (diff)
downloadprosody-86dbec26c8257844a032ac1b53188ef41452c1cb.tar.gz
prosody-86dbec26c8257844a032ac1b53188ef41452c1cb.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;