Changeset

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
parents 4495:c0f5c78cb817
children 4500:bfa387f268e2
files tools/ejabberdsql2prosody.lua
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
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;