Same name and namespace in other branches
  1. 6.x-3.x plugins/views_plugin_query.inc \views_plugin_query::set_where_group()

Create a new grouping for the WHERE or HAVING clause.

Parameters

string $type: Either 'AND' or 'OR'. All items within this group will be added to the WHERE clause with this logical operator.

string $group: An ID to use for this group. If unspecified, an ID will be generated.

string $where: 'where' or 'having'.

Return value

string The group ID generated.

4 calls to views_plugin_query::set_where_group()
views_plugin_query_default::add_having in plugins/views_plugin_query_default.inc
Add a simple HAVING clause to the query.
views_plugin_query_default::add_having_expression in plugins/views_plugin_query_default.inc
Add a complex HAVING clause to the query.
views_plugin_query_default::add_where in plugins/views_plugin_query_default.inc
Add a simple WHERE clause to the query.
views_plugin_query_default::add_where_expression in plugins/views_plugin_query_default.inc
Add a complex WHERE clause to the query.

File

plugins/views_plugin_query.inc, line 169
Definition of views_plugin_query.

Class

views_plugin_query
The base query class, which is the underlying layer in a View.

Code

public function set_where_group($type = 'AND', $group = NULL, $where = 'where') {

  // Set an alias.
  $groups =& $this->{$where};
  if (!isset($group)) {
    $group = empty($groups) ? 1 : max(array_keys($groups)) + 1;
  }

  // Create an empty group
  if (empty($groups[$group])) {
    $groups[$group] = array(
      'conditions' => array(),
      'args' => array(),
    );
  }
  $groups[$group]['type'] = strtoupper($type);
  return $group;
}