diff options
author | Waqas Hussain <waqas20@gmail.com> | 2009-07-26 18:05:05 +0500 |
---|---|---|
committer | Waqas Hussain <waqas20@gmail.com> | 2009-07-26 18:05:05 +0500 |
commit | 7dfd0a10123befa377e75a93b0a90011737e2764 (patch) | |
tree | a87b2390dec9f0fa746982e5791b58ee3ce9b456 | |
parent | 3582b62a763076932e2b9091ea6e7065a16057dd (diff) | |
download | prosody-7dfd0a10123befa377e75a93b0a90011737e2764.tar.gz prosody-7dfd0a10123befa377e75a93b0a90011737e2764.zip |
ejabberdsql2prosody: Display a warning if a row has more columns than expected
-rw-r--r-- | tools/ejabberdsql2prosody.lua | 7 |
1 files 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 |