Query, explain, cancel buttons are now enabled/disabled when the state of the connection changes.
This commit is contained in:
parent
d19741f111
commit
a32e2c83ca
3 changed files with 32 additions and 14 deletions
|
|
@ -1,5 +1,6 @@
|
|||
#include "asyncdbconnection.h"
|
||||
#include "waithandlelist.h"
|
||||
#include "scopeguard.h"
|
||||
#include <chrono>
|
||||
|
||||
ASyncDBConnection::ASyncDBConnection()
|
||||
|
|
@ -7,6 +8,11 @@ ASyncDBConnection::ASyncDBConnection()
|
|||
|
||||
}
|
||||
|
||||
ASyncDBConnection::State ASyncDBConnection::state() const
|
||||
{
|
||||
return m_threadData.m_state;
|
||||
}
|
||||
|
||||
//void ASyncDBConnection::setupConnection(const std::string &connstring)
|
||||
//{
|
||||
// if (m_thread.joinable()) {
|
||||
|
|
@ -69,6 +75,10 @@ ASyncDBConnection::Thread::Thread()
|
|||
void ASyncDBConnection::Thread::run()
|
||||
{
|
||||
m_terminated = false;
|
||||
SCOPE_EXIT {
|
||||
m_state = State::NotConnected;
|
||||
m_terminated = true;
|
||||
};
|
||||
while (!terminateRequested) {
|
||||
|
||||
// make or recover connection
|
||||
|
|
@ -94,7 +104,6 @@ void ASyncDBConnection::Thread::run()
|
|||
break;
|
||||
}
|
||||
}
|
||||
m_terminated = true;
|
||||
// close connection
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue