webCOMAND

query::__construct

Create a new query object that can be initialized with a query or portion of a query and subsequently modified and built upon before processing.

This constructor should not be called directly under normal circumstances.  Instead, use repository::query() to create a new query object for a specific repository.

Prototype

query __construct(queryable $queryable = [], query $query = NULL, array $options = [])

Parameters

  • $queryable - Object that implements the abstract_queryable interface, such as a repository or collection.
  • $query - cQL String or cQL Array query.
  • $options - Optional associative array of query options, which can be used to initialize the query with certain clauses.
    • checksum - Include a checksum in the query results.  Values are TRUE or FALSE (default).
    • checksum_only - Only produce the query checksum, instead of performing the query to get results.  Values are TRUE or FALSE (default).
    • bind - array of query bindings.

Return

A repository object is returned, which can be used to access and query the repository.

Example

require_once('path/to/comand.php');

$repo = \comand::repo();
$query = new \comand\repository\query($repo, "FROM Contact WHERE Name='John' LIMIT 1");
$contact = $query->get_first();
echo($contact . "\n");