Moved everything associated with executing and explaining queries to querytab.
It is now possible to create multiple independent query tabs. However somethings are currently a bit broken.
This commit is contained in:
parent
6c268bd774
commit
7f379f3b80
13 changed files with 668 additions and 634 deletions
55
querytab.h
55
querytab.h
|
|
@ -1,22 +1,73 @@
|
|||
#ifndef QUERYTAB_H
|
||||
#ifndef QUERYTAB_H
|
||||
#define QUERYTAB_H
|
||||
|
||||
#include "asyncdbconnection.h"
|
||||
#include "QueryResultModel.h"
|
||||
#include "QueryExplainModel.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <memory>
|
||||
|
||||
namespace Ui {
|
||||
class QueryTab;
|
||||
}
|
||||
|
||||
class MainWindow;
|
||||
class SqlHighlighter;
|
||||
class ExplainRoot;
|
||||
class QueryResultModel;
|
||||
class QueryExplainModel;
|
||||
|
||||
|
||||
class QueryTab : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit QueryTab(QWidget *parent = 0);
|
||||
QueryTab(MainWindow *win, QWidget *parent = 0);
|
||||
~QueryTab();
|
||||
|
||||
void setConfig(const ConnectionConfig &config);
|
||||
|
||||
void open();
|
||||
void save();
|
||||
void saveAs();
|
||||
void saveCopyAs();
|
||||
|
||||
void execute();
|
||||
void explainAnalyze();
|
||||
void cancel();
|
||||
private:
|
||||
Ui::QueryTab *ui;
|
||||
MainWindow *m_win;
|
||||
std::unique_ptr<SqlHighlighter> highlighter;
|
||||
ConnectionConfig m_config;
|
||||
|
||||
QString m_fileName; ///< use setFileName function to set
|
||||
bool m_queryTextChanged = false;
|
||||
|
||||
void setFileName(const QString &filename);
|
||||
bool continueWithoutSavingWarning();
|
||||
void saveSqlTo(const QString &filename);
|
||||
QString promptUserForSaveSqlFilename();
|
||||
|
||||
|
||||
ASyncDBConnection m_dbConnection;
|
||||
std::unique_ptr<QueryResultModel> resultModel;
|
||||
std::unique_ptr<QueryExplainModel> explainModel;
|
||||
|
||||
void addLog(QString s);
|
||||
|
||||
std::string getCommand() const;
|
||||
void explain_ready(ExplainRoot::SPtr explain);
|
||||
void query_ready(std::shared_ptr<Pgsql::Result> dbres);
|
||||
private slots:
|
||||
|
||||
void queryTextChanged();
|
||||
void connectionStateChanged(ASyncDBConnection::State state);
|
||||
void receiveNotice(Pgsql::ErrorDetails notice);
|
||||
|
||||
void startConnect();
|
||||
};
|
||||
|
||||
#endif // QUERYTAB_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue