From 7f60996cffb70e443c286adef321f86f9334cb45 Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Fri, 9 Dec 2011 11:37:30 +0500 Subject: migrator/jabberd14: Minor refactoring. --- tools/migration/migrator/jabberd14.lua | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'tools') diff --git a/tools/migration/migrator/jabberd14.lua b/tools/migration/migrator/jabberd14.lua index 47004a52..54c45d94 100644 --- a/tools/migration/migrator/jabberd14.lua +++ b/tools/migration/migrator/jabberd14.lua @@ -67,15 +67,12 @@ local parse_xml = (function() end)(); local function load_xml(path) - if path then - local f, err = io_open(path); - if not f then return f, err; end - local data = f:read("*a"); - f:close(); - if data then - return parse_xml(data); - end - end + local f, err = io_open(path); + if not f then return f, err; end + local data = f:read("*a"); + f:close(); + if not data then return; end + return parse_xml(data); end local function load_spool_file(host, filename, path) -- cgit v1.2.3 From 86dbec26c8257844a032ac1b53188ef41452c1cb Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Sun, 5 Feb 2012 00:10:13 +0500 Subject: tools/ejabberdsql2prosody: Handle INSERT statement form where column list is specified (by skipping the column list). --- tools/ejabberdsql2prosody.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'tools') 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; -- cgit v1.2.3