diff --git a/quiz4.c b/quiz4.c index 8cea5fa..7a230d6 100644 --- a/quiz4.c +++ b/quiz4.c @@ -268,25 +268,28 @@ sendjson(struct kreq *req) if (SQLITE_ROW == rc) kjson_putintp(&r, JSON_COUNT, sqlite3_column_int64(stmt, 0)); - else if (SQLITE_DONE == rc) + else if (SQLITE_DONE == rc) { + fputs("sendjson: No value!?", stderr); kjson_putnullp(&r, JSON_COUNT); - // TODO err khtml_puts(&r, "No value!?"); - else + } else { + fputs("sendjson: Error getting value.", stderr); kjson_putnullp(&r, JSON_COUNT); - // TODO err khtml_puts(&r, "Error getting value."); + } sqlite3_finalize(stmt); - } else + } else { + fputs("sendjson: Error getting statement.", stderr); kjson_putnullp(&r, JSON_COUNT); - // TODO err khtml_puts(&r, "Error getting statement."); + } stmt = db_stmt(db, "UPDATE record SET count=count+1", 0); (void)db_step(db, stmt); sqlite3_finalize(stmt); db_close(db); - } else + } else { + fputs("sendjson: Error opening database.", stderr); kjson_putnullp(&r, JSON_COUNT); - // TODO err khtml_puts(&r, "Error opening database."); + } kjson_close(&r); }