CDbCriteria

Package system.db.schema
Inheritance class CDbCriteria
Since 1.0
Version $Id: CDbCriteria.php 433 2008-12-30 22:59:17Z qiang.xue $
CDbCriteria represents a query criteria, such as conditions, ordering by, limit/offset.

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
condition string query condition. CDbCriteria
group string how to group the query results. CDbCriteria
having string the condition to be applied with GROUP-BY clause. CDbCriteria
join string how to join with other tables. CDbCriteria
limit integer maximum number of records to be returned. CDbCriteria
offset integer zero-based offset from where the records are to be returned. CDbCriteria
order string how to sort the query results. CDbCriteria
params array list of query parameter values indexed by parameter placeholders. CDbCriteria
select mixed the columns being selected. CDbCriteria

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__construct() Constructor. CDbCriteria

Property Details

condition property
public string $condition;

query condition. This refers to the WHERE clause in an SQL statement. For example, age>31 AND team=1.

group property
public string $group;

how to group the query results. This refers to the GROUP BY clause in an SQL statement. For example, 'projectID, teamID'.

having property (available since v1.0.1)
public string $having;

the condition to be applied with GROUP-BY clause. For example, 'SUM(revenue)<50000'.

join property
public string $join;

how to join with other tables. This refers to the JOIN clause in an SQL statement. For example, 'LEFT JOIN users ON users.id=authorID'.

limit property
public integer $limit;

maximum number of records to be returned. If less than 0, it means no limit.

offset property
public integer $offset;

zero-based offset from where the records are to be returned. If less than 0, it means starting from the beginning.

order property
public string $order;

how to sort the query results. This refers to the ORDER BY clause in an SQL statement.

params property
public array $params;

list of query parameter values indexed by parameter placeholders. For example, array(':name'=>'Dan', ':age'=>31).

select property
public mixed $select;

the columns being selected. This refers to the SELECT clause in an SQL statement. The property can be either a string (column names separated by commas) or an array of column names. Defaults to '*', meaning all columns.

Method Details

__construct() method
public void __construct(array $data=array ( ))
$data array criteria initial property values (indexed by property name)

Constructor.