\JSONDB\QueryResult

Class QueryResult

Summary

Implements

\Iterator, \SeekableIterator, \Countable, \Serializable, \ArrayAccess

Properties

$key

$key : integer
Description The current key (internal array cursor position)
Type integer

$results

$results : array
Description The array of results
Type array

$fetchMode

$fetchMode : integer
Description The fetch mode
Type integer

$className

$className : string
Description The class name used for the FETCH_CLASS mode
Type string

$database

$database : \JSONDB\Database
Description Class Database instance to use with results
Type \JSONDB\Database

Methods

__construct()

__construct(array  $result, \JSONDB\Database  $database)

QueryResult __constructor.

Parameters
array $result The query results to use
\JSONDB\Database $database The class Database instance to use

valid()

valid() : boolean

Checks if the current key can be accessed.

Overwrites

\Iterator

Returns

boolean

queryString()

queryString() : string

Returns the current query.

Returns

string

next()

next()

Seeks the internal array pointer to the next value.

Overwrites

\Iterator

key()

key() : integer

Returns the value of the current internal array pointer.

Overwrites

\Iterator

Returns

integer

rewind()

rewind()

Seeks the internal array pointer to 0.

Overwrites

\Iterator

seek()

seek(integer  $position)

Seeks the internal array pointer to the given position.

Overwrites

\SeekableIterator

Throws

\JSONDB\Exception

count()

count() : integer

Counts results.

Overwrites

\Countable

Returns

integer

serialize()

serialize() : string

Serializes results.

Overwrites

\Serializable

Returns

string

unserialize()

unserialize(string  $serialized) : \JSONDB\QueryResult

Unserializes a serialized value.

Overwrites

\Serializable

Parameters
string $serialized The serialized value
Returns

\JSONDB\QueryResult

offsetExists()

offsetExists(integer  $offset) : boolean

Checks if a result exist at the given offset.

Overwrites

\ArrayAccess

Parameters
integer $offset
Returns

boolean

offsetGet()

offsetGet(integer  $offset) : array

Returns the result at the given offset.

Overwrites

\ArrayAccess

Parameters
integer $offset
Throws

\JSONDB\Exception

Returns

array

offsetSet()

offsetSet(integer  $offset, array  $value)

Changes the result value at the given offset.

Overwrites

\ArrayAccess

Parameters
integer $offset
array $value
Throws

\JSONDB\Exception

offsetUnset()

offsetUnset(integer  $offset)

Unsets a result at the given offset.

Overwrites

\ArrayAccess

Parameters
integer $offset

fetch()

fetch(integer  $mode = NULL, string  $className = NULL) : array|boolean|\JSONDB\QueryResultObject

Fetch for results.

Parameters
integer $mode The fetch mode
string $className The class name (required when $mode is \JSONDB\JSONDB::FETCH_CLASS)
Throws

\JSONDB\Exception

Returns

array|boolean|\JSONDB\QueryResultObject

setFetchMode()

setFetchMode(integer  $mode = NULL, string  $className = NULL) : array|boolean|\JSONDB\QueryResultObject

Changes the fetch mode.

Parameters
integer $mode The fetch mode
string $className The class name (required when $mode is \JSONDB\JSONDB::FETCH_CLASS)
Returns

\JSONDB\QueryResult

_setResults()

_setResults(array  $results)

Changes the value of $results.

Parameters
array $results

_parseResults()

_parseResults()

Adds information in $results.