aboutsummaryrefslogtreecommitdiff
path: root/src/queries.h
blob: cae7d5924340ec4ef93c5b0d0adc4adf4e6f5889 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const char *query_html_post = \
"SELECT id, title, created_at::DATE, body "
"FROM posts "
"WHERE id = $1;";

const char *query_html_posts = \
"SELECT id, title, created_at::DATE, body "
"FROM posts "
"ORDER BY updated_at DESC;";

const char *query_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 = \
"SELECT JSON_AGG(ROW_TO_JSON(row)) FROM ("
	"SELECT id, title, body, created_at, updated_at "
	"FROM posts "
	"ORDER BY updated_at DESC"
") row;";