Files
yii/framework/db/schema/CDbCriteria.php
qiang.xue 662798d8a5
2008-09-28 12:03:53 +00:00

70 lines
2.1 KiB
PHP

<?php
/**
* CDbCriteria class file.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.yiiframework.com/
* @copyright Copyright &copy; 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 <qiang.xue@gmail.com>
* @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, <code>age>31 AND team=1</code>.
*/
public $condition='';
/**
* @var array list of query parameter values indexed by parameter placeholders.
* For example, <code>array(':name'=>'Dan', ':age'=>31)</code>.
*/
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, <code>'projectID, teamID'</code>.
*/
public $group='';
/**
* @var string how to join with other tables. This refers to the JOIN clause in an SQL statement.
* For example, <code>'LEFT JOIN users ON users.id=authorID'</code>.
*/
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;
}
}