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/lib/sqlite/Util.hxx | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/lib/sqlite') diff --git a/src/lib/sqlite/Util.hxx b/src/lib/sqlite/Util.hxx index 3a7d34a13..fbc773ed4 100644 --- a/src/lib/sqlite/Util.hxx +++ b/src/lib/sqlite/Util.hxx @@ -137,6 +137,17 @@ ExecuteChanges(sqlite3_stmt *stmt) return sqlite3_changes(sqlite3_db_handle(stmt)); } +/** + * Wrapper for ExecuteChanges() that returns true if at least one row + * was modified. Returns false if nothing was modified or if an error + * occurred. + */ +static inline bool +ExecuteModified(sqlite3_stmt *stmt) +{ + return ExecuteChanges(stmt) > 0; +} + template static inline bool ExecuteForEach(sqlite3_stmt *stmt, F &&f) -- cgit v1.2.3