This project is a mod adding an API to manage sqlite3 databases to the free voxel game engine Minetest.
In order to run and use this mod, you will need to:
Folow the install guide for your system on the official website
On Ubuntu you can just install it from apt:
sudo apt install sqlite3
lsqlite3 is a sqlite wrapper for lua.
You should install it using luarocks.
In order to load the lsqlite3
library, this mod needs to access an insecure environment.
Add db_manager
to secure.trusted_mods
setting in your minetest.conf
This mod aims to remove the pain of working with databases. Mods can create databases without accessing insecure environment or messing with other mods databases and manage sql schemats freely.
Checkout the .exemples
folder for some exemple mods.
This function allow a mod to create or open a database.
- name: should be in the form "modname:database_name"
- schemat (optional): a sql schemat (string) to apply to the database
Returns a DbRef
This function can get any sql shemat from any mod as a string.
- name: in the form "modname:filename"
The function will search the file and return it as a string.
Create a new DbRef object with:
- name: the name of the database
- db: the name of a db object (optained by calling
sqlite3.open()
)
This function is for internal use.
This function execute a query and doesn't return anything.
If lsqlite3
returns an error, a error will be shown in log.
This function execute query and returns a lua table.
This setting allow you to choose between two behaviour then a database error is catched:
- log: the error will just be thrown in log
- error: the error will cause a hard crash