Builds on windows again
This commit is contained in:
parent
33cf39b799
commit
bebb3391c3
160 changed files with 138 additions and 117 deletions
|
|
@ -1,125 +0,0 @@
|
|||
#ifndef QUERYTAB_H
|
||||
#define QUERYTAB_H
|
||||
|
||||
#include "ASyncDBConnection.h"
|
||||
#include "ParamListModel.h"
|
||||
#include "ParamTypeDelegate.h"
|
||||
#include "QueryResultModel.h"
|
||||
#include "QueryExplainModel.h"
|
||||
#include "stopwatch.h"
|
||||
#include "tuplesresultwidget.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <memory>
|
||||
|
||||
namespace Ui {
|
||||
class QueryTab;
|
||||
}
|
||||
|
||||
class QTableView;
|
||||
|
||||
class QTabWidget;
|
||||
class MainWindow;
|
||||
class SqlSyntaxHighlighter;
|
||||
class ExplainRoot;
|
||||
class QueryResultModel;
|
||||
class QueryExplainModel;
|
||||
class PgTypeContainer;
|
||||
class OpenDatabase;
|
||||
|
||||
class QueryParamListController : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
QueryParamListController(QTableView *tv, OpenDatabase *opendb, QWidget *parent);
|
||||
|
||||
Pgsql::Params params() const;
|
||||
bool empty() const;
|
||||
public slots:
|
||||
void on_addParam();
|
||||
void on_removeParam();
|
||||
private:
|
||||
QTableView *paramTableView;
|
||||
OpenDatabase *m_openDatabase;
|
||||
ParamListModel m_paramList;
|
||||
ParamTypeDelegate m_typeDelegate;
|
||||
};
|
||||
|
||||
|
||||
class QueryTab : public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
QueryTab(MainWindow *win, QWidget *parent = nullptr);
|
||||
~QueryTab();
|
||||
|
||||
void setConfig(const ConnectionConfig &config);
|
||||
|
||||
void newdoc();
|
||||
// void open();
|
||||
bool load(const QString &filename);
|
||||
bool save();
|
||||
bool saveAs();
|
||||
void saveCopyAs();
|
||||
|
||||
void execute();
|
||||
void explain(bool analyze);
|
||||
void cancel();
|
||||
|
||||
bool canClose();
|
||||
|
||||
void copyQueryAsCString();
|
||||
void copyQueryAsRawCppString();
|
||||
void exportData(const QString &filename);
|
||||
|
||||
QString fileName() const { return m_fileName; }
|
||||
bool isChanged() const { return m_queryTextChanged; }
|
||||
bool isNew() const { return m_new; }
|
||||
private:
|
||||
|
||||
using ResultTabContainer = std::vector<TuplesResultWidget*>;
|
||||
|
||||
Ui::QueryTab *ui;
|
||||
MainWindow *m_win;
|
||||
SqlSyntaxHighlighter* highlighter;
|
||||
ConnectionConfig m_config;
|
||||
StopWatch m_stopwatch;
|
||||
|
||||
QueryParamListController *m_queryParamListController = nullptr;
|
||||
|
||||
bool m_new = true;
|
||||
QString m_fileName; ///< use setFileName function to set
|
||||
bool m_queryTextChanged = false;
|
||||
|
||||
void setFileName(const QString &filename);
|
||||
bool continueWithoutSavingWarning();
|
||||
bool saveSqlTo(const QString &filename);
|
||||
QString promptUserForSaveSqlFilename();
|
||||
|
||||
|
||||
|
||||
|
||||
ASyncDBConnection m_dbConnection;
|
||||
|
||||
std::unique_ptr<QueryExplainModel> explainModel;
|
||||
ResultTabContainer resultList;
|
||||
|
||||
void addLog(QString s);
|
||||
|
||||
QString getCommand() const;
|
||||
std::string getCommandUtf8() const;
|
||||
void explain_ready(ExplainRoot::SPtr explain);
|
||||
void query_ready(Expected<std::shared_ptr<Pgsql::Result>> dbres, qint64 elapsedms);
|
||||
|
||||
QTabWidget *getTabWidget();
|
||||
void setTabCaption(const QString &caption, const QString &tooltip);
|
||||
void clearResult();
|
||||
|
||||
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