28 lines
1.1 KiB
C
28 lines
1.1 KiB
C
#include "cli.h"
|
|
#include "sorm.h"
|
|
|
|
int main() {
|
|
int db = sormc("db.sqlite3");
|
|
// sormq(db,"DROP TABLE IF EXISTS pony;");
|
|
printf("%d\n", db);
|
|
sormq(db, "CREATE TABLE IF NOT EXISTS pony (id INTEGER PRIMARY KEY AUTOINCREMENT,name,age);", NULL);
|
|
sorm_pk iid = sormq(db, "INSERT INTO pony (id,name,age) VALUES (NULL,%s,%d);", "Teenii", 19);
|
|
iid = sormq(db, "INSERT INTO pony (id,name,age) VALUES (NULL,%s,%d);", "Amber", 20);
|
|
iid = sormq(db, "INSERT INTO pony (id,name,age) VALUES (NULL,%s,%d);", "Feuerherz", 20);
|
|
|
|
iid = sormq(db, "INSERT INTO pony (id,name,age) VALUES (NULL,%s,%d);", "Retoor", 34);
|
|
sorm_str csv = sormq(db, "SELECT * FROM pony WHERE id in (?i,?i,?i)", 1, 2, 3);
|
|
sorm_str csv2 = sormq(db, "SELECT * FROM pony WHERE id = %d and age = %d ", 1, 33);
|
|
sorm_str csv3 = sormq(db, "SELECT * FROM pony LIMIT 2");
|
|
// free(csv3);
|
|
// free(csv2);
|
|
if (csv2)
|
|
printf("%s\n", csv2);
|
|
printf("%s\n", csv3);
|
|
free(csv3);
|
|
sormd(db);
|
|
printf("%s\n", rmalloc_stats());
|
|
db = sormc("db.sqlite3");
|
|
sormrepl(db);
|
|
}
|