webCOMAND

query::where()

Add part or all of a cQL WHERE clause in one of the following formats. Multiple $expressions will be ANDed together along with an existing WHERE clause, if one exists.

Prototype

where(mixed $expressions): query

Parameters

  • expressions - A list of fields/expressions to select into the results in one of the following forms.
    • String - a full or partial comma-separated cQL SELECT clause.
    • Array - an array of individual fields/expressions to select.
    • Multiple Parameters - Instead of passing a single array of fields/expressions, each field/expression can be passed as a separate parameter.

Return

The updated query object is returned.  This is handy for chaining additional methods.

Example

$expression represents part or all of a cQL WHERE clause in one of the following formats. Multiple $expressions will be ANDed together along with an existing WHERE clause, if one exists.

  • Parameter expression
    $query->where( 'Name', '"Fred"' );
  • Sequence of parameter expressions that will be ANDed together.
    $query->where( 'Name', '"Fred"', 'Age >=', 18 );
  • Associative array expression of field/value pairs that will be ANDed together.
    $query->where( array('Name'=>'"Fred"', 'Age >='=>18) );
  • Array Expression
    $query->where( array('=','Name','"Fred"') );
  • Sequence of expression arrays that will all be ANDed together.
    $query->where( array('=','Name','"Fred"'), array('>=','Age',18) );
  • cQL expression string
    
    $query->where( 'Name="Fred"' );
    $query->where( 'Name="Fred" AND Age>=18' );