Documentation

Command extends Command
in package

Command represents a SQL statement to be executed against a database.

A command object is usually created by calling [[Connection::createCommand()]]. The SQL statement it represents can be set via the [[sql]] property.

To execute a non-query SQL (such as INSERT, DELETE, UPDATE), call [[execute()]]. To execute a SQL statement that returns a result data set (such as SELECT), use [[queryAll()]], [[queryOne()]], [[queryColumn()]], [[queryScalar()]], or [[query()]].

Table of Contents

query()  : DataReader
Executes the SQL statement and returns query result.
queryAllByGroup()  : array<string|int, mixed>
Executes the SQL statement and returns ALL rows at once.

Methods

query()

Executes the SQL statement and returns query result.

public query() : DataReader

This method is for executing a SQL query that returns result set, such as SELECT.

Tags
throws
Exception

execution failed

Return values
DataReader

the reader object for fetching the query result

queryAllByGroup()

Executes the SQL statement and returns ALL rows at once.

public queryAllByGroup(int $type) : array<string|int, mixed>
Parameters
$type : int
  • fetchMode 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
Tags
throws
Exception

execution failed

Return values
array<string|int, mixed>

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


        

Search results