Map names to db ident names for columns passed for ordering in paginated queries.

This commit is contained in:
2023-08-09 09:16:10 -05:00
parent fbd20de71f
commit fb74d84cb7
2 changed files with 4 additions and 4 deletions

View File

@ -438,7 +438,7 @@ template findRecordsWhere*[D: DbConnType](
if page.isSome:
let p = page.get
if p.orderBy.isSome:
fetchStmt &= " ORDER BY " & p.orderBy.get
fetchStmt &= " ORDER BY " & identNameToDb(p.orderBy.get)
else:
fetchStmt &= " ORDER BY id"
@ -469,7 +469,7 @@ template getAllRecords*[D: DbConnType](
if page.isSome:
let p = page.get
if p.orderBy.isSome:
fetchStmt &= " ORDER BY " & p.orderBy.get
fetchStmt &= " ORDER BY " & identNameToDb(p.orderBy.get)
else:
fetchStmt &= " ORDER BY id"
@ -508,7 +508,7 @@ template findRecordsBy*[D: DbConnType](
if page.isSome:
let p = page.get
if p.orderBy.isSome:
fetchStmt &= " ORDER BY " & p.orderBy.get
fetchStmt &= " ORDER BY " & identNameToDb(p.orderBy.get)
else:
fetchStmt &= " ORDER BY id"