RevisionDaoSqlite: Fix cases where we got pageid instead of the page name

This commit is contained in:
Albert S. 2022-08-20 11:24:08 +02:00
szülő d18c0669ce
commit a81963181a

Fájl megtekintése

@ -129,9 +129,8 @@ std::optional<Revision> RevisionDaoSqlite::getCurrentForPage(std::string pagenam
try
{
auto query = *db << "SELECT (SELECT username FROM user WHERE id = author), comment, content, "
"strftime('%s',creationtime), page, revisionid FROM revision WHERE page = (SELECT id FROM "
"page WHERE name = ? ) AND revisionid = (SELECT lastrevision FROM page WHERE name = ?)";
query << pagename << pagename;
"strftime('%s',creationtime), page.name, revisionid FROM revision INNER JOIN page ON revision.page = page.id WHERE page.name = ? AND page.lastrevision = revision.revisionid";
query << pagename;
query >>
std::tie(result.author, result.comment, result.content, result.timestamp, result.page, result.revision);
}
@ -155,7 +154,7 @@ std::optional<Revision> RevisionDaoSqlite::getRevisionForPage(std::string pagena
auto query =
*db
<< "SELECT (SELECT username FROM user WHERE id = author), comment, content, strftime('%s',creationtime), "
"page, revisionid FROM revision WHERE page = (SELECT id FROM page WHERE name = ? ) AND revisionid = ?";
"page.name, revisionid FROM revision INNER JOIN page ON revision.page = page.id WHERE page.name = ? AND revisionid = ? ";
query << pagename << revision;
query >>
std::tie(result.author, result.comment, result.content, result.timestamp, result.page, result.revision);