mirror of
https://gitlab.cvh-server.de/skrause/flashcards.git
synced 2025-12-12 09:01:37 +01:00
replace deprecated classes, update code, fix errors, add missing stuff
This commit is contained in:
@@ -69,8 +69,29 @@ void database_create_tables()
|
||||
sqlite3_finalize(stmt);
|
||||
}
|
||||
|
||||
void database_save_category()
|
||||
void database_save_category(const char *c)
|
||||
{
|
||||
int rc;
|
||||
sqlite3_stmt *stmt;
|
||||
|
||||
fprintf(stdout, "%s\n", c);
|
||||
rc = sqlite3_prepare_v2(db, "INSERT INTO categories (name) VALUES(?)", -1, &stmt, 0);
|
||||
|
||||
if (rc == SQLITE_OK)
|
||||
{
|
||||
sqlite3_bind_text(stmt, 1, c, -1, SQLITE_STATIC);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Failed to execute statement: %s\n", sqlite3_errmsg(db));
|
||||
}
|
||||
|
||||
rc = sqlite3_step(stmt);
|
||||
if (rc != SQLITE_OK)
|
||||
{
|
||||
fprintf(stderr, "Failed to execute statement: %s\n", sqlite3_errmsg(db));
|
||||
}
|
||||
sqlite3_finalize(stmt);
|
||||
}
|
||||
|
||||
GArray *database_load_categories()
|
||||
|
||||
Reference in New Issue
Block a user