Database Manager API
This project is a mod adding an API to manage sqlite3 databases.
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.
Add this mod to secure.trusted_mods
In order to load the
lsqlite3 library, this mod needs to access an insecure environment.
secure.trusted_mods setting in your
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.
.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
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 in the
sql directory of the path of the modname 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
This function is for internal use.
This function execute a query and doesn't return anything.
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