summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/lsqlite3/examples/tracing.lua
blob: e72e3907b381a481265bfa375467f984688f5569 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
local sqlite3 = require("lsqlite3")

local db = sqlite3.open_memory()

db:trace( function(ud, sql)
  print("Sqlite Trace:", sql)
end )

db:exec[[
  CREATE TABLE test ( id INTEGER PRIMARY KEY, content VARCHAR );

  INSERT INTO test VALUES (NULL, 'Hello World');
  INSERT INTO test VALUES (NULL, 'Hello Lua');
  INSERT INTO test VALUES (NULL, 'Hello Sqlite3');
]]

for row in db:rows("SELECT * FROM test") do
  -- NOP
end