From 2d92280f0e7e605911da199757fa33d2b5089b0a Mon Sep 17 00:00:00 2001 From: Michael McVady Date: Tue, 16 Jan 2024 21:32:22 -0600 Subject: Support creating new entries --- src/queries.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/queries.h') diff --git a/src/queries.h b/src/queries.h index 9e90581..696d42a 100644 --- a/src/queries.h +++ b/src/queries.h @@ -19,6 +19,11 @@ const char *q_search_entries = ") " "SELECT id, title, created_at::DATE, updated_at::DATE, body FROM query;"; +const char *q_insert_entry = +"INSERT INTO entries (title, body, search_vector) " +"VALUES ($1, $2, TO_TSVECTOR('english', $3)) " +"RETURNING id;"; + const char *q_update_entry = "UPDATE entries " "SET title = $1, body = $2, updated_at = NOW(), search_vector = TO_TSVECTOR('english', $3) " -- cgit v1.2.3