diff options
author | Michael McVady <femtonaut@gmail.com> | 2021-11-18 14:45:16 -0500 |
---|---|---|
committer | Michael McVady <femtonaut@gmail.com> | 2021-11-18 14:45:16 -0500 |
commit | 9bd6fe0e5f690970c49ee993e5012bef5868d9ab (patch) | |
tree | 880bab31ea18cb48946b3c5fe3c91337e1cffe5b /src | |
parent | ef14cbf2f0c4431ce6ad618e93316ab7c6d42ff6 (diff) |
Add `created_at` field to DB
Diffstat (limited to 'src')
-rw-r--r-- | src/clog.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -42,8 +42,7 @@ page(struct http_request *req) int row, rows; // Results - char *id; - char *title, *body; + char *id, *title, *created_at, *body; /* req->status = HTTP_STATUS_INTERNAL_ERROR; */ @@ -67,7 +66,7 @@ page(struct http_request *req) * Now we can fire off the query, once it returns we either have * a result on which we can operate or an error occurred. */ - if (!kore_pgsql_query(&sql, "SELECT id, title, body FROM entries ORDER BY id ASC;")) { + if (!kore_pgsql_query(&sql, "SELECT id, title, created_at, body FROM posts ORDER BY id ASC;")) { kore_pgsql_logerror(&sql); goto out; } @@ -78,7 +77,8 @@ page(struct http_request *req) id = kore_pgsql_getvalue(&sql, row, 0); title = kore_pgsql_getvalue(&sql, row, 1); - body = kore_pgsql_getvalue(&sql, row, 2); + created_at = kore_pgsql_getvalue(&sql, row, 2); + body = kore_pgsql_getvalue(&sql, row, 3); kore_log(LOG_NOTICE, "id: '%s'; title '%s'", id, title); struct kore_buf *html_buf = kore_buf_alloc(4096); @@ -93,6 +93,7 @@ page(struct http_request *req) resp_buf, (const char *) asset_post_html, title, + created_at, kore_buf_stringify(html_buf, NULL) ); |