2018-08-12 16:45:39 +02:00
|
|
|
|
2018-09-02 12:27:23 +02:00
|
|
|
#include <QRegularExpression>
|
2018-08-12 16:45:39 +02:00
|
|
|
#include <QDebug>
|
2018-09-02 12:27:23 +02:00
|
|
|
#include <QSqlError>
|
2018-09-02 13:54:27 +02:00
|
|
|
#include <QStack>
|
2019-04-22 21:07:41 +02:00
|
|
|
#include "searchworker.h"
|
|
|
|
#include "../shared/sqlitesearch.h"
|
2018-08-12 16:45:39 +02:00
|
|
|
SearchWorker::SearchWorker()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
SearchWorker::SearchWorker(const QString &dbpath)
|
|
|
|
{
|
2018-09-02 12:27:23 +02:00
|
|
|
db = QSqlDatabase::addDatabase("QSQLITE");
|
2018-08-12 16:45:39 +02:00
|
|
|
db.setDatabaseName(dbpath);
|
|
|
|
if(!db.open())
|
|
|
|
{
|
|
|
|
qDebug() << "failed to open database";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-09-02 12:27:23 +02:00
|
|
|
void SearchWorker::search(const QString &query)
|
|
|
|
{
|
2019-04-22 21:07:41 +02:00
|
|
|
SqliteSearch searcher(db);
|
|
|
|
emit searchResultsReady(searcher.search(query));
|
2018-09-02 12:27:23 +02:00
|
|
|
}
|
|
|
|
|