Asynchronous query execution now depends on my own mostly C++ based parallel
execution framework instead of the QMetaObject::invokeMethod.
This commit is contained in:
parent
2432be9d72
commit
4dc55288b5
2 changed files with 6 additions and 10 deletions
|
|
@ -148,18 +148,15 @@ void MainWindow::performQuery()
|
|||
queryCancel = std::move(connection->getCancel());
|
||||
|
||||
QString command = ui->queryEdit->toPlainText();
|
||||
queryFuture = std::async(std::launch::async, [this,command]()-> Pgsql::Result
|
||||
std::thread([this,command]()
|
||||
{
|
||||
auto res = connection->query(command);
|
||||
QMetaObject::invokeMethod(this, "query_ready", Qt::QueuedConnection); // queues on main thread
|
||||
return res;
|
||||
});
|
||||
|
||||
auto res = std::make_shared<Pgsql::Result>(connection->query(command));
|
||||
QueueTask([this, res]() { query_ready(std::move(*res)); });
|
||||
}).detach();
|
||||
}
|
||||
|
||||
void MainWindow::query_ready()
|
||||
void MainWindow::query_ready(Pgsql::Result dbres)
|
||||
{
|
||||
pg::Result dbres(std::move(queryFuture.get()));
|
||||
if (dbres) {
|
||||
auto st = dbres.resultStatus();
|
||||
if (st == PGRES_TUPLES_OK) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue