1 views_handler_argument_numeric.inc views_handler_argument_numeric::query($group_by = FALSE)

Set up the query for this argument.

The argument sent may be found at $this->argument.

Overrides views_handler_argument::query

File

core/modules/views/handlers/views_handler_argument_numeric.inc, line 89
Definition of views_handler_argument_numeric.

Class

views_handler_argument_numeric
Basic argument handler for arguments that are numeric. Incorporates break_phrase.

Code

function query($group_by = FALSE) {
  $this->ensure_my_table();

  if (!empty($this->options['break_phrase'])) {
    views_break_phrase($this->argument, $this);
  }
  else {
    $this->value = array($this->argument);
  }

  $placeholder = $this->placeholder();
  $null_check = empty($this->options['not']) ? '' : "OR $this->table_alias.$this->real_field IS NULL";

  if (count($this->value) > 1) {
    $operator = empty($this->options['not']) ? 'IN' : 'NOT IN';
    $this->query->add_where_expression(0, "$this->table_alias.$this->real_field $operator($placeholder) $null_check", array($placeholder => $this->value));
  }
  else {
    $operator = empty($this->options['not']) ? '=' : '!=';
    $this->query->add_where_expression(0, "$this->table_alias.$this->real_field $operator $placeholder $null_check", array($placeholder => $this->argument));
  }
}