W3cubDocs

/Drupal 8

public function Connection::mapConditionOperator

public Connection::mapConditionOperator($operator)

Gets any special processing requirements for the condition operator.

Some condition types require special processing, such as IN, because the value data they pass in is not a simple value. This is a simple overridable lookup function. Database connections should define only those operators they wish to be handled differently than the default.

Parameters

string $operator: The condition operator, such as "IN", "BETWEEN", etc. Case-sensitive.

Return value

The extra handling directives for the specified operator, or NULL.

Overrides Connection::mapConditionOperator

See also

\Drupal\Core\Database\Query\Condition::compile()

File

core/lib/Drupal/Core/Database/Driver/pgsql/Connection.php, line 299

Class

Connection
PostgreSQL implementation of \Drupal\Core\Database\Connection.

Namespace

Drupal\Core\Database\Driver\pgsql

Code

public function mapConditionOperator($operator) {
  static $specials = array(
    // In PostgreSQL, 'LIKE' is case-sensitive. For case-insensitive LIKE
    // statements, we need to use ILIKE instead.
    'LIKE' => array('operator' => 'ILIKE'),
    'LIKE BINARY' => array('operator' => 'LIKE'),
    'NOT LIKE' => array('operator' => 'NOT ILIKE'),
    'REGEXP' => array('operator' => '~*'),
  );
  return isset($specials[$operator]) ? $specials[$operator] : NULL;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Database!Driver!pgsql!Connection.php/function/Connection::mapConditionOperator/8.1.x