protected function DatabaseCondition::mapConditionOperator

cis7 query.inc protected DatabaseCondition::mapConditionOperator($operator)
cle7 query.inc protected DatabaseCondition::mapConditionOperator($operator)
elmsmedia7 query.inc protected DatabaseCondition::mapConditionOperator($operator)
icor7 query.inc protected DatabaseCondition::mapConditionOperator($operator)
meedjum_blog7 query.inc protected DatabaseCondition::mapConditionOperator($operator)
mooc7 query.inc protected DatabaseCondition::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.

Parameters

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

Return value

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

1 call to DatabaseCondition::mapConditionOperator()

File

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

Class

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

Code

protected function mapConditionOperator($operator) {
  // $specials does not use drupal_static as its value never changes.
  static $specials = array(
    'BETWEEN' => array('delimiter' => ' AND '),
    'IN' => array(
      'delimiter' => ', ',
      'prefix' => ' (',
      'postfix' => ')',
    ),
    'NOT IN' => array(
      'delimiter' => ', ',
      'prefix' => ' (',
      'postfix' => ')',
    ),
    'EXISTS' => array(
      'prefix' => ' (',
      'postfix' => ')',
    ),
    'NOT EXISTS' => array(
      'prefix' => ' (',
      'postfix' => ')',
    ),
    'IS NULL' => array('use_value' => FALSE),
    'IS NOT NULL' => array('use_value' => FALSE),
    
    // Use backslash for escaping wildcard characters.
    'LIKE' => array('postfix' => " ESCAPE '\\\\'"),
    'NOT LIKE' => array('postfix' => " ESCAPE '\\\\'"),
    
    // These ones are here for performance reasons.
    '=' => array(),
    '<' => array(),
    '>' => array(),
    '>=' => array(),
    '<=' => array(),
  );
  if (isset($specials[$operator])) {
    $return = $specials[$operator];
  }
  else {
    // We need to upper case because PHP index matches are case sensitive but
    // do not need the more expensive drupal_strtoupper because SQL statements are ASCII.
    $operator = strtoupper($operator);
    $return = isset($specials[$operator]) ? $specials[$operator] : array();
  }

  $return += array('operator' => $operator);

  return $return;
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.