Query is now executed using std::async

This commit is contained in:
Eelke Klein 2016-12-27 21:22:49 +01:00
parent 3a8cc3d7f0
commit 0d30dc9080
4 changed files with 58 additions and 12 deletions

View file

@ -4,6 +4,7 @@
#include <QMainWindow>
#include <QSocketNotifier>
#include <memory>
#include <future>
#include "PgsqlConn.h"
class QueryResultModel;
@ -34,17 +35,25 @@ private:
std::unique_ptr<Pgsql::Connection> connection;
std::unique_ptr<QueryResultModel> resultModel;
std::future<Pgsql::Result> queryFuture;
struct {
std::unique_ptr<QSocketNotifier> notifier;
PostgresPollingStatusType poll_state;
} connectingState;
// struct {
// std::unique_ptr<QSocketNotifier> notifierRead;
// std::unique_ptr<QSocketNotifier> notifierWrite;
// } queryState;
private slots:
void startConnect();
void performQuery();
void socket_activate_connect(int socket);
void query_ready();
};
#endif // MAINWINDOW_H