Switched away from boost::asio as it doesn't play well with libpq
This commit is contained in:
parent
6dd079bf87
commit
6bb5525d5e
13 changed files with 566 additions and 143 deletions
|
|
@ -10,9 +10,9 @@
|
|||
#include "ConnectionConfig.h"
|
||||
#include <QElapsedTimer>
|
||||
#include <mutex>
|
||||
#include <boost/asio/ip/tcp.hpp>
|
||||
#include <boost/asio/io_service.hpp>
|
||||
#include <memory>
|
||||
|
||||
class ASyncDBConnectionThread;
|
||||
/** \brief Class that handles asynchronous execution of queries.
|
||||
*
|
||||
* Queries are passed to this class with a routine to call on completion
|
||||
|
|
@ -32,7 +32,7 @@ public:
|
|||
|
||||
using on_result_callback = std::function<void(Expected<std::shared_ptr<Pgsql::Result>>, qint64)>;
|
||||
|
||||
explicit ASyncDBConnection(boost::asio::io_service &ios);
|
||||
explicit ASyncDBConnection();
|
||||
~ASyncDBConnection();
|
||||
|
||||
State state() const;
|
||||
|
|
@ -73,17 +73,18 @@ signals:
|
|||
|
||||
private:
|
||||
Pgsql::Connection m_connection;
|
||||
boost::asio::ip::tcp::socket m_asioSock;
|
||||
std::unique_ptr<ASyncDBConnectionThread> m_threadData;
|
||||
std::thread m_thread;
|
||||
ConnectionConfig m_config;
|
||||
State m_state = State::NotConnected;
|
||||
Pgsql::Canceller m_canceller;
|
||||
|
||||
QElapsedTimer m_timer;
|
||||
|
||||
void async_connect_handler(boost::system::error_code ec, std::size_t s);
|
||||
void async_query_handler(boost::system::error_code ec, std::size_t s, on_result_callback on_result);
|
||||
void doStateCallback(State state);
|
||||
void processNotice(const PGresult *result);
|
||||
|
||||
friend class ASyncDBConnectionThread;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(ASyncDBConnection::State);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue