tools/ejabberdsql2prosody: Handle INSERT statement form where column list is specifie...
authorWaqas Hussain <waqas20@gmail.com>
Sat, 4 Feb 2012 19:10:13 +0000 (00:10 +0500)
committerWaqas Hussain <waqas20@gmail.com>
Sat, 4 Feb 2012 19:10:13 +0000 (00:10 +0500)
tools/ejabberdsql2prosody.lua

index 576f44366ab01d9aa84c307a03cc2de17df3bf86..c64faee0a502a02c508f28915eef76a5d6a6afd4 100644 (file)
@@ -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;