Fix SQLite page list query

This commit is contained in:
Daniel J. Summers 2024-01-20 14:52:17 -05:00
parent a0ab99f737
commit 5ce84e18ca
2 changed files with 3 additions and 3 deletions

View File

@ -53,7 +53,7 @@ type SQLitePageData(conn: SqliteConnection, log: ILogger) =
let countListed webLogId = let countListed webLogId =
log.LogTrace "Page.countListed" log.LogTrace "Page.countListed"
conn.customScalar conn.customScalar
$"""{Document.Query.countByWebLog Table.Page} AND {Query.whereByField pgListName EQ "'true'"}""" $"""{Document.Query.countByWebLog Table.Page} AND {Query.whereByField pgListName EQ "true"}"""
[ webLogParam webLogId ] [ webLogParam webLogId ]
(toCount >> int) (toCount >> int)
@ -116,7 +116,7 @@ type SQLitePageData(conn: SqliteConnection, log: ILogger) =
let findListed webLogId = let findListed webLogId =
log.LogTrace "Page.findListed" log.LogTrace "Page.findListed"
conn.customList conn.customList
$"""{Document.Query.selectByWebLog Table.Page} AND {Query.whereByField pgListName EQ "'true'"} $"""{Document.Query.selectByWebLog Table.Page} AND {Query.whereByField pgListName EQ "true"}
ORDER BY LOWER({titleField})""" ORDER BY LOWER({titleField})"""
[ webLogParam webLogId ] [ webLogParam webLogId ]
(fun rdr -> { fromData<Page> rdr with Text = "" }) (fun rdr -> { fromData<Page> rdr with Text = "" })

View File

@ -49,7 +49,7 @@ type SQLiteWebLogUserData(conn: SqliteConnection, log: ILogger) =
/// Find the names of users by their IDs for the given web log /// Find the names of users by their IDs for the given web log
let findNames webLogId (userIds: WebLogUserId list) = let findNames webLogId (userIds: WebLogUserId list) =
log.LogTrace "WebLogUser.findNames" log.LogTrace "WebLogUser.findNames"
let nameSql, nameParams = inClause "AND data ->> 'Id'" "id" string userIds let nameSql, nameParams = inClause $"AND data ->> '{nameof WebLogUser.Empty.Id}'" "id" string userIds
conn.customList conn.customList
$"{Document.Query.selectByWebLog Table.WebLogUser} {nameSql}" $"{Document.Query.selectByWebLog Table.WebLogUser} {nameSql}"
(webLogParam webLogId :: nameParams) (webLogParam webLogId :: nameParams)