get every sign in the world
#20
I just tried that prepare and it worked very very well xD

local db = sqlite3.open(cPluginManager:Get():GetCurrentPlugin():GetLocalFolder() .. "/storage.sqlite")
db:exec("BEGIN TRANSACTION")  -- Postpone all DB changes into one big step, to save on disk I/O
local stmt, err, errmsg = db:prepare("INSERT INTO marker (X, Y, Z, World, Player_name) VALUES (?, ?, ?, ?, ?)")
if (not stmt) then
  LOG(err .. " " .. errmsg)
end
for X in pairs(marker_temp) do
  for Y in pairs(marker_temp[X]) do
    for Z in pairs(marker_temp[X][Y]) do
      for World_name in pairs(marker_temp[X][Y][Z]) do
        for Player_name in pairs(marker_temp[X][Y][Z][World_name]) do
          LOG("Saving: " .. X .. "X " .. Y .. "Y " .. Z .. "Z " .. World_name .. " " .. Player_name)
          stmt:bind_names({X, Y, Z, World_name, Player_name})
          stmt:step()  -- execute the statement (once)
          stmt:reset()  -- reset the statement so that the next "wall" values can be inserted
        end
      end
    end
  end
end
stmt:finalize()
db:exec("COMMIT")  -- Now put everything queued so far into the DB file
marker_temp = {}
everything is now saving in a second
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: 1 Guest(s)