Comparison

tools/ejabberdsql2prosody.lua @ 1600:cd9790f42269

ejabberdsql2prosody: Display a warning if a row has more columns than expected
author Waqas Hussain <waqas20@gmail.com>
date Sun, 26 Jul 2009 18:05:05 +0500
parent 1599:308986a3e66a
child 1601:a3ffc27b6207
comparison
equal deleted inserted replaced
1599:308986a3e66a 1600:cd9790f42269
179 local m = map[name]; 179 local m = map[name];
180 if m then 180 if m then
181 for i=1,#data do 181 for i=1,#data do
182 local row = data[i]; 182 local row = data[i];
183 for j=1,#row do 183 for j=1,#row do
184 row[m[j]] = row[j]; 184 local n = m[j];
185 row[j] = nil; 185 if n then
186 row[n] = row[j];
187 row[j] = nil;
188 else print("[warning] expected "..#n.." columns for table `"..name.."`, found "..#row); break; end
186 end 189 end
187 end 190 end
188 end 191 end
189 end 192 end
190 --print(serialize(t)); 193 --print(serialize(t));