Updated Readme

This commit is contained in:
retoor 2024-11-22 14:45:03 +01:00
parent 87deb64ff1
commit 82e133e225

View File

@ -6,8 +6,8 @@ SORM stands for SQL ORM. I made this because i have a hate/love relationship wit
The naming of my functions and variables are something to get used to. They're all abbreviations, kinda like C stdlib style. It looks weird, but you get used to it quickly and in reality, you just use a few of them. The naming of my functions and variables are something to get used to. They're all abbreviations, kinda like C stdlib style. It looks weird, but you get used to it quickly and in reality, you just use a few of them.
Examples of common used functions are: Examples of common used functions are:
- `sormc(char *path)` connect to database. Returns int. - `sormc(char *path)` connect to database. Returns `int`.
- `sormq(int conn, char *sql, ...)` execute query. Variadic arguments. Works like printf. Returns result in CSV format in case of SELECT. - `sormq(int conn, char *sql, ...)` execute query. Variadic arguments. Works like `printf`. Returns result in CSV format in case of `SELECT`.
- `sorm_csvd(char *csv_data)` dumps your CSV result data to a nice fixed content width table in the terminal. - `sorm_csvd(char *csv_data)` dumps your CSV result data to a nice fixed content width table in the terminal.
## Thread safety ## Thread safety
@ -19,7 +19,7 @@ Same argument is for the result set of `sormq` (the query function) resulting in
While the performance is nice, it's not written with performance in mind at all. While the performance is nice, it's not written with performance in mind at all.
## Python support ## Python support
The python library is low quality. I made it just for fun and test. This is not a defitive version. But it show very well how to communicate with a shared object file. I'm sure someone will be happy with examples how to use variadic functions trough Python to C. See `sorm.py` The Python library is low quality. I made it just for fun and test. This is not a defitive version. But it show very well how to communicate with a shared object file. I'm sure someone will be happy with examples how to use variadic functions trough Python to C. See `sorm.py`
## C API examples: ## C API examples:
@ -28,7 +28,7 @@ The python library is low quality. I made it just for fun and test. This is not
int db = sormc("db.sqlite3"); int db = sormc("db.sqlite3");
``` ```
### Create table ### Create table
This one should return True if executed. This one should return true if executed.
```c ```c
sormq(db, "CREATE TABLE IF NOT EXISTS pony (id INTEGER PRIMARY KEY AUTOINCREMENT,name,age);",NULL); sormq(db, "CREATE TABLE IF NOT EXISTS pony (id INTEGER PRIMARY KEY AUTOINCREMENT,name,age);",NULL);
``` ```