helper function to get newest id

This commit is contained in:
SuperNovaa41 2025-02-28 14:03:12 -05:00
parent 5027238879
commit 66c9c45c93

View File

@ -4,6 +4,19 @@
#include "include/db.h"
static int get_num_rows(sqlite3* db)
{
int rows = 0;
sqlite3_stmt* msg;
sqlite3_prepare(db, "SELECT * FROM books;", -1, &msg, NULL);
while (sqlite3_step(msg) == SQLITE_ROW)
rows++;
sqlite3_finalize(msg);
return rows;
}
void setup_db(sqlite3* db)
{
int err;