* @link http://www.yiiframework.com/ * @copyright Copyright © 2008 Yii Software LLC * @license http://www.yiiframework.com/license/ */ /** * CDbCriteria represents a query criteria, such as conditions, ordering by, limit/offset. * * @author Qiang Xue * @version $Id$ * @package system.db.schema * @since 1.0 */ class CDbCriteria { /** * @var mixed 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. */ public $select='*'; /** * @var string query condition. This refers to the WHERE clause in an SQL statement. * For example, age>31 AND team=1. */ public $condition=''; /** * @var array list of query parameter values indexed by parameter placeholders. * For example, array(':name'=>'Dan', ':age'=>31). */ public $params=array(); /** * @var integer maximum number of records to be returned. If less than 0, it means no limit. */ public $limit=-1; /** * @var integer zero-based offset from where the records are to be returned. If less than 0, it means starting from the beginning. */ public $offset=-1; /** * @var string how to sort the query results. This refers to the ORDER BY clause in an SQL statement. */ public $order=''; /** * @var string how to group the query results. This refers to the GROUP BY clause in an SQL statement. * For example, 'projectID, teamID'. */ public $group=''; /** * @var string 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'. */ public $join=''; /** * Constructor. * @param array criteria initial property values (indexed by property name) */ public function __construct($data=array()) { foreach($data as $name=>$value) $this->$name=$value; } }