Documentation

Result extends Result
in package

This class represents the result set of a SELECT query from the PDO drivers.

Tags
author

Jan Schneider jan@horde.org

category

Horde

copyright

2013-2021 Horde LLC

license

http://www.horde.org/licenses/bsd

subpackage

Adapter

Table of Contents

$adapter  : Adapter
$arg1  : mixed
$arg2  : string
$current  : array<string|int, mixed>
Current row.
$eof  : bool
Are we at the end of the result?
$fetchMode  : mixed
Which kind of keys to use for results.
$index  : int
Current offset.
$map  : array<string|int, mixed>
Maps Horde_Db fetch mode constant to the extension constants.
$result  : mixed
Result resource.
$sql  : string
__construct()  : mixed
Constructor.
__destruct()  : mixed
Destructor.
columnCount()  : int
Returns the number of columns in the result set.
current()  : array<string|int, mixed>
Implementation of the current() method for Iterator.
fetch()  : mixed
Returns the current row and advances the recordset one row.
key()  : mixed
Implementation of the key() method for Iterator.
next()  : array<string|int, mixed>|null
Implementation of the next() method for Iterator.
rewind()  : mixed
Implementation of the rewind() method for iterator.
setFetchMode()  : mixed
Sets the default fetch mode for this result.
valid()  : bool
Implementation of the valid() method for Iterator.
_columnCount()  : int
Returns the number of columns in the result set.
fetchArray()  : array<string|int, mixed>|bool
Returns a row from a resultset.

Properties

$current

Current row.

protected array<string|int, mixed> $current

$eof

Are we at the end of the result?

protected bool $eof

$fetchMode

Which kind of keys to use for results.

protected mixed $fetchMode = \Horde\Db\Constants::FETCH_ASSOC

$index

Current offset.

protected int $index

$map

Maps Horde_Db fetch mode constant to the extension constants.

protected array<string|int, mixed> $map = array(\Horde\Db\Constants::FETCH_ASSOC => \PDO::FETCH_ASSOC, \Horde\Db\Constants::FETCH_NUM => \PDO::FETCH_NUM, \Horde\Db\Constants::FETCH_BOTH => \PDO::FETCH_BOTH)

$result

Result resource.

protected mixed $result

Methods

__construct()

Constructor.

public __construct(Adapter $adapter, string $sql[, mixed $arg1 = null ][, string $arg2 = null ]) : mixed
Parameters
$adapter : Adapter

A driver instance.

$sql : string

A SQL query.

$arg1 : mixed = null

Either an array of bound parameters or a query name.

$arg2 : string = null

If $arg1 contains bound parameters, the query name.

Return values
mixed

__destruct()

Destructor.

public __destruct() : mixed
Return values
mixed

columnCount()

Returns the number of columns in the result set.

public columnCount() : int
Return values
int

Number of columns.

current()

Implementation of the current() method for Iterator.

public current() : array<string|int, mixed>
Return values
array<string|int, mixed>

The current row, or null if no rows.

fetch()

Returns the current row and advances the recordset one row.

public fetch([int $fetchmode = Constants::FETCH_ASSOC ]) : mixed
Parameters
$fetchmode : int = Constants::FETCH_ASSOC

The default fetch mode for this result. One of the Constants::FETCH_* constants.

Return values
mixed

key()

Implementation of the key() method for Iterator.

public key() : mixed
Return values
mixed

The current row number (starts at 0), or null if no rows.

next()

Implementation of the next() method for Iterator.

public next() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null

The next row in the resultset or null if there are no more results.

rewind()

Implementation of the rewind() method for iterator.

public rewind() : mixed
Return values
mixed

setFetchMode()

Sets the default fetch mode for this result.

public setFetchMode(int $fetchmode) : mixed
Parameters
$fetchmode : int

One of the Constants::FETCH_* constants.

Return values
mixed

valid()

Implementation of the valid() method for Iterator.

public valid() : bool
Return values
bool

Whether the iteration is valid.

_columnCount()

Returns the number of columns in the result set.

protected _columnCount() : int
Return values
int

Number of columns.

fetchArray()

Returns a row from a resultset.

protected fetchArray() : array<string|int, mixed>|bool
Return values
array<string|int, mixed>|bool

The next row in the resultset or false if there are no more results.

Search results