From 12b4a666bc730cb46ba5da6b576905166d249eff Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 12 Dec 2014 21:21:56 +0100 Subject: lib/sqlite/Util: add ExecuteModified() --- src/sticker/StickerDatabase.cxx | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'src/sticker') diff --git a/src/sticker/StickerDatabase.cxx b/src/sticker/StickerDatabase.cxx index 049750608..fd5cbd3ae 100644 --- a/src/sticker/StickerDatabase.cxx +++ b/src/sticker/StickerDatabase.cxx @@ -224,15 +224,14 @@ sticker_update_value(const char *type, const char *uri, if (!BindAll(stmt, value, type, uri, name)) return false; - int ret = ExecuteChanges(stmt); - if (ret < 0) - return false; + bool modified = ExecuteModified(stmt); sqlite3_reset(stmt); sqlite3_clear_bindings(stmt); - idle_add(IDLE_STICKER); - return ret > 0; + if (modified) + idle_add(IDLE_STICKER); + return modified; } static bool @@ -291,14 +290,14 @@ sticker_delete(const char *type, const char *uri) if (!BindAll(stmt, type, uri)) return false; - if (!ExecuteCommand(stmt)) - return false; + bool modified = ExecuteModified(stmt); sqlite3_reset(stmt); sqlite3_clear_bindings(stmt); - idle_add(IDLE_STICKER); - return true; + if (modified) + idle_add(IDLE_STICKER); + return modified; } bool @@ -313,15 +312,14 @@ sticker_delete_value(const char *type, const char *uri, const char *name) if (!BindAll(stmt, type, uri, name)) return false; - int ret = ExecuteChanges(stmt); - if (ret < 0) - return false; + bool modified = ExecuteModified(stmt); sqlite3_reset(stmt); sqlite3_clear_bindings(stmt); - idle_add(IDLE_STICKER); - return ret > 0; + if (modified) + idle_add(IDLE_STICKER); + return modified; } void -- cgit v1.2.3