From 53930e321c685de893e1ce1a17721d7e256e5577 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Tue, 2 Aug 2016 14:27:20 +0200 Subject: [PATCH] DB IDO: Ensure that queries are not executed if categories don't match refs #12147 refs #12147 --- lib/db_ido_mysql/idomysqlconnection.cpp | 12 +++++++----- lib/db_ido_pgsql/idopgsqlconnection.cpp | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/lib/db_ido_mysql/idomysqlconnection.cpp b/lib/db_ido_mysql/idomysqlconnection.cpp index 5efda95ab..c781d8f28 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 b3f2e75d5..71a970934 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;