summaryrefslogtreecommitdiff
path: root/db.c
diff options
context:
space:
mode:
Diffstat (limited to 'db.c')
-rw-r--r--db.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/db.c b/db.c
index 29ce639..fe8c6a2 100644
--- a/db.c
+++ b/db.c
@@ -294,6 +294,26 @@ sqlite_uint64 db_get_wallpaper(const char *path) {
return 0;
}
+int db_remove_wallpaper(sqlite_uint64 id) {
+ sqlite3_stmt *stmt;
+ int rc;
+
+ rc = sqlite3_prepare_v2(db, "DELETE FROM wallpaper WHERE id = ?", -1, &stmt, NULL);
+ if(rc != SQLITE_OK) {
+ return 0;
+ }
+
+ rc = sqlite3_bind_int64(stmt, 1, id);
+ if(rc != SQLITE_OK) {
+ sqlite3_finalize(stmt);
+ return 0;
+ }
+
+ rc = sqlite3_step(stmt);
+ sqlite3_finalize(stmt);
+ return rc == SQLITE_DONE;
+}
+
int db_get_wallpaper_data(sqlite_uint64 id, struct wallpaper_t *wall) {
sqlite3_stmt *stmt;
int rc;