diff --git a/lib/db_ido_mysql/idomysqlconnection.cpp b/lib/db_ido_mysql/idomysqlconnection.cpp index 5efda95ab9a..c781d8f2819 100644 --- a/lib/db_ido_mysql/idomysqlconnection.cpp +++ b/lib/db_ido_mysql/idomysqlconnection.cpp @@ -894,17 +894,19 @@ void IdoMysqlConnection::InternalExecuteQuery(const DbQuery& query, DbQueryType return; } - if (!CanExecuteQuery(query)) { - m_QueryQueue.Enqueue(boost::bind(&IdoMysqlConnection::InternalExecuteQuery, this, query, typeOverride), query.Priority); - return; - } - + /* check whether we're allowed to execute the query first */ if (GetCategoryFilter() != DbCatEverything && (query.Category & GetCategoryFilter()) == 0) return; if (query.Object && query.Object->GetObject()->GetExtension("agent_check").ToBool()) return; + /* check if there are missing object/insert ids and re-enqueue the query */ + if (!CanExecuteQuery(query)) { + m_QueryQueue.Enqueue(boost::bind(&IdoMysqlConnection::InternalExecuteQuery, this, query, typeOverride), query.Priority); + return; + } + std::ostringstream qbuf, where; int type; diff --git a/lib/db_ido_pgsql/idopgsqlconnection.cpp b/lib/db_ido_pgsql/idopgsqlconnection.cpp index b3f2e75d5aa..71a970934a3 100644 --- a/lib/db_ido_pgsql/idopgsqlconnection.cpp +++ b/lib/db_ido_pgsql/idopgsqlconnection.cpp @@ -751,17 +751,19 @@ void IdoPgsqlConnection::InternalExecuteQuery(const DbQuery& query, DbQueryType return; } - if (!CanExecuteQuery(query)) { - m_QueryQueue.Enqueue(boost::bind(&IdoPgsqlConnection::InternalExecuteQuery, this, query, typeOverride), query.Priority); - return; - } - + /* check whether we're allowed to execute the query first */ if (GetCategoryFilter() != DbCatEverything && (query.Category & GetCategoryFilter()) == 0) return; if (query.Object && query.Object->GetObject()->GetExtension("agent_check").ToBool()) return; + /* check if there are missing object/insert ids and re-enqueue the query */ + if (!CanExecuteQuery(query)) { + m_QueryQueue.Enqueue(boost::bind(&IdoPgsqlConnection::InternalExecuteQuery, this, query, typeOverride), query.Priority); + return; + } + std::ostringstream qbuf, where; int type;