PHP Класс Contao\Database\Result

The class functions as a wrapper for the database result set and lazy loads the result rows when they are first requested. Usage: while ($result->next()) { echo $result->name; print_r($result->row()); }
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$arrCache array Result cache
$resResult Doctrine\DBAL\Driver\Statement Database result
$resultSet array Result set
$strQuery string Query string

Открытые методы

Метод Описание
__construct ( Doctrine\DBAL\Driver\Statement $statement, string $strQuery ) Validate the connection resource and store the query string
__destruct ( ) Automatically free the result
__get ( string $strKey ) : mixed | null Return an object property or a field of the current row
__isset ( mixed $strKey ) : boolean Check whether a field exists
__set ( mixed $strKey, string $varValue ) Set a particular field of the current row
count ( ) : integer Return the number of rows in the result set
fetchAllAssoc ( ) : array Fetch all rows as associative array
fetchAssoc ( ) : array | false Fetch the current row as associative array
fetchEach ( string $strKey ) : array Fetch a particular field of each row of the result
fetchField ( integer $intOffset ) : array Get the column information and return it as array
fetchRow ( ) : array | false Fetch the current row as enumerated array
first ( ) : Result | boolean Go to the first row of the current result
last ( ) : Result | boolean Go to the last row of the current result
next ( ) : Result | boolean Go to the next row of the current result
prev ( ) : Result | boolean Go to the previous row of the current result
reset ( ) : Result Reset the current result
row ( boolean $blnEnumerated = false ) : array Return the current row as associative array

Описание методов

__construct() публичный Метод

Validate the connection resource and store the query string
public __construct ( Doctrine\DBAL\Driver\Statement $statement, string $strQuery )
$statement Doctrine\DBAL\Driver\Statement The database statement
$strQuery string The query string

__destruct() публичный Метод

Automatically free the result
public __destruct ( )

__get() публичный Метод

Return an object property or a field of the current row
public __get ( string $strKey ) : mixed | null
$strKey string The field name
Результат mixed | null The field value or null

__isset() публичный Метод

Check whether a field exists
public __isset ( mixed $strKey ) : boolean
$strKey mixed The field name
Результат boolean True if the field exists

__set() публичный Метод

Set a particular field of the current row
public __set ( mixed $strKey, string $varValue )
$strKey mixed The field name
$varValue string The field value

count() публичный Метод

Return the number of rows in the result set
public count ( ) : integer
Результат integer The number of rows

fetchAllAssoc() публичный Метод

Fetch all rows as associative array
public fetchAllAssoc ( ) : array
Результат array An array with all rows

fetchAssoc() публичный Метод

Fetch the current row as associative array
public fetchAssoc ( ) : array | false
Результат array | false The row as associative array or false if there is no row

fetchEach() публичный Метод

Fetch a particular field of each row of the result
public fetchEach ( string $strKey ) : array
$strKey string The field name
Результат array An array of field values

fetchField() публичный Метод

Get the column information and return it as array
public fetchField ( integer $intOffset ) : array
$intOffset integer The field offset
Результат array An array with the column information

fetchRow() публичный Метод

Fetch the current row as enumerated array
public fetchRow ( ) : array | false
Результат array | false The row as enumerated array or false if there is no row

first() публичный Метод

Go to the first row of the current result
public first ( ) : Result | boolean
Результат Result | boolean The result object or false if there is no first row

last() публичный Метод

Go to the last row of the current result
public last ( ) : Result | boolean
Результат Result | boolean The result object or false if there is no last row

next() публичный Метод

Go to the next row of the current result
public next ( ) : Result | boolean
Результат Result | boolean The result object or false if there is no next row

prev() публичный Метод

Go to the previous row of the current result
public prev ( ) : Result | boolean
Результат Result | boolean The result object or false if there is no previous row

reset() публичный Метод

Reset the current result
public reset ( ) : Result
Результат Result The result object

row() публичный Метод

Return the current row as associative array
public row ( boolean $blnEnumerated = false ) : array
$blnEnumerated boolean If true, an enumerated array will be returned
Результат array The row as array

Описание свойств

$arrCache защищенное свойство

Result cache
protected array $arrCache
Результат array

$resResult защищенное свойство

Database result
protected Statement,Doctrine\DBAL\Driver $resResult
Результат Doctrine\DBAL\Driver\Statement

$resultSet защищенное свойство

Result set
protected array $resultSet
Результат array

$strQuery защищенное свойство

Query string
protected string $strQuery
Результат string