\JSONDB\QueryResult
Class QueryResult
Summary
Constants |
No constants |
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
current()
current() : array|object|\JSONDB\QueryResultObject
Returns the current result.
Overwrites
\Iterator
Throws
Returns
array|object|\JSONDB\QueryResultObject
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
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
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
Returns
array
offsetSet()
offsetSet(integer $offset, array $value)
Changes the result value at the given offset.
Overwrites
\ArrayAccess
Parameters
integer | $offset |
|
array | $value |
Throws
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
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
_setResults()
_setResults(array $results)
Changes the value of $results
.
Parameters
array | $results |
_parseResults()
_parseResults()
Adds information in $results
.