Albert S
cff481a57e
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.
24 lines
567 B
C++
24 lines
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
|