PHP 클래스 lithium\data\source\Result

Just a forward-only cursor is required, not necessarily a rolling cursor. Not all data sources can support rolling cursors, that's why forward-only cursors have been chosen here as the least common denominator for the abstraction. Rolling cursors cannot be emulated from an underlying forward-only cursor in a (memory) efficient way. Result does not try to and will deliberately not keep already yielded results in an internal cache. To allow full (back and forth) iteration over the yielded results, a wrapping class (i.e. Collection) may keep such a cache while draining the Result from outside. Because of these characteristics an instance of Result may be used only once. After draining the result it cannot be rewinded or reset. This is similar to the behavior of the NoRewindIterator, where rewind calls have no effect. The first result will be eager loaded from the cursor, as it is expected the result will be used at least once. The class also provides a mechanism which buffers results when peeking for next ones. The buffered results will then be used when continuing to iterate over the result object.
상속: extends lithium\core\Object, implements Iterator
파일 보기 프로젝트 열기: unionofrad/lithium 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$_autoConfig array Autoconfig.
$_buffer array Buffer results of query before returning / iterating. Allows consumers to 'peek' at results.
$_current mixed Contains the current element of the result set.
$_iterator integer The current position of the iterator.
$_key integer | null Key of the current result.
$_resource object | resource | null The bound resource.
$_valid boolean Indicates whether the current position is valid or not.

공개 메소드들

메소드 설명
__destruct ( ) : void Destructor.
close ( ) : void Close the resource.
current ( ) : array Contains the current result.
key ( ) : integer | null Returns the current key position on the result.
next ( ) : mixed Fetches the next element from the resource.
peek ( ) : mixed Peeks at the next element in the resource without advancing Result's cursor.
resource ( ) : object | resource Returns the used resource.
rewind ( ) : void Noop to fulfill the Iterator interface. Result is forward-only.
valid ( ) : boolean Checks if current position is valid.

보호된 메소드들

메소드 설명
_fetch ( ) : array | boolean | null Fetches the next result from the resource.
_init ( ) : void Initializer. Eager loads the first result.

메소드 상세

__destruct() 공개 메소드

Destructor.
public __destruct ( ) : void
리턴 void

_fetch() 추상적인 보호된 메소드

Fetches the next result from the resource.
abstract protected _fetch ( ) : array | boolean | null
리턴 array | boolean | null Returns a key/value pair for the next result, `null` if there is none, `false` if something bad happened.

_init() 보호된 메소드

Initializer. Eager loads the first result.
protected _init ( ) : void
리턴 void

close() 공개 메소드

Close the resource.
public close ( ) : void
리턴 void

current() 공개 메소드

Contains the current result.
public current ( ) : array
리턴 array The current result (or `null` if there is none).

key() 공개 메소드

Returns the current key position on the result.
public key ( ) : integer | null
리턴 integer | null The current key position or `null` if there is none.

next() 공개 메소드

Fetches the next element from the resource.
public next ( ) : mixed
리턴 mixed The next result (or `null` if there is none).

peek() 공개 메소드

Peeks at the next element in the resource without advancing Result's cursor.
public peek ( ) : mixed
리턴 mixed The next result (or `null` if there is none).

resource() 공개 메소드

Returns the used resource.
public resource ( ) : object | resource
리턴 object | resource

rewind() 공개 메소드

Noop to fulfill the Iterator interface. Result is forward-only.
public rewind ( ) : void
리턴 void

valid() 공개 메소드

Checks if current position is valid.
public valid ( ) : boolean
리턴 boolean `true` if valid, `false` otherwise.

프로퍼티 상세

$_autoConfig 보호되어 있는 프로퍼티

Autoconfig.
protected array $_autoConfig
리턴 array

$_buffer 보호되어 있는 프로퍼티

Buffer results of query before returning / iterating. Allows consumers to 'peek' at results.
protected array $_buffer
리턴 array

$_current 보호되어 있는 프로퍼티

Contains the current element of the result set.
protected mixed $_current
리턴 mixed

$_iterator 보호되어 있는 프로퍼티

The current position of the iterator.
protected int $_iterator
리턴 integer

$_key 보호되어 있는 프로퍼티

Key of the current result.
protected int|null $_key
리턴 integer | null

$_resource 보호되어 있는 프로퍼티

The bound resource.
protected object|resource|null $_resource
리턴 object | resource | null

$_valid 보호되어 있는 프로퍼티

Indicates whether the current position is valid or not.
또한 보기: lithium\data\source\Result::valid()
protected bool $_valid
리턴 boolean