Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/maxdoom-com/lsqlite
lua sqlite module
https://github.com/maxdoom-com/lsqlite
lua lua-module sqlite3 sqlite3-database
Last synced: about 13 hours ago
JSON representation
lua sqlite module
- Host: GitHub
- URL: https://github.com/maxdoom-com/lsqlite
- Owner: maxdoom-com
- License: mit
- Created: 2016-11-13T19:04:08.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2020-05-31T12:06:44.000Z (over 4 years ago)
- Last Synced: 2024-08-02T15:36:38.150Z (3 months ago)
- Topics: lua, lua-module, sqlite3, sqlite3-database
- Language: C
- Size: 13.7 KB
- Stars: 9
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
LSQlite
=======Lsqlite is a simple sqlite module i wrote back in 2010. It is still fully
functional with lua 5.3 as of end 2017.Update: It's 2020 and I had to change two lines.
SYNOPSIS
--------```lua
lsqlite = require("lsqlite")local db = lsqlite.open(database)
db:exec(statements)
db:close(db)
```SUMMARY
-------The lsqlite module is a minimalistic sqlite3 - lua module.
You can open a database, perform any sqlite statements on it and close it.
If you don't close the database, the garbage collector will do this for you.DESCRIPTION
------------ lsqlite.open(database) returns an lsqlite object or nil
- db:exec(statements) executes one or more sqlite statments in one string and returns the output and an error description, if any
- db:close() closes an open databaseBUILDING
--------- building the library requires `gcc` with version < `9`.
- for gcc-9/-10 see [TROUBLE SHOOTING](#trouble-shooting)EXAMPLE
-------```lua
lsqlite = require("lsqlite")local db = lsqlite.open("database.sqlite")
local results, error = db:exec("select * from my_table;")
for i=1,#results do
for k,v in pairs(results[i]) do
print(k,v)
end
end
db:close(db)
```SPECIAL FILES
-------------To open an in memory database try
```lua
lsqlite = require("lsqlite")local db = lsqlite.open(":memory:")
```TROUBLE SHOOTING
----------------Currently there is an issue linking to the shared sqlite3.so on Debian
with gcc-9/-10. You may use the Makefile-Amalgamed to overcome this problem.For this to work you must place sqlite3.c and sqlite3.h from an
archive downloaded from https://www.sqlite.org/download.html in this
directory.Compilation:
```sh
make -f Makefile-Amalgamed
```COPYRIGHT
---------Copyright © 2010-2020 by Nico Hoffmann. License is MIT. For the complete
text see the supplied documentation.