class AbstractReader implements IteratorAggregate (View source)

Class DatabaseReader

Methods

$this
setQuery(Query $query)

setQuery

getIterator()

getIterator

mixed
loadResult()

Method to get the first field of the first row of the result set from the database query.

mixed
loadColumn(integer $offset)

Method to get an array of values from the $offset field in each row of the result set from the database query.

mixed
loadArray()

Method to get the first row of the result set from the database query as an array. Columns are indexed numerically so the first column in the result set would be accessible via $row[0], etc.

mixed
loadArrayList(string $key = null)

Method to get an array of the result set rows from the database query where each row is an array. The array of objects can optionally be keyed by a field offset, but defaults to a sequential numeric array.

mixed
loadAssoc()

Method to get the first row of the result set from the database query as an associative array of ['field' => 'value'].

mixed
loadAssocList(string $key = null)

Method to get an array of the result set rows from the database query where each row is an associative array of ['fieldname' => 'rowvalue']. The array of rows can optionally be keyed by a field name, but defaults to a sequential numeric array.

mixed
loadObject(string $class = 'stdClass')

Method to get the first row of the result set from the database query as an object.

mixed
loadObjectList(string $key = null, string $class = 'stdClass')

Method to get an array of the result set rows from the database query where each row is an object. The array of objects can optionally be keyed by a field name, but defaults to a sequential numeric array.

mixed
count(resource $cursor = null)

count

mixed
fetchArray()

Method to fetch a row from the result set cursor as an array.

mixed
fetchAssoc()

Method to fetch a row from the result set cursor as an associative array.

mixed
fetchObject(string $class = '\\stdClass')

Method to fetch a row from the result set cursor as an object.

int
countAffected(resource $cursor = null)

Get the number of affected rows for the previous executed SQL statement.

string
insertId()

Method to get the auto-incremented value from the last INSERT statement.

$this
freeResult()

freeResult

getDriver()

Method to get property Db

setDriver(AbstractDatabaseDriver $db)

Method to set property db

resource
getCursor()

Method to get property Cursor

setCursor(resource $cursor)

Method to set property cursor

Details

at line line 41
__construct(AbstractDatabaseDriver $db)

Constructor.

Parameters

AbstractDatabaseDriver $db

at line line 53
$this setQuery(Query $query)

setQuery

Parameters

Query $query

Return Value

$this

at line line 65
AbstractReader execute()

execute

Return Value

AbstractReader

at line line 84
DataIterator getIterator()

getIterator

Return Value

DataIterator

at line line 99
mixed loadResult()

Method to get the first field of the first row of the result set from the database query.

Return Value

mixed The return value or null if the query failed.

Exceptions

RuntimeException

at line line 126
mixed loadColumn(integer $offset)

Method to get an array of values from the $offset field in each row of the result set from the database query.

Parameters

integer $offset The row offset to use to build the result array.

Return Value

mixed The return value or null if the query failed.

Exceptions

RuntimeException

at line line 151
mixed loadArray()

Method to get the first row of the result set from the database query as an array. Columns are indexed numerically so the first column in the result set would be accessible via $row[0], etc.

Return Value

mixed The return value or null if the query failed.

Exceptions

RuntimeException

at line line 176
mixed loadArrayList(string $key = null)

Method to get an array of the result set rows from the database query where each row is an array. The array of objects can optionally be keyed by a field offset, but defaults to a sequential numeric array.

NOTE: Choosing to key the result array by a non-unique field can result in unwanted behavior and should be avoided.

Parameters

string $key The name of a field on which to key the result array.

Return Value

mixed The return value or null if the query failed.

Exceptions

RuntimeException

at line line 208
mixed loadAssoc()

Method to get the first row of the result set from the database query as an associative array of ['field' => 'value'].

Return Value

mixed The return value or null if the query failed.

Exceptions

RuntimeException

at line line 231
mixed loadAssocList(string $key = null)

Method to get an array of the result set rows from the database query where each row is an associative array of ['fieldname' => 'rowvalue']. The array of rows can optionally be keyed by a field name, but defaults to a sequential numeric array.

Parameters

string $key The name of a field on which to key the result array.

Return Value

mixed The return value or null if the query failed.

Exceptions

RuntimeException

at line line 264
mixed loadObject(string $class = 'stdClass')

Method to get the first row of the result set from the database query as an object.

Parameters

string $class The class name to use for the returned row object.

Return Value

mixed The return value or null if the query failed.

Exceptions

RuntimeException

at line line 292
mixed loadObjectList(string $key = null, string $class = 'stdClass')

Method to get an array of the result set rows from the database query where each row is an object. The array of objects can optionally be keyed by a field name, but defaults to a sequential numeric array.

NOTE: Choosing to key the result array by a non-unique field name can result in unwanted behavior and should be avoided.

Parameters

string $key The name of a field on which to key the result array.
string $class The class name to use for the returned row objects.

Return Value

mixed The return value or null if the query failed.

Exceptions

RuntimeException

at line line 324
abstract mixed count(resource $cursor = null)

count

Parameters

resource $cursor

Return Value

mixed

at line line 333
abstract mixed fetchArray()

Method to fetch a row from the result set cursor as an array.

Return Value

mixed Either the next row from the result set or false if there are no more rows.

at line line 342
abstract mixed fetchAssoc()

Method to fetch a row from the result set cursor as an associative array.

Return Value

mixed Either the next row from the result set or false if there are no more rows.

at line line 353
abstract mixed fetchObject(string $class = '\\stdClass')

Method to fetch a row from the result set cursor as an object.

Parameters

string $class Unused, only necessary so method signature will be the same as parent.

Return Value

mixed Either the next row from the result set or false if there are no more rows.

at line line 365
abstract int countAffected(resource $cursor = null)

Get the number of affected rows for the previous executed SQL statement.

Only applicable for DELETE, INSERT, or UPDATE statements.

Parameters

resource $cursor

Return Value

int The number of affected rows.

at line line 374
abstract string insertId()

Method to get the auto-incremented value from the last INSERT statement.

Return Value

string The value of the auto-increment field from the last inserted row.

at line line 381
$this freeResult()

freeResult

Return Value

$this

at line line 393
AbstractDatabaseDriver getDriver()

Method to get property Db

Return Value

AbstractDatabaseDriver

at line line 405
AbstractReader setDriver(AbstractDatabaseDriver $db)

Method to set property db

Parameters

AbstractDatabaseDriver $db

Return Value

AbstractReader Return self to support chaining.

at line line 417
resource getCursor()

Method to get property Cursor

Return Value

resource

at line line 429
AbstractReader setCursor(resource $cursor)

Method to set property cursor

Parameters

resource $cursor

Return Value

AbstractReader Return self to support chaining.