Comparison

util/sqlite3.lua @ 13145:af251471d5ae

util.sqlite3: Fix indentation
author Kim Alvefur <zash@zash.se>
date Sat, 10 Jun 2023 22:00:43 +0200
parent 12975:d10957394a3c
child 13146:771eb453e03a
comparison
equal deleted inserted replaced
13144:033ea8b46d6a 13145:af251471d5ae
200 rowcount = function(self) return self.__rowcount; end; 200 rowcount = function(self) return self.__rowcount; end;
201 }, 201 },
202 }; 202 };
203 203
204 local function iterator(table) 204 local function iterator(table)
205 local i=0; 205 local i = 0;
206 return function() 206 return function()
207 i=i+1; 207 i = i + 1;
208 local item=table[i]; 208 local item = table[i];
209 if item ~= nil then 209 if item ~= nil then
210 return item; 210 return item;
211 end 211 end
212 end 212 end
213 end 213 end
266 if stmt:reset() == lsqlite3.OK then 266 if stmt:reset() == lsqlite3.OK then
267 prepared[sql] = stmt; 267 prepared[sql] = stmt;
268 end 268 end
269 return setmetatable({ __affected = affected, __rowcount = rowcount }, result_mt); 269 return setmetatable({ __affected = affected, __rowcount = rowcount }, result_mt);
270 end 270 end
271
271 engine.insert = engine.execute_update; 272 engine.insert = engine.execute_update;
272 engine.select = engine.execute_query; 273 engine.select = engine.execute_query;
273 engine.delete = engine.execute_update; 274 engine.delete = engine.execute_update;
274 engine.update = engine.execute_update; 275 engine.update = engine.execute_update;
275 local function debugwrap(name, f) 276 local function debugwrap(name, f)
369 self:_create_index(v); 370 self:_create_index(v);
370 end 371 end
371 end 372 end
372 return success; 373 return success;
373 end 374 end
375
374 function engine:set_encoding() -- to UTF-8 376 function engine:set_encoding() -- to UTF-8
375 return self:transaction(function() 377 return self:transaction(function()
376 for encoding in self:select"PRAGMA encoding;" do 378 for encoding in self:select "PRAGMA encoding;" do
377 if encoding[1] == "UTF-8" then 379 if encoding[1] == "UTF-8" then
378 self.charset = "utf8"; 380 self.charset = "utf8";
379 end 381 end
380 end 382 end
381 end); 383 end);
382 end 384 end