RevisionDaoSqlite: Fix cases where we got pageid instead of the page name
This commit is contained in:
parent
d18c0669ce
commit
a81963181a
@ -129,9 +129,8 @@ std::optional<Revision> RevisionDaoSqlite::getCurrentForPage(std::string pagenam
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
auto query = *db << "SELECT (SELECT username FROM user WHERE id = author), comment, content, "
|
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 "
|
"strftime('%s',creationtime), page.name, revisionid FROM revision INNER JOIN page ON revision.page = page.id WHERE page.name = ? AND page.lastrevision = revision.revisionid";
|
||||||
"page WHERE name = ? ) AND revisionid = (SELECT lastrevision FROM page WHERE name = ?)";
|
query << pagename;
|
||||||
query << pagename << pagename;
|
|
||||||
query >>
|
query >>
|
||||||
std::tie(result.author, result.comment, result.content, result.timestamp, result.page, result.revision);
|
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 =
|
auto query =
|
||||||
*db
|
*db
|
||||||
<< "SELECT (SELECT username FROM user WHERE id = author), comment, content, strftime('%s',creationtime), "
|
<< "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 << pagename << revision;
|
||||||
query >>
|
query >>
|
||||||
std::tie(result.author, result.comment, result.content, result.timestamp, result.page, result.revision);
|
std::tie(result.author, result.comment, result.content, result.timestamp, result.page, result.revision);
|
||||||
|
Loading…
Reference in New Issue
Block a user