db\Command queryColumn()

queryColumn() public method Executes the SQL statement and returns the first column of the result. This method is best used when only the first column of result (i.e. the first element in each row) is needed for a query. public array queryColumn ( )return array The first column of the query result. Empty array is returned if the query results in nothing. throws yii\db\Exception execution failed

db\Command queryAll()

queryAll() public method Executes the SQL statement and returns ALL rows at once. public array queryAll ( $fetchMode = null )$fetchMode integer The result fetch mode. Please refer to PHP manual for valid fetch modes. If this parameter is null, the value set in $fetchMode will be used. return array All rows of the query result. Each array element is an array representing a row of data. An empty array is returned if the query results in nothing. throws yii\db\Exception execution failed

db\Command query()

query() public method Executes the SQL statement and returns query result. This method is for executing a SQL query that returns result set, such as SELECT. public yii\db\DataReader query ( )return yii\db\DataReader The reader object for fetching the query result throws yii\db\Exception execution failed

db\Command prepare()

prepare() public method 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. public void prepare ( $forRead = null )$forRead boolean Whether this method is called for a read query. If null, it means the SQL statement should be used to determine whether it is for read or write. throws yii\db\Exception if there is any DB err

db\Command noCache()

noCache() public method Disables query cache for this command. public $this noCache ( )return $this The command object itself

db\Command insert()

insert() public method Creates an INSERT command. For example, $connection->createCommand()->insert('user', [ 'name' => 'Sam', 'age' => 30, ])->execute(); The method will properly escape the column names, and bind the values to be inserted. Note that the created command is not executed until execute() is called. public $this insert ( $table, $columns )$table string The table that new rows will be inserted into. $columns array The column data (name => value) t

db\Command getSql()

getSql() public method Returns the SQL statement for this command. public string getSql ( )return string The SQL statement to be executed

db\Command getRawSql()

getRawSql() public method Returns the raw SQL by inserting parameter values into the corresponding placeholders in $sql. Note that the return value of this method should mainly be used for logging purpose. It is likely that this method returns an invalid SQL due to improper replacement of parameter placeholders. public string getRawSql ( )return string The raw SQL with parameter values inserted into the corresponding placeholders in $sql.

db\Command execute()

execute() public method Executes the SQL statement. This method should only be used for executing non-query SQL statement, such as INSERT, DELETE, UPDATE SQLs. No result set will be returned. public integer execute ( )return integer Number of rows affected by the execution. throws yii\db\Exception execution failed

db\Command dropTable()

dropTable() public method Creates a SQL command for dropping a DB table. public $this dropTable ( $table )$table string The table to be dropped. The name will be properly quoted by the method. return $this The command object itself