Diff

tools/ejabberdsql2prosody.lua @ 4496:11983a1e92c0

tools/ejabberdsql2prosody: Handle INSERT statement form where column list is specified (by skipping the column list).
author Waqas Hussain <waqas20@gmail.com>
date Sun, 05 Feb 2012 00:10:13 +0500
parent 4384:7fbcb7e6a6a0
child 5215:b3d837c1ccf1
line wrap: on
line diff
--- a/tools/ejabberdsql2prosody.lua	Sun Feb 05 00:06:20 2012 +0500
+++ b/tools/ejabberdsql2prosody.lua	Sun Feb 05 00:10:13 2012 +0500
@@ -129,7 +129,12 @@
 		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;