aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/clog.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/src/clog.c b/src/clog.c
index 3ef2121..83f9f79 100644
--- a/src/clog.c
+++ b/src/clog.c
@@ -320,6 +320,7 @@ render_posts_json(struct post_request *post_req)
") row;"
);
}
+
if (err == KORE_RESULT_ERROR)
{
post_req->resp_status = HTTP_STATUS_INTERNAL_ERROR;
@@ -327,24 +328,14 @@ render_posts_json(struct post_request *post_req)
goto out;
}
- rows = kore_pgsql_ntuples(&sql);
- kore_log(LOG_DEBUG, "JSON rows: %d", rows);
-
- int fields = kore_pgsql_nfields(&sql);
- kore_log(LOG_DEBUG, "JSON fields: %d", fields);
-
- int len = kore_pgsql_getlength(&sql, 0, 0);
- kore_log(LOG_DEBUG, "JSON fields: %d", fields);
-
- kore_pgsql_logerror(&sql);
+ if (kore_pgsql_getlength(&sql, 0, 0) == 0)
+ {
+ post_req->resp_status = HTTP_STATUS_NOT_FOUND;
+ goto out;
+ }
if (rows == 1) {
json = kore_pgsql_getvalue(&sql, 0, 0);
- kore_log(LOG_DEBUG, "JSON data: %s", json);
-
- len = kore_pgsql_getlength(&sql, 0, 0);
- kore_log(LOG_DEBUG, "JSON data len: %d", len);
-
kore_buf_append(
post_req->resp_buf,
json,