Switched away from boost::asio as it doesn't play well with libpq

This commit is contained in:
eelke 2019-11-06 20:03:27 +01:00
parent 6dd079bf87
commit 6bb5525d5e
13 changed files with 566 additions and 143 deletions

View file

@ -4,7 +4,6 @@
#include "catalog/PgAttribute.h"
#include "catalog/PgAttributeContainer.h"
#include "catalog/PgConstraintContainer.h"
#include "GlobalIoService.h"
#include "SqlFormattingUtils.h"
#include "Pgsql_oids.h"
#include <QtConcurrent>
@ -19,7 +18,7 @@
CrudModel::CrudModel(QObject *parent)
: QAbstractTableModel(parent)
, m_dbConn(*getGlobalAsioIoService())
, m_dbConn()
{
qDebug("CrudModel created");
connect(&m_dbConn, &ASyncDBConnection::onStateChanged, this, &CrudModel::connectionStateChanged);

View file

@ -1,7 +0,0 @@
#include "GlobalIoService.h"
std::shared_ptr<boost::asio::io_service> getGlobalAsioIoService()
{
static auto ios = std::make_shared<boost::asio::io_service>();
return ios;
}

View file

@ -1,6 +0,0 @@
#pragma once
#include <memory>
#include <boost/asio.hpp>
std::shared_ptr<boost::asio::io_service> getGlobalAsioIoService();

View file

@ -18,7 +18,6 @@
#include "catalog/PgDatabaseCatalog.h"
#include "QueryParamListController.h"
#include "util.h"
#include "GlobalIoService.h"
#include "UserConfiguration.h"
#include "IDatabaseWindow.h"
@ -27,7 +26,7 @@ QueryTool::QueryTool(IDatabaseWindow *context, QWidget *parent)
: QWidget(parent)
, m_context(context)
, ui(new Ui::QueryTab)
, m_dbConnection(*getGlobalAsioIoService())
, m_dbConnection()
{
ui->setupUi(this);

View file

@ -4,7 +4,6 @@
# include <winsock2.h>
#endif
#include <memory>
#include "GlobalIoService.h"
int main(int argc, char *argv[])
{
@ -29,19 +28,13 @@ int main(int argc, char *argv[])
QCoreApplication::setOrganizationDomain("eelkeklein.nl");
QCoreApplication::setApplicationName("pglab");
std::thread asio_service_thread;
int result = -1;
{
auto ios = getGlobalAsioIoService();
boost::asio::io_service::work work(*ios); // Prevent service from running out of work so run doesn't return
asio_service_thread = std::thread([ios](){ ios->run(); });
// make sure the io_service is stopped before we wait on the future
auto master_controller = std::make_unique<MasterController>();
master_controller->init();
result = a.exec();
}
asio_service_thread.join();
#ifdef WIN32
WSACleanup();
#endif

View file

@ -44,7 +44,6 @@ SOURCES += main.cpp\
DatabasesTableModel.cpp \
RolesTableModel.cpp \
ProcessStdioWidget.cpp \
GlobalIoService.cpp \
ResultTableModelUtil.cpp \
BaseTableModel.cpp \
QueryParamListController.cpp \
@ -111,7 +110,6 @@ HEADERS += \
DatabasesTableModel.h \
RolesTableModel.h \
ProcessStdioWidget.h \
GlobalIoService.h \
ResultTableModelUtil.h \
BaseTableModel.h \
QueryParamListController.h \