From 86aa5e4d1e1685dd33cd4ecff004cc2e68bff716 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Sun, 9 Jan 2022 01:32:33 +0000 Subject: [PATCH] Better feedback when importing. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3743 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- src/ssb.db.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ssb.db.c b/src/ssb.db.c index be4431df..2ca59603 100644 --- a/src/ssb.db.c +++ b/src/ssb.db.c @@ -219,12 +219,15 @@ bool tf_ssb_db_blob_store(tf_ssb_t* ssb, const uint8_t* blob, size_t size, char* char id[512]; snprintf(id, sizeof(id), "&%s.sha256", hash64); + int rows = 0; + if (sqlite3_prepare(db, "INSERT INTO blobs (id, content, created) VALUES ($1, $2, CAST(strftime('%s') AS INTEGER)) ON CONFLICT DO NOTHING", -1, &statement, NULL) == SQLITE_OK) { if (sqlite3_bind_text(statement, 1, id, -1, NULL) == SQLITE_OK && sqlite3_bind_blob(statement, 2, blob, size, NULL) == SQLITE_OK) { result = sqlite3_step(statement) == SQLITE_DONE; + rows = sqlite3_changes(db); } else { @@ -237,7 +240,10 @@ bool tf_ssb_db_blob_store(tf_ssb_t* ssb, const uint8_t* blob, size_t size, char* printf("prepare failed: %s\n", sqlite3_errmsg(db)); } - printf("blob store %s %zd => %d\n", id, size, result); + if (rows) + { + printf("blob stored %s %zd => %d\n", id, size, result); + } if (result) {