Map names to db ident names for columns passed for ordering in paginated queries.
This commit is contained in:
@ -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"
|
||||
|
||||
|
Reference in New Issue
Block a user