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.

Parameters

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.

File

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

Class

DatabaseCondition
Generic class for a series of conditions in a query.

Code

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