Skip to content

Instantly share code, notes, and snippets.

@henriquegogo
Last active May 24, 2024 19:54
Show Gist options
  • Save henriquegogo/fa22ffec3eb345540ef2 to your computer and use it in GitHub Desktop.
Save henriquegogo/fa22ffec3eb345540ef2 to your computer and use it in GitHub Desktop.
LuaSQL-SQLite3 example
#!./bin/lua
local driver = require('luasql.sqlite3')
local env = driver.sqlite3()
local db = env:connect('db.sqlite')
db:execute[[
CREATE TABLE generic(
key varchar(50),
value varchar(150)
)
]]
db:execute[[
INSERT INTO generic VALUES('nome', 'coisa')
]]
local results = db:execute[[
SELECT * FROM generic
]]
local key,value = results:fetch()
while key do
print(key ..': '.. value)
key,value = results:fetch()
end
results:close()
db:close()
env:close()
@terroo
Copy link

terroo commented Dec 30, 2021

Excellent, the only one that really worked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment