qswiki/database/pagedaosqlite.h

33 lines
1.0 KiB
C
Raw Permalink Normal View History

2018-11-03 17:12:20 +01:00
#ifndef PAGEDAOSQLITE_H
#define PAGEDAOSQLITE_H
#include <string>
#include <optional>
#include <sqlite3.h>
#include "../page.h"
#include "pagedao.h"
#include "sqlitedao.h"
class PageDaoSqlite : public PageDao, protected SqliteDao
{
private:
std::string ftsEscape(std::string input);
2018-11-03 17:12:20 +01:00
public:
PageDaoSqlite()
{
}
void deletePage(std::string page) override;
2018-11-04 19:31:58 +01:00
bool exists(unsigned int id) const override;
2018-11-03 17:12:20 +01:00
bool exists(std::string name) const override;
void save(const Page &page) override;
std::optional<Page> find(std::string name) override;
2018-11-04 19:31:58 +01:00
std::optional<Page> find(unsigned int id) override;
2018-11-03 17:12:20 +01:00
std::vector<std::string> getPageList(QueryOption option) override;
std::vector<std::string> fetchCategories(std::string pagename, QueryOption option) override;
using SqliteDao::SqliteDao;
int fetchPageId(std::string pagename);
std::vector<SearchResult> search(std::string query, QueryOption option) override;
void setCategories(std::string pagename, const std::vector<std::string> &catnames) override;
};
#endif // PAGEDAOSQLITE_H