You are here

function views_query::views_query in Views (for Drupal 7) 6.2

Constructor; Create the basic query object and fill with default values.

File

includes/query.inc, line 70
query.inc Defines the query object which is the underlying layer in a View.

Class

views_query
Object used to create a SELECT query.

Code

function views_query($base_table = 'node', $base_field = 'nid') {
  $this->base_table = $base_table;

  // Predefine these above, for clarity.
  $this->base_field = $base_field;
  $this->relationships[$base_table] = array(
    'link' => NULL,
    'table' => $base_table,
    'alias' => $base_table,
    'base' => $base_table,
  );

  // init the table queue with our primary table.
  $this->table_queue[$base_table] = array(
    'alias' => $base_table,
    'table' => $base_table,
    'relationship' => $base_table,
    'join' => NULL,
  );

  // init the tables with our primary table
  $this->tables[$base_table][$base_table] = array(
    'count' => 1,
    'alias' => $base_table,
  );
  if ($base_field) {
    $this->fields[$base_field] = array(
      'table' => $base_table,
      'field' => $base_field,
      'alias' => $base_field,
    );
  }
  $this->count_field = array(
    'table' => $base_table,
    'field' => $base_field,
    'alias' => $base_field,
    'count' => TRUE,
  );
}