Sun, 26 Jul 2009 18:05:05 +0500
ejabberdsql2prosody: Display a warning if a row has more columns than expected
tools/ejabberdsql2prosody.lua | file | annotate | diff | comparison | revisions |
--- a/tools/ejabberdsql2prosody.lua Sun Jul 26 17:51:36 2009 +0500 +++ b/tools/ejabberdsql2prosody.lua Sun Jul 26 18:05:05 2009 +0500 @@ -181,8 +181,11 @@ 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