2019-04-20 23:31:14 +02:00
|
|
|
#ifndef SQLITESEARCH_H
|
|
|
|
#define SQLITESEARCH_H
|
|
|
|
#include <QSqlDatabase>
|
2019-04-25 10:27:54 +02:00
|
|
|
#include <QPair>
|
2019-04-22 21:07:41 +02:00
|
|
|
#include "searchresult.h"
|
2019-08-17 11:06:35 +02:00
|
|
|
#include "token.h"
|
|
|
|
#include "../shared/qssquery.h"
|
2019-04-20 23:31:14 +02:00
|
|
|
class SqliteSearch
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
SqliteSearch(QSqlDatabase &db);
|
2019-08-17 11:06:35 +02:00
|
|
|
QVector<SearchResult> search(const QSSQuery &query);
|
2019-04-20 23:31:14 +02:00
|
|
|
|
2019-04-25 10:27:54 +02:00
|
|
|
private:
|
|
|
|
QSqlDatabase *db;
|
2019-08-17 11:06:35 +02:00
|
|
|
QSqlQuery makeSqlQuery(const QSSQuery &query);
|
|
|
|
QString fieldToColumn(QueryField field);
|
2019-04-25 10:27:54 +02:00
|
|
|
QPair<QString, QVector<QString> > createSql(const Token &token);
|
2019-08-17 11:06:35 +02:00
|
|
|
QString createSortSql(const QVector<SortCondition> sortConditions);
|
2019-04-20 23:31:14 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // SQLITESEARCH_H
|