From f810fe19b8152a32254133680e3d6f506e2277e6 Mon Sep 17 00:00:00 2001 From: Michael McVady Date: Thu, 11 Jan 2024 23:43:25 -0600 Subject: Just keep hacking --- src/queries.h | 53 ++++++++++++++++++++++++----------------------------- 1 file changed, 24 insertions(+), 29 deletions(-) (limited to 'src/queries.h') diff --git a/src/queries.h b/src/queries.h index c0bd1dc..3956129 100644 --- a/src/queries.h +++ b/src/queries.h @@ -1,40 +1,35 @@ const char *q_select_entry = -"SELECT id, title, created_at::DATE, body " +"SELECT id, title, created_at::DATE, updated_at::DATE, body " "FROM entries " "WHERE id = $1;"; const char *q_select_entries = -"SELECT id, title, created_at::DATE, body " +"SELECT id, title, created_at::DATE, updated_at::DATE, body " "FROM entries " "ORDER BY updated_at DESC;"; -const char *q_select_index = -"SELECT id, title, created_at::DATE, updated_at::DATE " -"FROM entries " -"ORDER BY updated_at DESC;"; +// const char *q_insert_entry = +// "INSERT INTO entries " +// "(title, body) " +// "VALUES " +// "($1, $2) " +// "RETURNING id;"; -const char *q_insert_entry = -"INSERT INTO entries " -"(title, body) " -"VALUES " -"($1, $2) " -"RETURNING id;"; +// const char *q_insert_entry_with_id = +// "INSERT INTO entries " +// "(id, title, body) " +// "VALUES " +// "($1, $2, $3) " +// "RETURNING id;"; -const char *q_insert_entry_with_id = -"INSERT INTO entries " -"(id, title, body) " -"VALUES " -"($1, $2, $3) " -"RETURNING id;"; +// const char *q_update_entry = +// "UPDATE entries " +// "SET title = $1, body = $2, updated_at = NOW() " +// "WHERE id = $3 " +// "RETURNING id;"; -const char *q_update_entry = -"UPDATE entries " -"SET title = $1, body = $2, updated_at = NOW() " -"WHERE id = $3 " -"RETURNING id;"; - -const char *q_delete_entry = -"DELETE " -"FROM entries " -"WHERE id = $1 " -"RETURNING id;"; +// const char *q_delete_entry = +// "DELETE " +// "FROM entries " +// "WHERE id = $1 " +// "RETURNING id;"; -- cgit v1.2.3