Database: PageDao/CategoryDao: Return 'Page' object, not pagename string
This commit is contained in:
@@ -127,21 +127,28 @@ void PageDaoSqlite::save(const Page &page)
|
||||
throwFrom(e);
|
||||
}
|
||||
}
|
||||
std::vector<std::string> PageDaoSqlite::getPageList(QueryOption option)
|
||||
|
||||
std::vector<Page> PageDaoSqlite::getPageList(QueryOption option)
|
||||
{
|
||||
std::vector<std::string> result;
|
||||
std::vector<Page> result;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
std::string queryOption = SqliteQueryOption(option)
|
||||
.setOrderByColumn("lower(name)")
|
||||
.setVisibleColumnName("visible")
|
||||
.setPrependWhere(true)
|
||||
.build();
|
||||
std::string query = "SELECT name FROM page " + queryOption;
|
||||
std::string query = "SELECT id, name, title, lastrevision, visible FROM page " + queryOption;
|
||||
*db << query >> [&](unsigned int pageid, std::string name, std::string title,unsigned int current_revision, bool visible ) {
|
||||
|
||||
*db << query >> [&](std::string name) { result.push_back(name); };
|
||||
Page tmp;
|
||||
tmp.pageid = pageid;
|
||||
tmp.name = name;
|
||||
tmp.title = title;
|
||||
tmp.current_revision = current_revision;
|
||||
tmp.listed = visible;
|
||||
result.push_back(tmp); };
|
||||
}
|
||||
catch(const sqlite::errors::no_rows &e)
|
||||
{
|
||||
|
Reference in New Issue
Block a user