# HG changeset patch # User Waqas Hussain # Date 1248613952 -18000 # Node ID a3ffc27b6207b32b684a5d8339b6535d3a3e1f2b # Parent cd9790f422693702d3cbd4b6fd382fc3fd090903 ejabberdsql2prosody: Fix typo, and improve the warning message diff -r cd9790f42269 -r a3ffc27b6207 tools/ejabberdsql2prosody.lua --- a/tools/ejabberdsql2prosody.lua Sun Jul 26 18:05:05 2009 +0500 +++ b/tools/ejabberdsql2prosody.lua Sun Jul 26 18:12:32 2009 +0500 @@ -178,14 +178,14 @@ for name, data in pairs(t) do local m = map[name]; if m then + if #data > 0 and #data[1] ~= #m then + print("[warning] expected "..#m.." columns for table `"..name.."`, found "..#data[1]); + end for i=1,#data do local row = data[i]; - for j=1,#row do - 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 + for j=1,#m do + row[m[j]] = row[j]; + row[j] = nil; end end end