Skip to content

Commit

Permalink
DB IDO: Ensure that queries are not executed if categories don't match
Browse files Browse the repository at this point in the history
refs #12147
refs #12147
  • Loading branch information
Michael Friedrich committed Aug 2, 2016
1 parent b7da28b commit 53930e3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
12 changes: 7 additions & 5 deletions lib/db_ido_mysql/idomysqlconnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
12 changes: 7 additions & 5 deletions lib/db_ido_pgsql/idopgsqlconnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 53930e3

Please sign in to comment.