Browse Source

improved doc

tags/2.0.0-beta
Qiang Xue 11 years ago
parent
commit
24621c3dd1
  1. 3
      framework/yii/db/Query.php

3
framework/yii/db/Query.php

@ -23,10 +23,13 @@ use yii\base\Component;
* *
* ~~~ * ~~~
* $query = new Query; * $query = new Query;
* // compose the query
* $query->select('id, name') * $query->select('id, name')
* ->from('tbl_user') * ->from('tbl_user')
* ->limit(10); * ->limit(10);
* // build and execute the query * // build and execute the query
* $rows = $query->all();
* // alternatively, you can create DB command and execute it
* $command = $query->createCommand(); * $command = $query->createCommand();
* // $command->sql returns the actual SQL * // $command->sql returns the actual SQL
* $rows = $command->queryAll(); * $rows = $command->queryAll();

Loading…
Cancel
Save