From 7dfd0a10123befa377e75a93b0a90011737e2764 Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Sun, 26 Jul 2009 18:05:05 +0500 Subject: ejabberdsql2prosody: Display a warning if a row has more columns than expected --- tools/ejabberdsql2prosody.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/ejabberdsql2prosody.lua b/tools/ejabberdsql2prosody.lua index 90990b64..6ff8cf19 100644 --- a/tools/ejabberdsql2prosody.lua +++ b/tools/ejabberdsql2prosody.lua @@ -181,8 +181,11 @@ for name, data in pairs(t) do for i=1,#data do local row = data[i]; for j=1,#row do - row[m[j]] = row[j]; - row[j] = nil; + local n = m[j]; + if n then + row[n] = row[j]; + row[j] = nil; + else print("[warning] expected "..#n.." columns for table `"..name.."`, found "..#row); break; end end end end -- cgit v1.2.3