fix: use ${param}$ SQL format in plugin queries
This commit is contained in:
parent
b1319a9f1e
commit
6dcfad8c5a
@ -51,9 +51,9 @@ async def get_published_content(content_type, limit=10):
|
|||||||
"c.tags, c.body, cat.name as category_name "
|
"c.tags, c.body, cat.name as category_name "
|
||||||
"FROM cms_content c "
|
"FROM cms_content c "
|
||||||
"LEFT JOIN cms_categories cat ON c.category_id = cat.id "
|
"LEFT JOIN cms_categories cat ON c.category_id = cat.id "
|
||||||
"WHERE c.content_type = %(ct)s AND c.status = 'published' "
|
"WHERE c.content_type = ${ct}$ AND c.status = 'published' "
|
||||||
"ORDER BY c.sort_order, c.created_at DESC "
|
"ORDER BY c.sort_order, c.created_at DESC "
|
||||||
"LIMIT %(lim)s",
|
"LIMIT ${lim}$",
|
||||||
{"ct": content_type, "lim": int(limit)}
|
{"ct": content_type, "lim": int(limit)}
|
||||||
)
|
)
|
||||||
return list(rows)
|
return list(rows)
|
||||||
@ -73,7 +73,7 @@ async def get_latest_news(limit=3):
|
|||||||
"LEFT JOIN cms_categories cat ON c.category_id = cat.id "
|
"LEFT JOIN cms_categories cat ON c.category_id = cat.id "
|
||||||
"WHERE c.content_type = 'news' AND c.status = 'published' "
|
"WHERE c.content_type = 'news' AND c.status = 'published' "
|
||||||
"ORDER BY c.published_at DESC, c.created_at DESC "
|
"ORDER BY c.published_at DESC, c.created_at DESC "
|
||||||
"LIMIT %(lim)s",
|
"LIMIT ${lim}$",
|
||||||
{"lim": int(limit)}
|
{"lim": int(limit)}
|
||||||
)
|
)
|
||||||
return list(rows)
|
return list(rows)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user