From 5197e3f8f47b60c485d881a676cae4b43b1fd8e7 Mon Sep 17 00:00:00 2001 From: Gerben Aaltink Date: Fri, 22 Nov 2024 14:01:51 +0100 Subject: [PATCH] Added content --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index d23e25c..6aa33c0 100644 --- a/README.md +++ b/README.md @@ -24,23 +24,23 @@ The python library is low quality. I made it just for fun and test. This is not ## C API examples: ### Connecting -``` +```c int db = sormc("db.sqlite3"); ``` ### Create table This one should return True if executed. -``` +```c sormq(db, "CREATE TABLE IF NOT EXISTS pony (id INTEGER PRIMARY KEY AUTOINCREMENT,name,age);",NULL); ``` ### Inserting -``` +```c sorm_pk iid = sormq(db, "INSERT INTO pony (id, name, age) VALUES (NULL, %s, %d);", "Retoorded retoor", 42 ); ``` Using `?` is also possible for arguments like this (comfy for Python usage): -``` +```c sorm_pk iid = sormq(db, "INSERT INTO pony (id, name, age) VALUES (NULL, ?s, ?d);", "Retoorded retoor", 42 @@ -48,18 +48,18 @@ sorm_pk iid = sormq(db, "INSERT INTO pony (id, name, age) VALUES (NULL, ?s, ?d); ``` ### Selecting IN query -``` +```c sorm_str csv = sormq(db, "SELECT * FROM pony WHERE id in (?d,?d,?d)",1,2,3); free(sorm_str); ``` LIKE query -``` +```c sorm_str csv2 = sormq(db, "SELECT * FROM pony WHERE id > %d and age = %d AND name LIKE ?s", 1, 34, "%toor%")); free(sorm_str); ``` Yes, you did see that right, you can use the default native free! ### Disconnecting -``` +```c sormd(db); ```