function views_query::condition_sql
2.x query.inc | views_query::condition_sql($where = 'where') |
Construct the "WHERE" or "HAVING" part of the query.
Parameters
$where: 'where' or 'having'.
1 call to views_query::condition_sql()
- views_query::query in includes/
query.inc - Generate a query and a countquery from all of the information supplied to the object.
File
- includes/
query.inc, line 864 - 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 condition_sql($where = 'where') {
$clauses = array();
foreach ($this->$where as $group => $info) {
$clause = implode(") " . $info['type'] . " (", $info['clauses']);
if (count($info['clauses']) > 1) {
$clause = '(' . $clause . ')';
}
$clauses[] = $clause;
}
if ($clauses) {
$keyword = drupal_strtoupper($where);
if (count($clauses) > 1) {
return "$keyword (" . implode(")\n " . $this->group_operator . ' (', $clauses) . ")\n";
}
else {
return "$keyword " . array_shift($clauses) . "\n";
}
}
return "";
}