[ Index ]

PHP Cross Reference of Drupal 6 (gatewave)

title

Body

[close]

/sites/all/modules/views/includes/ -> query.inc (summary)

(no description)

File Size: 1014 lines (33 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

views_query:: (24 methods):
  views_query()
  set_distinct()
  set_count_field()
  set_header()
  add_relationship()
  add_table()
  queue_table()
  mark_table()
  ensure_table()
  ensure_path()
  adjust_join()
  get_join_data()
  get_table_info()
  add_field()
  clear_fields()
  set_where_group()
  set_group_operator()
  add_where()
  add_having()
  add_orderby()
  add_groupby()
  condition_sql()
  query()
  get_where_args()


Class: views_query  - X-Ref

Object used to create a SELECT query.

views_query($base_table = 'node', $base_field = 'nid')   X-Ref
Constructor; Create the basic query object and fill with default values.


set_distinct($value = TRUE)   X-Ref
Set the base field to be distinct.


set_count_field($table, $field, $alias = NULL)   X-Ref
Set what field the query will count() on for paging.


set_header($header)   X-Ref
Set the table header; used for click-sorting because it's needed
info to modify the ORDER BY clause.


add_relationship($alias, $join, $base, $link_point = NULL)   X-Ref
A relationship is an alternative endpoint to a series of table
joins. Relationships must be aliases of the primary table and
they must join either to the primary table or to a pre-existing
relationship.

An example of a relationship would be a nodereference table.
If you have a nodereference named 'book_parent' which links to a
parent node, you could set up a relationship 'node_book_parent'
to 'node'. Then, anything that links to 'node' can link to
'node_book_parent' instead, thus allowing all properties of
both nodes to be available in the query.

param: $alias
param: $join
param: $base
param: $link_point

add_table($table, $relationship = NULL, $join = NULL, $alias = NULL)   X-Ref
Add a table to the query, ensuring the path exists.

This function will test to ensure that the path back to the primary
table is valid and exists; if you do not wish for this testing to
occur, use $query->queue_table() instead.

param: $table
param: $relationship
param: $join
param: $alias
return: $alias

queue_table($table, $relationship = NULL, $join = NULL, $alias = NULL)   X-Ref
Add a table to the query, without ensuring the path.

This function will test to ensure that the path back to the primary
table is valid and exists; if you do not wish for this testing to
occur, use $query->queue_table() instead.

param: $table
param: $relationship
param: $join
param: $alias
return: $alias

mark_table($table, $relationship, $alias)   X-Ref
No description

ensure_table($table, $relationship = NULL, $join = NULL)   X-Ref
Ensure a table exists in the queue; if it already exists it won't
do anything, but if it doesn't it will add the table queue. It will ensure
a path leads back to the relationship table.

param: $table
param: $relationship
param: $join
return:

ensure_path($table, $relationship = NULL, $join = NULL, $traced = array()   X-Ref
Make sure that the specified table can be properly linked to the primary
table in the JOINs. This function uses recursion. If the tables
needed to complete the path back to the primary table are not in the
query they will be added, but additional copies will NOT be added
if the table is already there.


adjust_join($join, $relationship)   X-Ref
Fix a join to adhere to the proper relationship; the left table can vary
based upon what relationship items are joined in on.


get_join_data($table, $base_table)   X-Ref
Retrieve join data from the larger join data cache.

param: $table
param: $base_table
return:

get_table_info($table)   X-Ref
Get the information associated with a table.

If you need the alias of a table with a particular relationship, use
ensure_table().

add_field($table, $field, $alias = '', $params = NULL)   X-Ref
Add a field to the query table, possibly with an alias. This will
automatically call ensure_table to make sure the required table
exists, *unless* $table is unset.

param: $table
param: $field
param: $alias
return: $name

clear_fields()   X-Ref
Remove all fields that may've been added; primarily used for summary
mode where we're changing the query because we didn't get data we needed.


set_where_group($type = 'AND', $group = NULL, $where = 'where')   X-Ref
Create a new grouping for the WHERE or HAVING clause.

param: $type
param: $group
param: $where
return: $group

set_group_operator($type = 'AND')   X-Ref
Control how all WHERE and HAVING groups are put together.

param: $type

add_where($group, $clause)   X-Ref
Add a simple WHERE clause to the query. The caller is responsible for
ensuring that all fields are fully qualified (TABLE.FIELD) and that
the table already exists in the query.

param: $group
param: $clause
param: ...

add_having($group, $clause)   X-Ref
Add a simple HAVING clause to the query. The caller is responsible for
ensuring that all fields are fully qualified (TABLE.FIELD) and that
the table and an appropriate GROUP BY already exist in the query.

param: $group
param: $clause
param: ...

add_orderby($table, $field, $order, $alias = '')   X-Ref
Add an ORDER BY clause to the query.

param: $table
param: $field
param: $order
param: $alias

add_groupby($clause)   X-Ref
Add a simple GROUP BY clause to the query. The caller is responsible
for ensuring that the fields are fully qualified and the table is properly
added.


condition_sql($where = 'where')   X-Ref
Construct the "WHERE" or "HAVING" part of the query.

param: $where

query($get_count = FALSE)   X-Ref
Generate a query and a countquery from all of the information supplied
to the object.

param: $get_count

get_where_args()   X-Ref
Get the arguments attached to the WHERE and HAVING clauses of this query.




Generated: Thu Mar 24 11:18:33 2011 Cross-referenced by PHPXref 0.7