|
|
@ -10,13 +10,15 @@ |
|
|
|
namespace yii\db; |
|
|
|
namespace yii\db; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Query represents a SQL statement in a way that is independent of DBMS. |
|
|
|
* Query represents a SELECT SQL statement in a way that is independent of DBMS. |
|
|
|
* |
|
|
|
* |
|
|
|
* Query not only can represent a SELECT statement, it can also represent INSERT, UPDATE, DELETE, |
|
|
|
* Query provides a set of methods to facilitate the specification of different clauses |
|
|
|
* and other commonly used DDL statements, such as CREATE TABLE, CREATE INDEX, etc. |
|
|
|
* in a SELECT statement. These methods can be chained together. |
|
|
|
* |
|
|
|
* |
|
|
|
* Query provides a set of methods to facilitate the specification of different clauses. |
|
|
|
* By calling [[createCommand()]], we can get a [[Command]] instance which can be further |
|
|
|
* These methods can be chained together. For example, |
|
|
|
* used to perform/execute the DB query against a database. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* For example, |
|
|
|
* |
|
|
|
* |
|
|
|
* ~~~ |
|
|
|
* ~~~ |
|
|
|
* $query = new Query; |
|
|
|
* $query = new Query; |
|
|
@ -24,12 +26,11 @@ namespace yii\db; |
|
|
|
* ->from('tbl_user') |
|
|
|
* ->from('tbl_user') |
|
|
|
* ->limit(10); |
|
|
|
* ->limit(10); |
|
|
|
* // build and execute the query |
|
|
|
* // build and execute the query |
|
|
|
* $users = $query->createCommand()->queryAll(); |
|
|
|
* $command = $query->createCommand(); |
|
|
|
|
|
|
|
* // $command->sql returns the actual SQL |
|
|
|
|
|
|
|
* $rows = $command->queryAll(); |
|
|
|
* ~~~ |
|
|
|
* ~~~ |
|
|
|
* |
|
|
|
* |
|
|
|
* By calling [[createCommand()]], we can get a [[Command]] instance which can be further |
|
|
|
|
|
|
|
* used to perform/execute the DB query against a database. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @author Qiang Xue <qiang.xue@gmail.com> |
|
|
|
* @author Qiang Xue <qiang.xue@gmail.com> |
|
|
|
* @since 2.0 |
|
|
|
* @since 2.0 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|