aboutsummaryrefslogtreecommitdiff
path: root/src/queries.h
diff options
context:
space:
mode:
authorMichael McVady <femtonaut@gmail.com>2024-01-16 21:32:22 -0600
committerMichael McVady <femtonaut@gmail.com>2024-01-16 21:32:22 -0600
commit2d92280f0e7e605911da199757fa33d2b5089b0a (patch)
tree49987dc668ea478dfee21310c05feb02261e90f2 /src/queries.h
parent7906e579ce5023ec85070b40a3d96bbcaa07d166 (diff)
Support creating new entries
Diffstat (limited to 'src/queries.h')
-rw-r--r--src/queries.h5
1 files changed, 5 insertions, 0 deletions
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) "