summary refs log tree commit diff
path: root/database.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--database.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/database.h b/database.h
index 6efe9d0..1dcc71b 100644
--- a/database.h
+++ b/database.h
@@ -44,6 +44,8 @@ enum Type {
 	Topic,
 };
 
+static bool verbose;
+
 static inline void dbExec(sqlite3 *db, const char *sql) {
 	int error = sqlite3_exec(db, sql, NULL, NULL, NULL);
 	if (error) errx(EX_SOFTWARE, "%s: %s", sqlite3_errmsg(db), sql);
@@ -173,6 +175,16 @@ static inline int dbStep(sqlite3_stmt *stmt) {
 	);
 }
 
+static inline void dbRun(sqlite3_stmt *stmt) {
+	dbStep(stmt);
+	if (verbose && sqlite3_changes(sqlite3_db_handle(stmt))) {
+		char *sql = sqlite3_expanded_sql(stmt);
+		if (sql) fprintf(stderr, "%s\n", sql);
+		sqlite3_free(sql);
+	}
+	sqlite3_reset(stmt);
+}
+
 static inline int dbVersion(sqlite3 *db) {
 	sqlite3_stmt *stmt = dbPrepare(db, false, SQL(PRAGMA user_version;));
 	dbStep(stmt);
'2020-07-08 19:09:45 +0000'>2020-07-08Add facebook and twitter to title user-agentJune McEnroe This fixes fetching tweets again! https://github.com/thelounge/thelounge/pull/ 3602 (Intentionally breaking the link so GitHub doesn't add a "referenced this PR" thing?) 2020-06-30Tweak causal.agency for mostly no reasonJune McEnroe 2020-06-30Add Ancillary JusticeJune McEnroe 2020-06-26Add password non-manager to planJune McEnroe I've had this idea for years... 2020-06-26Tweak TF2 sensitivities once moreJune McEnroe 2020-06-19Add note about litterbox bot useJune McEnroe 2020-06-19Publish "IRC suite"June McEnroe 2020-06-17Add errors to link.shJune McEnroe