-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathkvsqldialog.h
108 lines (98 loc) · 5.06 KB
/
kvsqldialog.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/****************************************************************************
**
** Author: Antonio Marcio A Menezes.
**
** This file is part of the Kevora IDE.
**
** This file may be used under the terms of the GNU General Public
** License version 2.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
****************************************************************************/
#ifndef KVSQLDIALOG_H
#define KVSQLDIALOG_H
#include <QDialog>
#include <QSqlQueryModel>
#include "kvthread.h"
namespace Ui {
class KvSqlDialog;
}
class KvSqlDialog : public QDialog {
Q_OBJECT
public:
explicit KvSqlDialog(QWidget *parent = 0);
~KvSqlDialog();
public slots:
void deleteTempThreadSlot();
void setActiveSessions(QStringList sessionNames);
void setCurrentSession(QString sessionName);
void addActiveSession(QString sessionName);
void removeActiveSession(QString sessionName);
void clonedSessionSlot(WId windowId, QString sessionName, QString driver, QString hostName, int port, QString databaseName, QString userName, QString password);
void openedDbConnectionSlot(QString sessionName, QString connUser, QString connDb, QSqlError error);
void closedDbConnectionSlot(QString sessionName);
void gotSessionInfoSlot(QString sessionName, QMap<QString,QString> info);
virtual void executedQuerySlot(QString sqlStatement, QList<QSqlRecord> records, int recordCount, QSqlError error) { }
virtual void gotSqlBlocksSlot(QStringList sqlBlocks, int fromPosition, int toPosition) { }
virtual void gotFindObjectStatementSlot(QString fullObjectName, QString statement) { }
virtual void gotNextRecordsSlot(QString sqlStatement, QList<QSqlRecord> records, int recordCount, QSqlError error, bool allRecords = false) { }
void getDdlFromObjectSlot(QString schema, QString objectName, QString objectType, bool showSchema = true, KvSqlSession::DdlTypes ddlType = KvSqlSession::CompleteDdl);
virtual void gotDdlFromObjectSlot(QString sessionName, QString schema, QString objectName, QString objectType, bool showSchema, QStringList result, KvSqlSession::DdlTypes) { }
void getDependentSqlSlot(QString sqlStatement);
virtual void gotDependentSqlSlot(QString sqlStatement, QStringList dependentSqlStatements) { }
virtual void gotExtractConsistentDataSqlSlot(QString sqlStatement, QStringList consistentSqlStatements) { }
void getPlanSlot(QString sqlStatement, QString sqlStatementId);
virtual void gotPlanSlot(QString sqlStatement, QString sqlStatementId, QList< QPair<QString, QMap<QString,QString> > > result) { }
void getExportedDataSlot(QString schema, QString tableName, bool showSchema, QString sqlStatementId);
virtual void gotExportedDataSlot(QString sessionName, QString schema, QString tableName, bool showSchema, QString resultLine, bool isTheEnd, QString sqlStatementId) { }
void gotDatabaseObjectTypesSlot(QStringList objTypeNames, QStringList objTypeOrder);
virtual void gotTableAndColumnsInfoSlot(QString objSchema, QString objTable, KvTableInfo tableInfo, QList<KvColumnInfo> columns, QList<KvTableConstraintInfo> constraints) { }
QString getFileName();
void setFileName(QString fullName);
protected:
void changeEvent(QEvent *e);
QStringList activeSessions;
KvThread *thread;
KvThread *tempThread;
bool hasOpenConnection;
bool openConnectionAndExecute;
bool openConnectionAndExecuteDdl;
bool openConnectionAndExportData;
QString ddlSchemaName;
QString ddlObjectName;
QString ddlObjectType;
bool ddlShowSchema;
QMap<QString,QString> mapSessionInfo;
QStringList databaseObjTypeNames;
QStringList databaseObjTypeOrder;
bool isClosing;
QString currentFileName;
private:
Ui::KvSqlDialog *ui;
private slots:
void startedThreadSlot(QString sessionName);
void deleteThreadSlot();
signals:
void cloneSessionSignal(WId, QString);
void openDbConnectionSignal(QString, QString, QString, QString, QString, QString, QString, int);
void closeDbConnectionSignal(QString);
void getSessionInfoSignal(QString);
void executeQuerySignal(QString, QString sqlStatementId = "default");
void getSqlBlocksSignal(QStringList, int fromPosition = -1, int toPosition = -1);
void getFindObjectStatementSignal(QString, QString = QString());
void getNextRecordsSignal(QString, int, bool allRecords = false, QString sqlStatementId = "default");
void commitTransactionSignal();
void rollbackTransactionSignal();
void getDdlFromObjectSignal(QString, QString, QString, bool, KvSqlSession::DdlTypes);
void getDependentSqlSignal(QString);
void getExtractConsistentDataSqlSignal(QString);
void getPlanSignal(QString, QString);
void getExportedDataSignal(QString, QString, bool,QString);
void getDatabaseObjectTypesSignal();
void getTableAndColumnsInfoSignal(QString schemaName, QString tableName);
};
#endif // KVSQLDIALOG_H