Better handling of empty query's.
This commit is contained in:
parent
47b3ea83e9
commit
23165d77c8
1 changed files with 15 additions and 14 deletions
|
|
@ -310,21 +310,19 @@ void ASyncDBConnectionThread::doNewCommand()
|
|||
// get command from top of queue (but leave it in the queue, we need the callback)
|
||||
if (! m_commandQueue.m_queue.empty()) {
|
||||
const Command &command = m_commandQueue.m_queue.front();
|
||||
if (!command.command.empty()) {
|
||||
bool query_send = false;
|
||||
if (command.params.empty())
|
||||
query_send = m_connection.sendQuery(command.command.c_str());
|
||||
else
|
||||
query_send = m_connection.sendQueryParams(command.command.c_str(), command.params);
|
||||
bool query_send = false;
|
||||
if (command.params.empty())
|
||||
query_send = m_connection.sendQuery(command.command.c_str());
|
||||
else
|
||||
query_send = m_connection.sendQueryParams(command.command.c_str(), command.params);
|
||||
|
||||
if (query_send) {
|
||||
m_timer.start();
|
||||
doStateCallback(ASyncDBConnection::State::QuerySend);
|
||||
}
|
||||
else {
|
||||
std::string error = m_connection.getErrorMessage();
|
||||
// todo: need to report the error
|
||||
}
|
||||
if (query_send) {
|
||||
m_timer.start();
|
||||
doStateCallback(ASyncDBConnection::State::QuerySend);
|
||||
}
|
||||
else {
|
||||
std::string error = m_connection.getErrorMessage();
|
||||
// todo: need to report the error
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -489,6 +487,9 @@ void ASyncDBConnection::closeConnection()
|
|||
|
||||
bool ASyncDBConnection::send(const std::string &command, on_result_callback on_result)
|
||||
{
|
||||
if (command.empty())
|
||||
return false;
|
||||
|
||||
{
|
||||
std::lock_guard<std::mutex> lg(m_threadData->m_commandQueue.m_mutex);
|
||||
m_threadData->m_commandQueue.m_queue.emplace(command, on_result);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue