diff options
Diffstat (limited to 'src/clog.c')
-rw-r--r-- | src/clog.c | 21 |
1 files changed, 6 insertions, 15 deletions
@@ -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, |