Skip to content

Commit

Permalink
Revert "DB IDO: Make sure that all result sets are processed before s…
Browse files Browse the repository at this point in the history
…ending another query"

This reverts commit ad0604d.

refs #12597
  • Loading branch information
gunnarbeutner committed Nov 28, 2016
1 parent 8d47b55 commit 79ecda5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 26 deletions.
25 changes: 5 additions & 20 deletions lib/db_ido_mysql/idomysqlconnection.cpp
Expand Up @@ -512,21 +512,20 @@ void IdoMysqlConnection::FinishAsyncQueries(void)
);
}

std::vector<IdoMysqlResultInfo> resultSets;

for (std::vector<IdoAsyncQuery>::size_type i = offset; i < offset + count; i++) {
const IdoAsyncQuery& aq = queries[i];

MYSQL_RES *result = mysql_store_result(&m_Connection);

int affectedRows = mysql_affected_rows(&m_Connection);
m_AffectedRows = mysql_affected_rows(&m_Connection);

IdoMysqlResult iresult;

if (!result) {
if (mysql_field_count(&m_Connection) > 0) {
std::ostringstream msgbuf;
String message = mysql_error(&m_Connection);
msgbuf << "Error \"" << message << "\" when checking field count \"" << aq.Query << "\"";
msgbuf << "Error \"" << message << "\" when executing query \"" << aq.Query << "\"";
Log(LogCritical, "IdoMysqlConnection", msgbuf.str());

BOOST_THROW_EXCEPTION(
Expand All @@ -538,11 +537,8 @@ void IdoMysqlConnection::FinishAsyncQueries(void)
} else
iresult = IdoMysqlResult(result, std::ptr_fun(mysql_free_result));

IdoMysqlResultInfo resultInfo;
resultInfo.Result = iresult;
resultInfo.AffectedRows = affectedRows;

resultSets.push_back(resultInfo);
if (aq.Callback)
aq.Callback(iresult);

if (mysql_next_result(&m_Connection) > 0) {
std::ostringstream msgbuf;
Expand All @@ -558,17 +554,6 @@ void IdoMysqlConnection::FinishAsyncQueries(void)
}
}

for (std::vector<IdoAsyncQuery>::size_type i = offset; i < offset + count; i++) {
const IdoAsyncQuery& aq = queries[i];

const IdoMysqlResultInfo ri = resultSets[i - offset];

m_AffectedRows = ri.AffectedRows;

if (aq.Callback)
aq.Callback(ri.Result);
}

offset += count;
}
}
Expand Down
6 changes: 0 additions & 6 deletions lib/db_ido_mysql/idomysqlconnection.hpp
Expand Up @@ -39,12 +39,6 @@ struct IdoAsyncQuery
IdoAsyncCallback Callback;
};

struct IdoMysqlResultInfo
{
IdoMysqlResult Result;
int AffectedRows;
};

/**
* An IDO MySQL database connection.
*
Expand Down

0 comments on commit 79ecda5

Please sign in to comment.