Comparison

util/sql.lua @ 7516:f74ff35a4b03

Merge 0.10->trunk
author Kim Alvefur <zash@zash.se>
date Sat, 23 Jul 2016 18:58:58 +0200
parent 7513:8a6c7c4b15fb
child 8073:7361412a9664
comparison
equal deleted inserted replaced
7510:8a0a50e8ef2d 7516:f74ff35a4b03
47 return setmetatable(definition, index_mt); 47 return setmetatable(definition, index_mt);
48 end 48 end
49 49
50 function table_mt:__tostring() 50 function table_mt:__tostring()
51 local s = { 'name="'..self.__table__.name..'"' } 51 local s = { 'name="'..self.__table__.name..'"' }
52 for i,col in ipairs(self.__table__) do 52 for _, col in ipairs(self.__table__) do
53 s[#s+1] = tostring(col); 53 s[#s+1] = tostring(col);
54 end 54 end
55 return 'Table{ '..t_concat(s, ", ")..' }' 55 return 'Table{ '..t_concat(s, ", ")..' }'
56 end 56 end
57 table_mt.__index = {}; 57 table_mt.__index = {};
292 if self._debug then 292 if self._debug then
293 debugquery("create", sql); 293 debugquery("create", sql);
294 end 294 end
295 local success,err = self:execute(sql); 295 local success,err = self:execute(sql);
296 if not success then return success,err; end 296 if not success then return success,err; end
297 for i,v in ipairs(table.__table__) do 297 for _, v in ipairs(table.__table__) do
298 if is_index(v) then 298 if is_index(v) then
299 self:_create_index(v); 299 self:_create_index(v);
300 end 300 end
301 end 301 end
302 return success; 302 return success;