Methods summary
	
		| 
			 public 
			
			
			 | 
		#
		__construct( CDbConnection$connection, mixed $query = null )
			
Constructor. Parameters
					$connectionCDbConnection$connection the database connection
$querymixed$query the DB query to be executed. This can be either a string representing a
SQL statement, or an array whose name-value pairs will be used to set the
corresponding properties of the created command object. For example, you can
pass in either
 <span class="php-quote">'SELECT * FROM
tbl_user'</span>or<span
class="php-keyword1">array</span>(<span
class="php-quote">'select'</span>=><span
class="php-quote">'*'</span>, <span
class="php-quote">'from'</span>=><span
class="php-quote">'tbl_user'</span>). They are equivalent in
terms of the final query result. When passing the query as an array, the
following properties are commonly set:CDbCommand::select(), distinct,CDbCommand::from(),CDbCommand::where(),CDbCommand::join(),CDbCommand::group(),CDbCommand::having(),CDbCommand::order(),CDbCommand::limit(),CDbCommand::offset()andCDbCommand::union(). Please refer to the
setter of each of these properties for details about valid property values. This
feature has been available since version 1.1.6. Since 1.1.7 it is possible to
use a specific mode of data fetching by setting setFetchMode FetchMode.
See http://www.php.net/manual/en/function.PDOStatement-setFetchMode.php
for more details. | 
	
		| 
			 public 
			array
			
			 | 
		#
		__sleep( )
			
Set the statement to null when serializing. 
			
Set the statement to null when serializing. Returns
					array
 | 
	
		| 
			 public 
			static
			
			 | 
		#
		setFetchMode( mixed $mode )
			
Set the default fetch mode for this statement 
			
Set the default fetch mode for this statement Parameters
					$modemixed$mode fetch mode
Returns
					static
 Since
						1.1.7
 See | 
	
		| 
			 public 
			static
			
			 | 
		#
		reset( )
			
Cleans up the command and prepares for building a new query. This method is
mainly used when a command object is being reused multiple times for building
different queries. Calling this method will clean up all internal states of the
command object. 
			
Cleans up the command and prepares for building a new query. This method is
mainly used when a command object is being reused multiple times for building
different queries. Calling this method will clean up all internal states of the
command object. Returns
					staticthis command instance
 
 Since
						1.1.6
 | 
	
		| 
			 public 
			string
			
			 | 
		#
		getText( )
			
		 
			
				Returns
					stringthe SQL statement to be executed
 
 | 
	
		| 
			 public 
			static
			
			 | 
		#
		setText( string $value )
			
Specifies the SQL statement to be executed. Any previous execution will be
terminated or cancel. 
			
Specifies the SQL statement to be executed. Any previous execution will be
terminated or cancel. Parameters
					$valuestring$value the SQL statement to be executed
Returns
					staticthis command instance
 
 | 
	
		| 
			 public 
			CDbConnection |  | 
	
		| 
			 public 
			PDOStatement | 
		#
		getPdoStatement( )
			
		 
			
				Returns
					PDOStatementthe underlying PDOStatement for this command It could be null if the statement
is not prepared yet.
				 | 
	
		| 
			 public 
			
			
			 | 
		#
		prepare( )
			
Prepares the SQL statement to be executed. For complex SQL statement that is
to be executed multiple times, this may improve performance. For SQL statement
with binding parameters, this method is invoked automatically. 
			
Prepares the SQL statement to be executed. For complex SQL statement that is
to be executed multiple times, this may improve performance. For SQL statement
with binding parameters, this method is invoked automatically. Throws
					CDbExceptionif CDbCommand failed to prepare the SQL statement
				 | 
	
		| 
			 public 
			
			
			 | 
		#
		cancel( )
			
Cancels the execution of the SQL statement. 
			
Cancels the execution of the SQL statement. | 
	
		| 
			 public 
			static
			
			 | 
		#
		bindParam( mixed $name, mixed & $value, integer $dataType = null, integer $length = null, mixed $driverOptions = null )
			
Binds a parameter to the SQL statement to be executed. 
			
Binds a parameter to the SQL statement to be executed. Parameters
					$namemixed$name Parameter identifier. For a prepared statement using named placeholders,
this will be a parameter name of the form :name. For a prepared statement using
question mark placeholders, this will be the 1-indexed position of the
parameter.
$valuemixed$value Name of the PHP variable to bind to the SQL statement parameter
$dataTypeinteger$dataType SQL data type of the parameter. If null, the type is determined by the
PHP type of the value.
$lengthinteger$length length of the data type
$driverOptionsmixed$driverOptions the driver-specific options (this is available since version
1.1.6)
Returns
					staticthe current command being executed
 
 See | 
	
		| 
			 public 
			static
			
			 | 
		#
		bindValue( mixed $name, mixed $value, integer $dataType = null )
			
Binds a value to a parameter. 
			
Binds a value to a parameter. Parameters
					$namemixed$name Parameter identifier. For a prepared statement using named placeholders,
this will be a parameter name of the form :name. For a prepared statement using
question mark placeholders, this will be the 1-indexed position of the
parameter.
$valuemixed$value The value to bind to the parameter
$dataTypeinteger$dataType SQL data type of the parameter. If null, the type is determined by the
PHP type of the value.
Returns
					staticthe current command being executed
 
 See | 
	
		| 
			 public 
			static
			
			 | 
		#
		bindValues( array $values )
			
Binds a list of values to the corresponding parameters. This is similar to
CDbCommand::bindValue()except that it binds multiple values. Note that the SQL data
type of each value is determined by its PHP type. 
			
Binds a list of values to the corresponding parameters. This is similar to
CDbCommand::bindValue()except that it binds multiple values. Note that the SQL data
type of each value is determined by its PHP type. Parameters
					$valuesarray$values the values to be bound. This must be given in terms of an associative
array with array keys being the parameter names, and array values the
corresponding parameter values. For example,
 <span
class="php-keyword1">array</span>(<span
class="php-quote">':name'</span>=><span
class="php-quote">'John'</span>, <span
class="php-quote">':age'</span>=><span
class="php-num">25</span>).Returns
					staticthe current command being executed
 
 Since
						1.1.5
 | 
	
		| 
			 public 
			integer
			
			 | 
		#
		execute( array $params = array() )
			
Executes the SQL statement. This method is meant only for executing non-query
SQL statement. No result set will be returned. 
			
Executes the SQL statement. This method is meant only for executing non-query
SQL statement. No result set will be returned. ParametersReturns
					integernumber of rows affected by the execution.
 
 Throws | 
	
		| 
			 public 
			CDbDataReader | 
		#
		query( array $params = array() )
			
Executes the SQL statement and returns query result. This method is for
executing an SQL query that returns result set. 
			
Executes the SQL statement and returns query result. This method is for
executing an SQL query that returns result set. ParametersReturnsThrows | 
	
		| 
			 public 
			array
			
			 | 
		#
		queryAll( boolean $fetchAssociative = true, array $params = array() )
			
Executes the SQL statement and returns all rows. 
			
Executes the SQL statement and returns all rows. Parameters
					$fetchAssociativeboolean$fetchAssociative whether each row should be returned as an associated array
with column names as the keys or the array keys are column indexes (0-based).
$paramsarray$params input parameters (name=>value) for the SQL execution. This is an
alternative to
 CDbCommand::bindParam()andCDbCommand::bindValue(). If you have multiple
input parameters, passing them in this way can improve the performance. Note
that if you pass parameters in this way, you cannot bind parameters or values
usingCDbCommand::bindParam()orCDbCommand::bindValue(), and vice versa. Please also note
that all values are treated as strings in this case, if you need them to be
handled as their real data types, you have to useCDbCommand::bindParam()orCDbCommand::bindValue()instead.Returns
					arrayall rows of the query result. Each array element is an array representing a row.
An empty array is returned if the query results in nothing.
 
 Throws | 
	
		| 
			 public 
			mixed
			
			 | 
		#
		queryRow( boolean $fetchAssociative = true, array $params = array() )
			
Executes the SQL statement and returns the first row of the result. This is a
convenient method of CDbCommand::query()when only the first row of data is
needed. 
			
Executes the SQL statement and returns the first row of the result. This is a
convenient method of CDbCommand::query()when only the first row of data is
needed. Parameters
					$fetchAssociativeboolean$fetchAssociative whether the row should be returned as an associated array with
column names as the keys or the array keys are column indexes (0-based).
$paramsarray$params input parameters (name=>value) for the SQL execution. This is an
alternative to
 CDbCommand::bindParam()andCDbCommand::bindValue(). If you have multiple
input parameters, passing them in this way can improve the performance. Note
that if you pass parameters in this way, you cannot bind parameters or values
usingCDbCommand::bindParam()orCDbCommand::bindValue(), and vice versa. Please also note
that all values are treated as strings in this case, if you need them to be
handled as their real data types, you have to useCDbCommand::bindParam()orCDbCommand::bindValue()instead.Returns
					mixedthe first row (in terms of an array) of the query result, false if no result.
 
 Throws | 
	
		| 
			 public 
			mixed
			
			 | 
		#
		queryScalar( array $params = array() )
			
Executes the SQL statement and returns the value of the first column in the
first row of data. This is a convenient method of CDbCommand::query()when only a
single scalar value is needed (e.g. obtaining the count of the records). 
			
Executes the SQL statement and returns the value of the first column in the
first row of data. This is a convenient method of CDbCommand::query()when only a
single scalar value is needed (e.g. obtaining the count of the records). ParametersReturns
					mixedthe value of the first column in the first row of the query result. False is
returned if there is no value.
 
 Throws | 
	
		| 
			 public 
			array
			
			 | 
		#
		queryColumn( array $params = array() )
			
Executes the SQL statement and returns the first column of the result. This
is a convenient method of CDbCommand::query()when only the first column of data is
needed. Note, the column returned will contain the first element in each row of
result. 
			
Executes the SQL statement and returns the first column of the result. This
is a convenient method of CDbCommand::query()when only the first column of data is
needed. Note, the column returned will contain the first element in each row of
result. ParametersReturns
					arraythe first column of the query result. Empty array if no result.
 
 Throws | 
	
		| 
			 public 
			string
			
			 | 
		#
		buildQuery( array $query )
			
Builds a SQL SELECT statement from the given query specification. 
			
Builds a SQL SELECT statement from the given query specification. ParametersReturns
					stringthe SQL statement
 
 Throws
					CDbExceptionif "from" key is not present in given query parameter
				 Since
						1.1.6
 | 
	
		| 
			 public 
			static
			
			 | 
		#
		select( mixed $columns = '*', string $option = '' )
			
Sets the SELECT part of the query. 
			
Sets the SELECT part of the query. Parameters
					$columnsmixed$columns the columns to be selected. Defaults to '*', meaning all columns.
Columns can be specified in either a string (e.g. "id, name") or an array (e.g.
array('id', 'name')). Columns can contain table prefixes (e.g. "tbl_user.id")
and/or column aliases (e.g. "tbl_user.id AS user_id"). The method will
automatically quote the column names unless a column contains some parenthesis
(which means the column contains a DB expression).
$optionstring$option additional option that should be appended to the 'SELECT' keyword. For
example, in MySQL, the option 'SQL_CALC_FOUND_ROWS' can be used. This parameter
is supported since version 1.1.8.
Returns
					staticthe command object itself
 
 Since
						1.1.6
 | 
	
		| 
			 public 
			string
			
			 | 
		#
		getSelect( )
			
Returns the SELECT part in the query. 
			
Returns the SELECT part in the query. Returns
					stringthe SELECT part (without 'SELECT') in the query.
 
 Since
						1.1.6
 | 
	
		| 
			 public 
			
			
			 | 
		#
		setSelect( mixed $value )
			
Sets the SELECT part in the query. 
			
Sets the SELECT part in the query. Parameters
					$valuemixed$value the data to be selected. Please refer to
 CDbCommand::select()for details on
how to specify this parameter.Since
						1.1.6
 | 
	
		| 
			 public 
			CDbCommand | 
		#
		selectDistinct( mixed $columns = '*' )
			
Sets the SELECT part of the query with the DISTINCT flag turned on. This is
the same as CDbCommand::select()except that the DISTINCT flag is turned on. 
			
Sets the SELECT part of the query with the DISTINCT flag turned on. This is
the same as CDbCommand::select()except that the DISTINCT flag is turned on. ParametersReturnsSince
						1.1.6
 | 
	
		| 
			 public 
			boolean
			
			 | 
		#
		getDistinct( )
			
Returns a value indicating whether SELECT DISTINCT should be used. 
			
Returns a value indicating whether SELECT DISTINCT should be used. Returns
					booleana value indicating whether SELECT DISTINCT should be used.
 
 Since
						1.1.6
 | 
	
		| 
			 public 
			
			
			 | 
		#
		setDistinct( boolean $value )
			
Sets a value indicating whether SELECT DISTINCT should be used. 
			
Sets a value indicating whether SELECT DISTINCT should be used. Parameters
					$valueboolean$value a value indicating whether SELECT DISTINCT should be used.
Since
						1.1.6
 | 
	
		| 
			 public 
			static
			
			 | 
		#
		from( mixed $tables )
			
Sets the FROM part of the query. 
			
Sets the FROM part of the query. Parameters
					$tablesmixed$tables the table(s) to be selected from. This can be either a string (e.g.
'tbl_user') or an array (e.g. array('tbl_user', 'tbl_profile')) specifying one
or several table names. Table names can contain schema prefixes (e.g.
'public.tbl_user') and/or table aliases (e.g. 'tbl_user u'). The method will
automatically quote the table names unless it contains some parenthesis (which
means the table is given as a sub-query or DB expression).
Returns
					staticthe command object itself
 
 Since
						1.1.6
 | 
	
		| 
			 public 
			string
			
			 | 
		#
		getFrom( )
			
Returns the FROM part in the query. 
			
Returns the FROM part in the query. Returns
					stringthe FROM part (without 'FROM' ) in the query.
 
 Since
						1.1.6
 | 
	
		| 
			 public 
			
			
			 | 
		#
		setFrom( mixed $value )
			
Sets the FROM part in the query. 
			
Sets the FROM part in the query. Parameters
					$valuemixed$value the tables to be selected from. Please refer to
 CDbCommand::from()for
details on how to specify this parameter.Since
						1.1.6
 | 
	
		| 
			 public 
			static
			
			 | 
		#
		where( mixed $conditions, array $params = array() )
			
Sets the WHERE part of the query. 
			
Sets the WHERE part of the query. The method requires a $conditions parameter, and optionally a $params
parameter specifying the values to be bound to the query. 
The $conditions parameter should be either a string (e.g. 'id=1') or an array.
If the latter, it must be of the format  <span
class="php-keyword1">array</span>(operator, operand1, operand2,
...), where the operator can be one of the followings, and the possible
operands depend on the corresponding operator:
 
	<span class="php-keyword1">and</span>: the operands
	should be concatenated together using AND. For example, array('and', 'id=1',
	'id=2') will generate 'id=1 AND id=2'. If an operand is an array, it will be
	converted into a string using the same rules described here. For example,
	array('and', 'type=1', array('or', 'id=1', 'id=2')) will generate 'type=1 AND
	(id=1 OR id=2)'. The method will NOT do any quoting or escaping.<span class="php-keyword1">or</span>: similar as
	the<span class="php-keyword1">and</span>operator
	except that the operands are concatenated using OR.in: operand 1 should be a column or DB expression, and operand
	2 be an array representing the range of the values that the column or DB
	expression should be in. For example, array('in', 'id', array(1,2,3)) will
	generate 'id IN (1,2,3)'. The method will properly quote the column name and
	escape values in the range.not in: similar as theinoperator except that IN
	is replaced with NOT IN in the generated condition.like: operand 1 should be a column or DB expression, and
	operand 2 be a string or an array representing the values that the column or DB
	expression should be like. For example, array('like', 'name', '%tester%') will
	generate "name LIKE '%tester%'". When the value range is given as an array,
	multiple LIKE predicates will be generated and concatenated using AND. For
	example, array('like', 'name', array('%test%', '%sample%')) will generate "name
	LIKE '%test%' AND name LIKE '%sample%'". The method will properly quote the
	column name and escape values in the range.not like: similar as thelikeoperator except that
	LIKE is replaced with NOT LIKE in the generated condition.<span class="php-keyword1">or</span> like: similar
	as thelikeoperator except that OR is used to concatenated the
	LIKE predicates.<span class="php-keyword1">or</span> not like:
	similar as thenot likeoperator except that OR is used to
	concatenated the NOT LIKE predicates. Parameters
					$conditionsmixed$conditions the conditions that should be put in the WHERE part.
$paramsarray$params the parameters (name=>value) to be bound to the query
Returns
					staticthe command object itself
 
 Since
						1.1.6
 | 
	
		| 
			 public 
			static
			
			 | 
		#
		andWhere( mixed $conditions, array $params = array() )
			
Appends given condition to the existing WHERE part of the query with 'AND'
operator. 
			
Appends given condition to the existing WHERE part of the query with 'AND'
operator. This method works almost the same way as CDbCommand::where()except the fact that
it appends condition with 'AND' operator, but not replaces it with the new one.
For more information on parameters of this method refer to theCDbCommand::where()documentation. Parameters
					$conditionsmixed$conditions the conditions that should be appended to the WHERE part.
$paramsarray$params the parameters (name=>value) to be bound to the query.
Returns
					staticthe command object itself.
 
 Since
						1.1.13
 | 
	
		| 
			 public 
			static
			
			 | 
		#
		orWhere( mixed $conditions, array $params = array() )
			
Appends given condition to the existing WHERE part of the query with 'OR'
operator. 
			
Appends given condition to the existing WHERE part of the query with 'OR'
operator. This method works almost the same way as CDbCommand::where()except the fact that
it appends condition with 'OR' operator, but not replaces it with the new one.
For more information on parameters of this method refer to theCDbCommand::where()documentation. Parameters
					$conditionsmixed$conditions the conditions that should be appended to the WHERE part.
$paramsarray$params the parameters (name=>value) to be bound to the query.
Returns
					staticthe command object itself.
 
 Since
						1.1.13
 | 
	
		| 
			 public 
			string
			
			 | 
		#
		getWhere( )
			
Returns the WHERE part in the query. 
			
Returns the WHERE part in the query. Returns
					stringthe WHERE part (without 'WHERE' ) in the query.
 
 Since
						1.1.6
 | 
	
		| 
			 public 
			
			
			 | 
		#
		setWhere( mixed $value )
			
Sets the WHERE part in the query. 
			
Sets the WHERE part in the query. Parameters
					$valuemixed$value the where part. Please refer to
 CDbCommand::where()for details on how to
specify this parameter.Since
						1.1.6
 | 
	
		| 
			 public 
			CDbCommand | 
		#
		join( string $table, mixed $conditions, array $params = array() )
			
Appends an INNER JOIN part to the query. 
			
Appends an INNER JOIN part to the query. Parameters
					$tablestring$table the table to be joined. Table name can contain schema prefix (e.g.
'public.tbl_user') and/or table alias (e.g. 'tbl_user u'). The method will
automatically quote the table name unless it contains some parenthesis (which
means the table is given as a sub-query or DB expression).
$conditionsmixed$conditions the join condition that should appear in the ON part. Please refer
to
 CDbCommand::where()on how to specify conditions.$paramsarray$params the parameters (name=>value) to be bound to the query
ReturnsSince
						1.1.6
 | 
	
		| 
			 public 
			mixed
			
			 | 
		#
		getJoin( )
			
Returns the join part in the query. 
			
Returns the join part in the query. Returns
					mixedthe join part in the query. This can be an array representing multiple join
fragments, or a string representing a single join fragment. Each join fragment
will contain the proper join operator (e.g. LEFT JOIN).
 
 Since
						1.1.6
 | 
	
		| 
			 public 
			
			
			 | 
		#
		setJoin( mixed $value )
			
Sets the join part in the query. 
			
Sets the join part in the query. Parameters
					$valuemixed$value the join part in the query. This can be either a string or an array
representing multiple join parts in the query. Each part must contain the proper
join operator (e.g. 'LEFT JOIN tbl_profile ON tbl_user.id=tbl_profile.id')
Since
						1.1.6
 | 
	
		| 
			 public 
			CDbCommand | 
		#
		leftJoin( string $table, mixed $conditions, array $params = array() )
			
Appends a LEFT OUTER JOIN part to the query. 
			
Appends a LEFT OUTER JOIN part to the query. Parameters
					$tablestring$table the table to be joined. Table name can contain schema prefix (e.g.
'public.tbl_user') and/or table alias (e.g. 'tbl_user u'). The method will
automatically quote the table name unless it contains some parenthesis (which
means the table is given as a sub-query or DB expression).
$conditionsmixed$conditions the join condition that should appear in the ON part. Please refer
to
 CDbCommand::where()on how to specify conditions.$paramsarray$params the parameters (name=>value) to be bound to the query
ReturnsSince
						1.1.6
 | 
	
		| 
			 public 
			CDbCommand | 
		#
		rightJoin( string $table, mixed $conditions, array $params = array() )
			
Appends a RIGHT OUTER JOIN part to the query. 
			
Appends a RIGHT OUTER JOIN part to the query. Parameters
					$tablestring$table the table to be joined. Table name can contain schema prefix (e.g.
'public.tbl_user') and/or table alias (e.g. 'tbl_user u'). The method will
automatically quote the table name unless it contains some parenthesis (which
means the table is given as a sub-query or DB expression).
$conditionsmixed$conditions the join condition that should appear in the ON part. Please refer
to
 CDbCommand::where()on how to specify conditions.$paramsarray$params the parameters (name=>value) to be bound to the query
ReturnsSince
						1.1.6
 | 
	
		| 
			 public 
			CDbCommand | 
		#
		crossJoin( string $table )
			
Appends a CROSS JOIN part to the query. Note that not all DBMS support CROSS
JOIN. 
			
Appends a CROSS JOIN part to the query. Note that not all DBMS support CROSS
JOIN. Parameters
					$tablestring$table the table to be joined. Table name can contain schema prefix (e.g.
'public.tbl_user') and/or table alias (e.g. 'tbl_user u'). The method will
automatically quote the table name unless it contains some parenthesis (which
means the table is given as a sub-query or DB expression).
ReturnsSince
						1.1.6
 | 
	
		| 
			 public 
			CDbCommand | 
		#
		naturalJoin( string $table )
			
Appends a NATURAL JOIN part to the query. Note that not all DBMS support
NATURAL JOIN. 
			
Appends a NATURAL JOIN part to the query. Note that not all DBMS support
NATURAL JOIN. Parameters
					$tablestring$table the table to be joined. Table name can contain schema prefix (e.g.
'public.tbl_user') and/or table alias (e.g. 'tbl_user u'). The method will
automatically quote the table name unless it contains some parenthesis (which
means the table is given as a sub-query or DB expression).
ReturnsSince
						1.1.6
 | 
	
		| 
			 public 
			CDbCommand | 
		#
		naturalLeftJoin( string $table )
			
Appends a NATURAL LEFT JOIN part to the query. Note that not all DBMS support
NATURAL LEFT JOIN. 
			
Appends a NATURAL LEFT JOIN part to the query. Note that not all DBMS support
NATURAL LEFT JOIN. Parameters
					$tablestring$table the table to be joined. Table name can contain schema prefix (e.g.
'public.tbl_user') and/or table alias (e.g. 'tbl_user u'). The method will
automatically quote the table name unless it contains some parenthesis (which
means the table is given as a sub-query or DB expression).
ReturnsSince
						1.1.16
 | 
	
		| 
			 public 
			CDbCommand | 
		#
		naturalRightJoin( string $table )
			
Appends a NATURAL RIGHT JOIN part to the query. Note that not all DBMS
support NATURAL RIGHT JOIN. 
			
Appends a NATURAL RIGHT JOIN part to the query. Note that not all DBMS
support NATURAL RIGHT JOIN. Parameters
					$tablestring$table the table to be joined. Table name can contain schema prefix (e.g.
'public.tbl_user') and/or table alias (e.g. 'tbl_user u'). The method will
automatically quote the table name unless it contains some parenthesis (which
means the table is given as a sub-query or DB expression).
ReturnsSince
						1.1.16
 | 
	
		| 
			 public 
			static
			
			 | 
		#
		group( mixed $columns )
			
Sets the GROUP BY part of the query. 
			
Sets the GROUP BY part of the query. Parameters
					$columnsmixed$columns the columns to be grouped by. Columns can be specified in either a
string (e.g. "id, name") or an array (e.g. array('id', 'name')). The method will
automatically quote the column names unless a column contains some parenthesis
(which means the column contains a DB expression).
Returns
					staticthe command object itself
 
 Since
						1.1.6
 | 
	
		| 
			 public 
			string
			
			 | 
		#
		getGroup( )
			
Returns the GROUP BY part in the query. 
			
Returns the GROUP BY part in the query. Returns
					stringthe GROUP BY part (without 'GROUP BY' ) in the query.
 
 Since
						1.1.6
 | 
	
		| 
			 public 
			
			
			 | 
		#
		setGroup( mixed $value )
			
Sets the GROUP BY part in the query. 
			
Sets the GROUP BY part in the query. Parameters
					$valuemixed$value the GROUP BY part. Please refer to
 CDbCommand::group()for details on how to
specify this parameter.Since
						1.1.6
 | 
	
		| 
			 public 
			static
			
			 | 
		#
		having( mixed $conditions, array $params = array() )
			
Sets the HAVING part of the query. 
			
Sets the HAVING part of the query. Parameters
					$conditionsmixed$conditions the conditions to be put after HAVING. Please refer to
 CDbCommand::where()on how to specify conditions.$paramsarray$params the parameters (name=>value) to be bound to the query
Returns
					staticthe command object itself
 
 Since
						1.1.6
 | 
	
		| 
			 public 
			string
			
			 | 
		#
		getHaving( )
			
Returns the HAVING part in the query. 
			
Returns the HAVING part in the query. Returns
					stringthe HAVING part (without 'HAVING' ) in the query.
 
 Since
						1.1.6
 | 
	
		| 
			 public 
			
			
			 | 
		#
		setHaving( mixed $value )
			
Sets the HAVING part in the query. 
			
Sets the HAVING part in the query. Parameters
					$valuemixed$value the HAVING part. Please refer to
 CDbCommand::having()for details on how to
specify this parameter.Since
						1.1.6
 | 
	
		| 
			 public 
			static
			
			 | 
		#
		order( mixed $columns )
			
Sets the ORDER BY part of the query. 
			
Sets the ORDER BY part of the query. Parameters
					$columnsmixed$columns the columns (and the directions) to be ordered by. Columns can be
specified in either a string (e.g. "id ASC, name DESC") or an array (e.g.
array('id ASC', 'name DESC')). The method will automatically quote the column
names unless a column contains some parenthesis (which means the column contains
a DB expression). For example, to get "ORDER BY 1" you should use <pre>
$criteria->order('(1)'); </pre>
Returns
					staticthe command object itself
 
 Since
						1.1.6
 | 
	
		| 
			 public 
			string
			
			 | 
		#
		getOrder( )
			
Returns the ORDER BY part in the query. 
			
Returns the ORDER BY part in the query. Returns
					stringthe ORDER BY part (without 'ORDER BY' ) in the query.
 
 Since
						1.1.6
 | 
	
		| 
			 public 
			
			
			 | 
		#
		setOrder( mixed $value )
			
Sets the ORDER BY part in the query. 
			
Sets the ORDER BY part in the query. Parameters
					$valuemixed$value the ORDER BY part. Please refer to
 CDbCommand::order()for details on how to
specify this parameter.Since
						1.1.6
 | 
	
		| 
			 public 
			static
			
			 | 
		#
		limit( integer $limit, integer $offset = null )
			
Sets the LIMIT part of the query. 
			
Sets the LIMIT part of the query. Parameters
					$limitinteger$limit the limit
$offsetinteger$offset the offset
Returns
					staticthe command object itself
 
 Since
						1.1.6
 | 
	
		| 
			 public 
			string
			
			 | 
		#
		getLimit( )
			
Returns the LIMIT part in the query. 
			
Returns the LIMIT part in the query. Returns
					stringthe LIMIT part (without 'LIMIT' ) in the query.
 
 Since
						1.1.6
 | 
	
		| 
			 public 
			
			
			 | 
		#
		setLimit( integer $value )
			
Sets the LIMIT part in the query. 
			
Sets the LIMIT part in the query. Parameters
					$valueinteger$value the LIMIT part. Please refer to
 CDbCommand::limit()for details on how to
specify this parameter.Since
						1.1.6
 | 
	
		| 
			 public 
			static
			
			 | 
		#
		offset( integer $offset )
			
Sets the OFFSET part of the query. 
			
Sets the OFFSET part of the query. Parameters
					$offsetinteger$offset the offset
Returns
					staticthe command object itself
 
 Since
						1.1.6
 | 
	
		| 
			 public 
			string
			
			 | 
		#
		getOffset( )
			
Returns the OFFSET part in the query. 
			
Returns the OFFSET part in the query. Returns
					stringthe OFFSET part (without 'OFFSET' ) in the query.
 
 Since
						1.1.6
 | 
	
		| 
			 public 
			
			
			 | 
		#
		setOffset( integer $value )
			
Sets the OFFSET part in the query. 
			
Sets the OFFSET part in the query. Parameters
					$valueinteger$value the OFFSET part. Please refer to
 CDbCommand::offset()for details on how to
specify this parameter.Since
						1.1.6
 | 
	
		| 
			 public 
			static
			
			 | 
		#
		union( string $sql )
			
Appends a SQL statement using UNION operator. 
			
Appends a SQL statement using UNION operator. Parameters
					$sqlstring$sql the SQL statement to be appended using UNION
Returns
					staticthe command object itself
 
 Since
						1.1.6
 | 
	
		| 
			 public 
			mixed
			
			 | 
		#
		getUnion( )
			
Returns the UNION part in the query. 
			
Returns the UNION part in the query. Returns
					mixedthe UNION part (without 'UNION' ) in the query. This can be either a string or
an array representing multiple union parts.
 
 Since
						1.1.6
 | 
	
		| 
			 public 
			
			
			 | 
		#
		setUnion( mixed $value )
			
Sets the UNION part in the query. 
			
Sets the UNION part in the query. Parameters
					$valuemixed$value the UNION part. This can be either a string or an array representing
multiple SQL statements to be unioned together.
Since
						1.1.6
 | 
	
		| 
			 public 
			integer
			
			 | 
		#
		insert( string $table, array $columns )
			
Creates and executes an INSERT SQL statement. The method will properly escape
the column names, and bind the values to be inserted. 
			
Creates and executes an INSERT SQL statement. The method will properly escape
the column names, and bind the values to be inserted. Parameters
					$tablestring$table the table that new rows will be inserted into.
$columnsarray$columns the column data (name=>value) to be inserted into the table.
Returns
					integernumber of rows affected by the execution.
 
 Since
						1.1.6
 | 
	
		| 
			 public 
			integer
			
			 | 
		#
		update( string $table, array $columns, mixed $conditions = '', array $params = array() )
			
Creates and executes an UPDATE SQL statement. The method will properly escape
the column names and bind the values to be updated. 
			
Creates and executes an UPDATE SQL statement. The method will properly escape
the column names and bind the values to be updated. Parameters
					$tablestring$table the table to be updated.
$columnsarray$columns the column data (name=>value) to be updated.
$conditionsmixed$conditions the conditions that will be put in the WHERE part. Please refer to
 CDbCommand::where()on how to specify conditions.$paramsarray$params the parameters to be bound to the query. Do not use column names as
parameter names here. They are reserved for
 <span
class="php-var">$columns</span>parameter.Returns
					integernumber of rows affected by the execution.
 
 Since
						1.1.6
 | 
	
		| 
			 public 
			integer
			
			 | 
		#
		delete( string $table, mixed $conditions = '', array $params = array() )
			
Creates and executes a DELETE SQL statement. 
			
Creates and executes a DELETE SQL statement. Parameters
					$tablestring$table the table where the data will be deleted from.
$conditionsmixed$conditions the conditions that will be put in the WHERE part. Please refer to
 CDbCommand::where()on how to specify conditions.$paramsarray$params the parameters to be bound to the query.
Returns
					integernumber of rows affected by the execution.
 
 Since
						1.1.6
 | 
	
		| 
			 public 
			integer
			
			 | 
		#
		createTable( string $table, array $columns, string $options = null )
			
Builds and executes a SQL statement for creating a new DB table. 
			
Builds and executes a SQL statement for creating a new DB table. The columns in the new table should be specified as name-definition pairs
(e.g. 'name'=>'string'), where name stands for a column name which will be
properly quoted by the method, and definition stands for the column type which
can contain an abstract DB type. The getColumnType method will be
invoked to convert any abstract type into a physical one. If a column is specified with definition only (e.g. 'PRIMARY KEY (name,
type)'), it will be directly inserted into the generated SQL. Parameters
					$tablestring$table the name of the table to be created. The name will be properly quoted by
the method.
$columnsarray$columns the columns (name=>definition) in the new table.
$optionsstring$options additional SQL fragment that will be appended to the generated SQL.
ReturnsSince
						1.1.6
 | 
	
		| 
			 public 
			integer
			
			 | 
		#
		renameTable( string $table, string $newName )
			
Builds and executes a SQL statement for renaming a DB table. 
			
Builds and executes a SQL statement for renaming a DB table. Parameters
					$tablestring$table the table to be renamed. The name will be properly quoted by the method.
$newNamestring$newName the new table name. The name will be properly quoted by the method.
ReturnsSince
						1.1.6
 | 
	
		| 
			 public 
			integer
			
			 | 
		#
		dropTable( string $table )
			
Builds and executes a SQL statement for dropping a DB table. 
			
Builds and executes a SQL statement for dropping a DB table. Parameters
					$tablestring$table the table to be dropped. The name will be properly quoted by the method.
ReturnsSince
						1.1.6
 | 
	
		| 
			 public 
			integer
			
			 | 
		#
		truncateTable( string $table )
			
Builds and executes a SQL statement for truncating a DB table. 
			
Builds and executes a SQL statement for truncating a DB table. Parameters
					$tablestring$table the table to be truncated. The name will be properly quoted by the
method.
Returns
					integernumber of rows affected by the execution.
 
 Since
						1.1.6
 | 
	
		| 
			 public 
			integer
			
			 | 
		#
		addColumn( string $table, string $column, string $type )
			
Builds and executes a SQL statement for adding a new DB column. 
			
Builds and executes a SQL statement for adding a new DB column. Parameters
					$tablestring$table the table that the new column will be added to. The table name will be
properly quoted by the method.
$columnstring$column the name of the new column. The name will be properly quoted by the
method.
$typestring$type the column type. The getColumnType method will be invoked to
convert abstract column type (if any) into the physical one. Anything that is
not recognized as abstract type will be kept in the generated SQL. For example,
'string' will be turned into 'varchar(255)', while 'string not null' will become
'varchar(255) not null'.
Returns
					integernumber of rows affected by the execution.
 
 Since
						1.1.6
 | 
	
		| 
			 public 
			integer
			
			 | 
		#
		dropColumn( string $table, string $column )
			
Builds and executes a SQL statement for dropping a DB column. 
			
Builds and executes a SQL statement for dropping a DB column. Parameters
					$tablestring$table the table whose column is to be dropped. The name will be properly quoted
by the method.
$columnstring$column the name of the column to be dropped. The name will be properly quoted
by the method.
Returns
					integernumber of rows affected by the execution.
 
 Since
						1.1.6
 | 
	
		| 
			 public 
			integer
			
			 | 
		#
		renameColumn( string $table, string $name, string $newName )
			
Builds and executes a SQL statement for renaming a column. 
			
Builds and executes a SQL statement for renaming a column. Parameters
					$tablestring$table the table whose column is to be renamed. The name will be properly quoted
by the method.
$namestring$name the old name of the column. The name will be properly quoted by the
method.
$newNamestring$newName the new name of the column. The name will be properly quoted by the
method.
Returns
					integernumber of rows affected by the execution.
 
 Since
						1.1.6
 | 
	
		| 
			 public 
			integer
			
			 | 
		#
		alterColumn( string $table, string $column, string $type )
			
Builds and executes a SQL statement for changing the definition of a
column. 
			
Builds and executes a SQL statement for changing the definition of a
column. Parameters
					$tablestring$table the table whose column is to be changed. The table name will be properly
quoted by the method.
$columnstring$column the name of the column to be changed. The name will be properly quoted
by the method.
$typestring$type the new column type. The getColumnType method will be invoked to
convert abstract column type (if any) into the physical one. Anything that is
not recognized as abstract type will be kept in the generated SQL. For example,
'string' will be turned into 'varchar(255)', while 'string not null' will become
'varchar(255) not null'.
Returns
					integernumber of rows affected by the execution.
 
 Since
						1.1.6
 | 
	
		| 
			 public 
			integer
			
			 | 
		#
		addForeignKey( string $name, string $table, string|array $columns, string $refTable, string|array $refColumns, string $delete = null, string $update = null )
			
Builds a SQL statement for adding a foreign key constraint to an existing
table. The method will properly quote the table and column names. 
			
Builds a SQL statement for adding a foreign key constraint to an existing
table. The method will properly quote the table and column names. Parameters
					$namestring$name the name of the foreign key constraint.
$tablestring$table the table that the foreign key constraint will be added to.
$columnsstring|array$columns the name of the column to that the constraint will be added on. If
there are multiple columns, separate them with commas or pass as an array of
column names.
$refTablestring$refTable the table that the foreign key references to.
$refColumnsstring|array$refColumns the name of the column that the foreign key references to. If there
are multiple columns, separate them with commas or pass as an array of column
names.
$deletestring$delete the ON DELETE option. Most DBMS support these options: RESTRICT,
CASCADE, NO ACTION, SET DEFAULT, SET NULL
$updatestring$update the ON UPDATE option. Most DBMS support these options: RESTRICT,
CASCADE, NO ACTION, SET DEFAULT, SET NULL
Returns
					integernumber of rows affected by the execution.
 
 Since
						1.1.6
 | 
	
		| 
			 public 
			integer
			
			 | 
		#
		dropForeignKey( string $name, string $table )
			
Builds a SQL statement for dropping a foreign key constraint. 
			
Builds a SQL statement for dropping a foreign key constraint. Parameters
					$namestring$name the name of the foreign key constraint to be dropped. The name will be
properly quoted by the method.
$tablestring$table the table whose foreign is to be dropped. The name will be properly
quoted by the method.
Returns
					integernumber of rows affected by the execution.
 
 Since
						1.1.6
 | 
	
		| 
			 public 
			integer
			
			 | 
		#
		createIndex( string $name, string $table, string|array $columns, boolean $unique = false )
			
Builds and executes a SQL statement for creating a new index. 
			
Builds and executes a SQL statement for creating a new index. Parameters
					$namestring$name the name of the index. The name will be properly quoted by the method.
$tablestring$table the table that the new index will be created for. The table name will be
properly quoted by the method.
$columnsstring|array$columns the column(s) that should be included in the index. If there are
multiple columns, please separate them by commas or pass as an array of column
names. Each column name will be properly quoted by the method, unless a
parenthesis is found in the name.
$uniqueboolean$unique whether to add UNIQUE constraint on the created index.
Returns
					integernumber of rows affected by the execution.
 
 Since
						1.1.6
 | 
	
		| 
			 public 
			integer
			
			 | 
		#
		dropIndex( string $name, string $table )
			
Builds and executes a SQL statement for dropping an index. 
			
Builds and executes a SQL statement for dropping an index. Parameters
					$namestring$name the name of the index to be dropped. The name will be properly quoted by
the method.
$tablestring$table the table whose index is to be dropped. The name will be properly quoted
by the method.
Returns
					integernumber of rows affected by the execution.
 
 Since
						1.1.6
 | 
	
		| 
			 public 
			integer
			
			 | 
		#
		addPrimaryKey( string $name, string $table, string|array $columns )
			
Builds a SQL statement for creating a primary key constraint. 
			
Builds a SQL statement for creating a primary key constraint. Parameters
					$namestring$name the name of the primary key constraint to be created. The name will be
properly quoted by the method.
$tablestring$table the table who will be inheriting the primary key. The name will be
properly quoted by the method.
$columnsstring|array$columns comma separated string or array of columns that the primary key will
consist of. Array value can be passed since 1.1.14.
Returns
					integernumber of rows affected by the execution.
 
 Since
						1.1.13
 | 
	
		| 
			 public 
			integer
			
			 | 
		#
		dropPrimaryKey( string $name, string $table )
			
Builds a SQL statement for dropping a primary key constraint. 
			
Builds a SQL statement for dropping a primary key constraint. Parameters
					$namestring$name the name of the primary key constraint to be dropped. The name will be
properly quoted by the method.
$tablestring$table the table that owns the primary key. The name will be properly quoted by
the method.
Returns
					integernumber of rows affected by the execution.
 
 Since
						1.1.13
 |