Skip to content

rycamosun/lua-sqlitelib

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lua-sqlitelib

A Lua SQLite library via SWIG bindings over cpp-sqlitelib.

Open database

local sqlitelib = require("sqlitelib")
 
local db = sqlitelib.Sqlite(":memory:")
-- or a file:
local db = sqlitelib.Sqlite("./test.db")

Create table

db:execute([[
  CREATE TABLE IF NOT EXISTS people (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    name TEXT,
    age INTEGER
  )
]])

Drop table

db:execute("DROP TABLE IF EXISTS people")

Insert records

db:execute("INSERT INTO people (name, age) VALUES ('fish', 10)")

Select a records

local names = db:execute_string("SELECT name FROM people")
for i = 0, names:size() - 1 do
	print(names[i])
end

Check connection

print(db:is_open()) -- true

License

MIT license (© 2021 Yuji Hirose, © 2026 rycamosun)

About

C++ SQLite wrapper library with lua bindings

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • C 92.9%
  • C++ 7.1%