Messy commit. Testing suff and some improvements to how data is shown.
This commit is contained in:
parent
bebb3391c3
commit
3a13b7ffb4
59 changed files with 2045 additions and 716 deletions
|
|
@ -1,4 +1,4 @@
|
|||
#include "QueryTab.h"
|
||||
#include "QueryTab.h"
|
||||
#include "ui_QueryTab.h"
|
||||
#include "SqlSyntaxHighlighter.h"
|
||||
#include <QStandardPaths>
|
||||
|
|
@ -229,30 +229,32 @@ void QueryTab::explain(bool analyze)
|
|||
|
||||
std::string analyze_str;
|
||||
if (analyze) {
|
||||
analyze_str = "ANALYZE, ";
|
||||
analyze_str = "ANALYZE, BUFFERS, ";
|
||||
}
|
||||
m_stopwatch.start();
|
||||
std::string cmd = "EXPLAIN (" + analyze_str + "VERBOSE, BUFFERS, FORMAT JSON) " + getCommandUtf8();
|
||||
std::string cmd = "EXPLAIN (" + analyze_str + "VERBOSE, FORMAT JSON) " + getCommandUtf8();
|
||||
m_dbConnection.send(cmd,
|
||||
[this](Expected<std::shared_ptr<Pgsql::Result>> exp_res, qint64 )
|
||||
{
|
||||
if (exp_res.valid()) {
|
||||
// Process explain data seperately
|
||||
auto res = exp_res.get();
|
||||
std::thread([this,res]()
|
||||
{
|
||||
std::shared_ptr<ExplainRoot> explain;
|
||||
if (res->cols() == 1 && res->rows() == 1) {
|
||||
std::string s = res->val(0, 0);
|
||||
Json::Value root; // will contains the root value after parsing.
|
||||
Json::Reader reader;
|
||||
bool parsingSuccessful = reader.parse(s, root);
|
||||
if (parsingSuccessful) {
|
||||
explain = ExplainRoot::createFromJson(root);
|
||||
if (res) {
|
||||
std::thread([this,res]()
|
||||
{
|
||||
std::shared_ptr<ExplainRoot> explain;
|
||||
if (res->cols() == 1 && res->rows() == 1) {
|
||||
std::string s = res->val(0, 0);
|
||||
Json::Value root; // will contains the root value after parsing.
|
||||
Json::Reader reader;
|
||||
bool parsingSuccessful = reader.parse(s, root);
|
||||
if (parsingSuccessful) {
|
||||
explain = ExplainRoot::createFromJson(root);
|
||||
}
|
||||
}
|
||||
}
|
||||
m_win->QueueTask([this, explain]() { explain_ready(explain); });
|
||||
}).detach();
|
||||
m_win->QueueTask([this, explain]() { explain_ready(explain); });
|
||||
}).detach();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue