Explain works with parameters to now.
Also de deduplicated the callback lambda in the normal query execution.
This commit is contained in:
parent
e9d72d391d
commit
397138eef1
1 changed files with 34 additions and 33 deletions
|
|
@ -160,19 +160,15 @@ void QueryTab::execute()
|
|||
std::string cmd = getCommandUtf8();
|
||||
m_stopwatch.start();
|
||||
|
||||
auto cb = [this](Expected<std::shared_ptr<Pgsql::Result>> res, qint64 elapsedms)
|
||||
{
|
||||
m_win->QueueTask([this, res, elapsedms]() { query_ready(res, elapsedms); });
|
||||
};
|
||||
|
||||
if (m_queryParamListController->empty())
|
||||
m_dbConnection.send(cmd,
|
||||
[this](Expected<std::shared_ptr<Pgsql::Result>> res, qint64 elapsedms)
|
||||
{
|
||||
m_win->QueueTask([this, res, elapsedms]() { query_ready(res, elapsedms); });
|
||||
});
|
||||
m_dbConnection.send(cmd, cb);
|
||||
else
|
||||
m_dbConnection.send(cmd,
|
||||
m_queryParamListController->params(),
|
||||
[this](Expected<std::shared_ptr<Pgsql::Result>> res, qint64 elapsedms)
|
||||
{
|
||||
m_win->QueueTask([this, res, elapsedms]() { query_ready(res, elapsedms); });
|
||||
});
|
||||
m_dbConnection.send(cmd, m_queryParamListController->params(), cb);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -190,8 +186,8 @@ void QueryTab::explain(bool analyze)
|
|||
}
|
||||
m_stopwatch.start();
|
||||
std::string cmd = "EXPLAIN (" + analyze_str + "VERBOSE, FORMAT JSON) " + getCommandUtf8();
|
||||
m_dbConnection.send(cmd,
|
||||
[this](Expected<std::shared_ptr<Pgsql::Result>> exp_res, qint64 )
|
||||
|
||||
auto cb = [this](Expected<std::shared_ptr<Pgsql::Result>> exp_res, qint64 )
|
||||
{
|
||||
if (exp_res.valid()) {
|
||||
// Process explain data seperately
|
||||
|
|
@ -213,7 +209,12 @@ void QueryTab::explain(bool analyze)
|
|||
}).detach();
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
if (m_queryParamListController->empty())
|
||||
m_dbConnection.send(cmd, cb);
|
||||
else
|
||||
m_dbConnection.send(cmd, m_queryParamListController->params(), cb);
|
||||
}
|
||||
|
||||
void QueryTab::cancel()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue