25 lines
969 B
C
Raw Normal View History

2024-11-22 13:45:03 +00:00
#include "cli.h"
2024-11-22 14:51:47 +00:00
#include "sorm.h"
2024-11-22 13:45:03 +00:00
int main() {
int db = sormc("db.sqlite3");
2024-11-22 14:51:47 +00:00
// sormq(db,"DROP TABLE IF EXISTS pony;");
sormq(db, "CREATE TABLE IF NOT EXISTS pony (id INTEGER PRIMARY KEY AUTOINCREMENT,name,age);", NULL);
2024-12-08 19:27:05 +00:00
sormq(db, "INSERT INTO pony (id,name,age) VALUES (NULL,%s,%d);", "Teenii", 19);
sormq(db, "INSERT INTO pony (id,name,age) VALUES (NULL,%s,%d);", "Amber", 20);
sormq(db, "INSERT INTO pony (id,name,age) VALUES (NULL,%s,%d);", "Feuerherz", 20);
sormq(db, "INSERT INTO pony (id,name,age) VALUES (NULL,%s,%d);", "Retoor", 34);
sorm_str csv2 = (sorm_str)sormq(db, "SELECT * FROM pony WHERE id = %d and age = %d ", 1, 33);
sorm_str csv3 = (sorm_str)sormq(db, "SELECT * FROM pony LIMIT 2");
2024-11-22 14:51:47 +00:00
// free(csv3);
// free(csv2);
if (csv2)
printf("%s\n", csv2);
printf("%s\n", csv3);
2024-11-22 13:45:03 +00:00
free(csv3);
sormd(db);
2024-11-22 14:51:47 +00:00
printf("%s\n", rmalloc_stats());
2024-11-22 13:45:03 +00:00
db = sormc("db.sqlite3");
sormrepl(db);
}