1 query.inc protected DatabaseCondition::ensureBrackets($operator)

Ensures that the value being tested against is bracketed.

Some operators don't usually need brackets around the value being tested, but when the value being tested is a SelectQueryInterface it needs to be bracketed. This function adds those necessary brackets.


array $operator: The extra handling directives for the operator

Return value

array: The updated extra handling directives for the operator with brackets added if necessary.


core/includes/database/query.inc, line 2012
Non-specific Database query code. Used by all engines.


Generic class for a series of conditions in a query.


protected function ensureBrackets($operator) {
  if (strpos($operator['prefix'], '(') === FALSE) {
    $operator['prefix'] .= ' (';
  if (strpos($operator['postfix'], ')') === FALSE) {
    $operator['postfix'] = ')' . $operator['postfix'];
  return $operator;