Switched ConnectionConfig to QString from std::string to fit better into Qt framework
This commit is contained in:
parent
bcfd82c27d
commit
082293e58a
20 changed files with 1077 additions and 211 deletions
|
|
@ -1,5 +1,6 @@
|
|||
#include "ASyncDBConnection.h"
|
||||
#include "ScopeGuard.h"
|
||||
#include "util.h"
|
||||
#include <chrono>
|
||||
|
||||
using namespace boost::asio;
|
||||
|
|
@ -32,23 +33,23 @@ ASyncDBConnection::State ASyncDBConnection::state() const
|
|||
|
||||
void ASyncDBConnection::setupConnection(const ConnectionConfig &config)
|
||||
{
|
||||
m_config = config;
|
||||
auto keywords = m_config.getKeywords();
|
||||
auto values = m_config.getValues();
|
||||
|
||||
bool ok = m_connection.connectStart(keywords, values);
|
||||
m_config = config;
|
||||
// auto keywords = m_config.getKeywords();
|
||||
// auto values = m_config.getValues();
|
||||
QString conn_string = config.connectionString();
|
||||
bool ok = m_connection.connectStart(conn_string.toStdString().c_str());
|
||||
// auto start = std::chrono::steady_clock::now();
|
||||
if (ok && m_connection.status() != CONNECTION_BAD) {
|
||||
auto sock_handle = m_connection.socket();
|
||||
if (ok && m_connection.status() != CONNECTION_BAD) {
|
||||
auto sock_handle = m_connection.socket();
|
||||
|
||||
m_asioSock.assign(ip::tcp::v4(), sock_handle);
|
||||
m_asioSock.non_blocking(true);
|
||||
m_asioSock.assign(ip::tcp::v4(), sock_handle);
|
||||
m_asioSock.non_blocking(true);
|
||||
|
||||
m_asioSock.async_write_some(null_buffers(),
|
||||
[this] (boost::system::error_code ec, std::size_t s)
|
||||
{ async_connect_handler(ec, s); }
|
||||
);
|
||||
}
|
||||
m_asioSock.async_write_some(null_buffers(),
|
||||
[this] (boost::system::error_code ec, std::size_t s)
|
||||
{ async_connect_handler(ec, s); }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void ASyncDBConnection::async_connect_handler(boost::system::error_code ec, std::size_t /*s*/)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue