Advertisement
Shiny_

WTF

Jun 27th, 2014
357
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.88 KB | None | 0 0
  1. local Connection    = dbConnect("sqlite", "sqlite.db")
  2. local Table         = "Table"
  3.  
  4. local HandleQuery  = dbQuery(Connection, "CREATE TABLE IF NOT EXISTS " .. Table .. " (Tekst TEXT, ID INTEGER)")
  5.  
  6. function Fill_Table()
  7.     local NOW = getTickCount()
  8.     for i = 0, 100 do
  9.         dbQuery(Connection, "INSERT INTO " .. Table .. " (Tekst, ID) VALUES (?, ?)", "Tekst nr" .. i, i)
  10.     end
  11.     local Difference = getTickCount() - NOW
  12.     outputDebugString("Pomyślnie wypełniono tabelę. Czas trwania to " .. Difference .. " milisekund", 1)
  13. end
  14.  
  15. function Show_Table()
  16.     local NOW = getTickCount()
  17.     dbQuery(Connection, "SELECT * FROM " .. Table)
  18.     local Difference = getTickCount() - NOW
  19.     outputDebugString("Pomyślnie wybrano z tabeli. Czas trwania to " .. Difference .. " milisekund", 1)
  20. end
  21.  
  22. addCommandHandler("insert", Fill_Table)
  23. addCommandHandler("show", Show_Table)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement