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()); }
파일 보기 프로젝트 열기: contao/core-bundle 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$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