Error log

This commit is contained in:
Meutel 2016-12-18 12:27:32 +01:00
parent 7b3ddf5cc9
commit 1319e18e58

19
quiz4.c
View File

@ -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);
}