summaryrefslogtreecommitdiff
path: root/db.c
diff options
context:
space:
mode:
Diffstat (limited to 'db.c')
-rw-r--r--db.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/db.c b/db.c
index d2b16be..38a24e2 100644
--- a/db.c
+++ b/db.c
@@ -557,7 +557,7 @@ sqlite_uint64 db_add_tag(const char *name, sqlite_uint64 parent) {
}
}
-static void db_remove_tag_walltags(sqlite_uint64 tagid) {
+static void db_clear_tag_walls(sqlite_uint64 tagid) {
sqlite3_stmt *stmt;
int rc;
@@ -578,10 +578,12 @@ static void db_remove_tag_walltags(sqlite_uint64 tagid) {
sqlite3_finalize(stmt);
}
-static void db_remove_tag_tag(sqlite_uint64 tagid) {
+void db_remove_tag(sqlite_uint64 tagid) {
sqlite3_stmt *stmt;
int rc;
+ db_clear_tag_walls(tagid);
+
rc = sqlite3_prepare_v2(db, "DELETE FROM tag WHERE id = ?", -1, &stmt, NULL);
if(rc != SQLITE_OK) {
@@ -599,12 +601,6 @@ static void db_remove_tag_tag(sqlite_uint64 tagid) {
sqlite3_finalize(stmt);
}
-void db_remove_tag(sqlite_uint64 tagid) {
- db_remove_tag_walltags(tagid);
-
- db_remove_tag_tag(tagid);
-}
-
int db_get_tags_all(GArray **array) {
struct tag_t temp, *temp2;
sqlite3_stmt *stmt;