diff options
author | Michael McVady <femtonaut@gmail.com> | 2023-01-15 14:01:59 -0600 |
---|---|---|
committer | Michael McVady <femtonaut@gmail.com> | 2023-01-15 14:01:59 -0600 |
commit | 4bfab86f636f2392f92037058c783c2634ac2060 (patch) | |
tree | 5816a03c9fc7f9a3b993d69a1ecd83b5ec3655e1 /src/queries.h | |
parent | 3ff9bdbcb2cae776579dcfe781276172f05f000c (diff) |
Hack in DELETE method without testing
Diffstat (limited to 'src/queries.h')
-rw-r--r-- | src/queries.h | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/queries.h b/src/queries.h index cae7d59..108b249 100644 --- a/src/queries.h +++ b/src/queries.h @@ -1,23 +1,37 @@ -const char *query_html_post = \ +const char *q_select_html_post = \ "SELECT id, title, created_at::DATE, body " "FROM posts " "WHERE id = $1;"; -const char *query_html_posts = \ +const char *q_select_html_posts = \ "SELECT id, title, created_at::DATE, body " "FROM posts " "ORDER BY updated_at DESC;"; -const char *query_json_post = \ +const char *q_select_json_post = \ "SELECT JSON_AGG(ROW_TO_JSON(row)) FROM (" "SELECT id, title, body, created_at, updated_at " "FROM posts " "WHERE id = $1" ") row;"; -const char *query_json_posts = \ +const char *q_select_json_posts = \ "SELECT JSON_AGG(ROW_TO_JSON(row)) FROM (" "SELECT id, title, body, created_at, updated_at " "FROM posts " "ORDER BY updated_at DESC" ") row;"; + +const char *q_insert_posts = \ +"INSERT INTO posts " +"(id, title, body) " +"VALUES " +"($1, $2, $3) " +"RETURNING id;"; + +const char *q_delete_posts = \ +"DELETE " +"FROM posts " +"WHERE id = $1 " +"RETURNING id;"; + |