1
0
looqs/shared/sqlitesearch.h
Albert S cff481a57e Refactor search queries: Introduced QSSQuery
Purpose is to seperate certain logic from SQLite and generalize it more.
Even though we only have Sqlite atm, in general the database layers
must be stupid as possible, while QSSQuery should do most of the hard work.

Fixes in Tokenizer logic.
Switched to C++17.
2019-08-18 00:25:21 +02:00

24 Zeilen
567 B
C++

#ifndef SQLITESEARCH_H
#define SQLITESEARCH_H
#include <QSqlDatabase>
#include <QPair>
#include "searchresult.h"
#include "token.h"
#include "../shared/qssquery.h"
class SqliteSearch
{
public:
SqliteSearch(QSqlDatabase &db);
QVector<SearchResult> search(const QSSQuery &query);
private:
QSqlDatabase *db;
QSqlQuery makeSqlQuery(const QSSQuery &query);
QString fieldToColumn(QueryField field);
QPair<QString, QVector<QString>> createSql(const Token &token);
QString createSortSql(const QVector<SortCondition> sortConditions);
};
#endif // SQLITESEARCH_H