#ifndef SQLITEDBSERVICE_H #define SQLITEDBSERVICE_H #include #include #include "databasefactory.h" #include "utils.h" #include "pagedata.h" #include "filedata.h" #include "../shared/sqlitesearch.h" #include "../shared/token.h" #include "savefileresult.h" class SqliteDbService { private: DatabaseFactory *dbFactory = nullptr; bool insertToFTS(bool useTrigrams, QSqlDatabase &db, int fileid, QVector &pageData); QSqlQuery exec(QString query, std::initializer_list args); bool execBool(QString querystr, std::initializer_list args); public: SqliteDbService(DatabaseFactory &dbFactory); SaveFileResult saveFile(QFileInfo fileInfo, QVector &pageData, bool pathsOnly); bool deleteFile(QString path); bool fileExistsInDatabase(QString path); bool fileExistsInDatabase(QString path, qint64 mtime); bool fileExistsInDatabase(QString path, qint64 mtime, QChar filetype); unsigned int getFiles(QVector &results, QString wildCardPattern, int offset, int limit); bool addTag(QString tag, QString path); bool addTag(QString tag, const QVector &paths); QVector getTags(); QVector getTagsForPath(QString path); QVector getPathsForTag(QString path); bool setTags(QString path, const QSet &tags); bool removePathsForTag(QString tag, const QVector &paths); bool deleteTag(QString tag); QVector search(const LooqsQuery &query); std::optional queryFileType(QString absPath); }; #endif // SQLITEDBSERVICE_H