revisiondaosqlite: fix sorting
This commit is contained in:
parent
22f39eb8d8
commit
08968935a4
@ -54,7 +54,7 @@ std::vector<Revision> RevisionDaoSqlite::getAllRevisions(QueryOption &options)
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
SqliteQueryOption queryOption { options };
|
SqliteQueryOption queryOption { options };
|
||||||
std::string queryOptionSql = queryOption.setPrependWhere(true).setVisibleColumnName("page.visible").setOrderByColumn("revisionid").build();
|
std::string queryOptionSql = queryOption.setPrependWhere(true).setVisibleColumnName("page.visible").setOrderByColumn("creationtime").build();
|
||||||
auto query = *db << "SELECT (SELECT username FROM user WHERE id = author), comment, content, strftime('%s',creationtime), page.name, revisionid FROM revision INNER JOIN page ON revision.page = page.id " + queryOptionSql;
|
auto query = *db << "SELECT (SELECT username FROM user WHERE id = author), comment, content, strftime('%s',creationtime), page.name, revisionid FROM revision INNER JOIN page ON revision.page = page.id " + queryOptionSql;
|
||||||
query >> [&](std::string author, std::string comment, std::string content, time_t creationtime, std::string page, unsigned int revisionid)
|
query >> [&](std::string author, std::string comment, std::string content, time_t creationtime, std::string page, unsigned int revisionid)
|
||||||
{
|
{
|
||||||
@ -86,7 +86,7 @@ std::vector<Revision> RevisionDaoSqlite::getAllRevisionsForPage(std::string page
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
SqliteQueryOption queryOption { option };
|
SqliteQueryOption queryOption { option };
|
||||||
std::string queryOptionSql = queryOption.setPrependWhere(false).setVisibleColumnName("page.visible").setOrderByColumn("revisionid").build();
|
std::string queryOptionSql = queryOption.setPrependWhere(false).setVisibleColumnName("page.visible").setOrderByColumn("creationtime").build();
|
||||||
auto query = *db << "SELECT (SELECT username FROM user WHERE id = author), comment, content, strftime('%s',creationtime), page.name, revisionid FROM revision INNER JOIN page ON revision.page = page.id WHERE page.name = ? AND " + queryOptionSql << pagename;
|
auto query = *db << "SELECT (SELECT username FROM user WHERE id = author), comment, content, strftime('%s',creationtime), page.name, revisionid FROM revision INNER JOIN page ON revision.page = page.id WHERE page.name = ? AND " + queryOptionSql << pagename;
|
||||||
|
|
||||||
query >> [&](std::string author, std::string comment, std::string content, time_t creationtime, std::string page, unsigned int revisionid)
|
query >> [&](std::string author, std::string comment, std::string content, time_t creationtime, std::string page, unsigned int revisionid)
|
||||||
|
Loading…
Reference in New Issue
Block a user