Files
tsqlite/README.md
2025-12-21 20:02:46 +05:00

50 lines
1.5 KiB
Markdown

# tsqlite
A wrapper for [sqlite](https://sqlite.org) that uses [tlibc](https://timerix.ddns.net/git/Timerix/tlibc) for error handling.
## Build
1. Clone this repository.
```
git clone https://timerix.ddns.net/git/Timerix/tsqlite.git
```
2. Install [cbuild](https://timerix.ddns.net/git/Timerix/cbuild/releases).
Select latest version compatible with the one in `project.config`.
Example: For `2.3.0` download latest `2.3.x`.
3. Clone [tlibc](https://timerix.ddns.net/git/Timerix/tlibc).
By default `dependencies/tlibc.config` expects that `tlibc/` is present in the same directory as `tsqlite/`.
If you cloned it to another directory, change `DEPENDENCIES_DIR` in `tsqlite/project.user.config`.
```
git clone https://timerix.ddns.net/git/Timerix/tlibc.git
```
4. Install **sqlite** library.
MinGW: `pacman -S mingw-w64-x86_64-sqlite3`
5. Build and run tests
```
cd tsqlite
cbuild build_exec exec
```
6. To build library use tasks `build_static_lib[_dbg]` or `build_shared_lib[_dbg]`
7. If you use tsqlite as static library, add `LINKER_LIBS` from tsqlite `project.config` to your project.
## Usage
```c
#include "tsqlite.h"
int main(){
Deferral(32); // reserve memory for 32 defers
// init tlibc global variables
try_fatal_void(tlibc_init());
// init tsqlite global variables
try_fatal_void(tsqlite_init());
Defer(tlibc_deinit());
Defer(tsqlite_deinit());
Return 0; // call defers
}
```