get every sign in the world
#18
Something like this (didn't test, may need tweaking and definitely needs better error handling):
-- walls is an array-table: {{x1, y1, z1}, {x2, y2, z2}, ... }
db:exec("BEGIN TRANSACTION")  -- Postpone all DB changes into one big step, to save on disk I/O
local stmt = db:prepare("INSERT INTO GardenWalls (x, y, z) VALUES (?, ?, ?)")
for wall in ipairs(walls) do
 stmt:bind_values(unpack(wall))  -- insert "wall" values into the statement
 stmt: step()  -- execute the statement (once); the space before S should not be there (forum limit)
 stmt:reset()  -- reset the statement so that the next "wall" values can be inserted
end
stmt: finalize()
DB:exec("COMMIT")  -- Now put everything queued so far into the DB file
Reply
Thanks given by:


Messages In This Thread
get every sign in the world - by danny9484 - 03-15-2016, 07:28 PM
RE: get every sign in the world - by xoft - 03-15-2016, 07:46 PM
RE: get every sign in the world - by danny9484 - 03-15-2016, 07:53 PM
RE: get every sign in the world - by danny9484 - 03-15-2016, 10:22 PM
RE: get every sign in the world - by danny9484 - 03-15-2016, 10:37 PM
RE: get every sign in the world - by danny9484 - 03-15-2016, 10:40 PM
RE: get every sign in the world - by xoft - 03-16-2016, 12:10 AM
RE: get every sign in the world - by danny9484 - 03-16-2016, 01:26 AM
RE: get every sign in the world - by xoft - 03-18-2016, 12:12 AM
RE: get every sign in the world - by danny9484 - 03-18-2016, 02:07 AM
RE: get every sign in the world - by NiLSPACE - 03-18-2016, 02:11 AM
RE: get every sign in the world - by danny9484 - 03-18-2016, 02:16 AM
RE: get every sign in the world - by danny9484 - 03-18-2016, 02:29 AM
RE: get every sign in the world - by xoft - 03-18-2016, 04:22 AM
RE: get every sign in the world - by danny9484 - 03-18-2016, 07:47 PM
RE: get every sign in the world - by xoft - 03-18-2016, 09:00 PM
RE: get every sign in the world - by danny9484 - 03-18-2016, 09:33 PM
RE: get every sign in the world - by xoft - 03-18-2016, 10:01 PM
RE: get every sign in the world - by danny9484 - 03-18-2016, 10:15 PM
RE: get every sign in the world - by danny9484 - 03-19-2016, 12:59 AM
RE: get every sign in the world - by xoft - 03-19-2016, 08:18 PM
RE: get every sign in the world - by danny9484 - 03-21-2016, 06:37 PM
RE: get every sign in the world - by xoft - 03-21-2016, 10:21 PM
RE: get every sign in the world - by danny9484 - 03-21-2016, 11:00 PM
RE: get every sign in the world - by danny9484 - 03-21-2016, 11:18 PM



Users browsing this thread: 3 Guest(s)