function ldap_views_plugin_query_ldap::add_where in Lightweight Directory Access Protocol (LDAP) 8.2
Same name and namespace in other branches
- 7.2 ldap_views/plugins/ldap_views_plugin_query_ldap.inc \ldap_views_plugin_query_ldap::add_where()
- 7 ldap_views/plugins/ldap_views_plugin_query_ldap.inc \ldap_views_plugin_query_ldap::add_where()
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.
Parameters
$group: The WHERE group to add these to; groups are used to create AND/OR sections. Groups cannot be nested. Use 0 as the default group. If the group does not yet exist it will be created as an AND group.
$field: The name of the field to check.
$value: The value to test the field against. In most cases, this is a scalar. For more complex options, it is an array. The meaning of each element in the array is dependent on the $operator.
$operator: The comparison operator, such as =, <, or >=. It also accepts more complex options such as IN, LIKE, or BETWEEN. Defaults to IN if $value is an array = otherwise. If $field is a string you have to use 'formula' here.
See also
QueryConditionInterface::condition()
File
- ldap_views/
plugins/ ldap_views_plugin_query_ldap.inc, line 111 - Defines the default query object which builds and execute a ldap query
Class
- ldap_views_plugin_query_ldap
- @file Defines the default query object which builds and execute a ldap query
Code
function add_where($group, $field, $value = NULL, $operator = NULL) {
// Ensure all variants of 0 are actually 0. Thus '', 0 and NULL are all
// the default group.
if (empty($group)) {
$group = 0;
}
// Check for a group.
if (!isset($this->where[$group])) {
$this
->set_where_group('AND', $group);
}
$this->where[$group]['conditions'][] = array(
'field' => $field,
'value' => $value,
'operator' => ltrim($operator, '!'),
'negate' => drupal_substr($operator, 0, 1) == '!',
);
}