aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2009-07-26 18:12:32 +0500
committerWaqas Hussain <waqas20@gmail.com>2009-07-26 18:12:32 +0500
commitea959556cf118f4c2afd3e85a5fe8f1445b734b3 (patch)
tree0210e2c6cc3e7d8282bd6fe260661794efe36257
parent7dfd0a10123befa377e75a93b0a90011737e2764 (diff)
downloadprosody-ea959556cf118f4c2afd3e85a5fe8f1445b734b3.tar.gz
prosody-ea959556cf118f4c2afd3e85a5fe8f1445b734b3.zip
ejabberdsql2prosody: Fix typo, and improve the warning message
-rw-r--r--tools/ejabberdsql2prosody.lua12
1 files changed, 6 insertions, 6 deletions
diff --git a/tools/ejabberdsql2prosody.lua b/tools/ejabberdsql2prosody.lua
index 6ff8cf19..ddbe3ee2 100644
--- a/tools/ejabberdsql2prosody.lua
+++ b/tools/ejabberdsql2prosody.lua
@@ -178,14 +178,14 @@ local t = parseFile(arg);
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