Wraps database result set functionality.

Gets results from PDO and turns them into arrays.
Works with statements and queries.
This also means that can use things like count() as PDO doesn't always automatically return a recordset count.
Also allows a different return modes.

package dstruct_common
todo Gives a count of 1 when returns just an empty array?!

 Methods

Class Constructor.

__construct(object $result, integer $mode) 

$mode is one of PDO::FETCH_xx constants, and defaults to returning an associative array.

Parameters

$result

object

PDO::Statement handle or PDO::Query result

$mode

integer

Array return mode. PDO::FETCH_xx constant.

Return count of records.

count() : integer

Returns

integer

Get current record.

current() : string
see \Iterator::current()

Returns

string

Returns the mode used to get the data.

getMode() : integer

Mode is PDO::FETCH_xx constant

Returns

integer

Get key of current record.

key() : string
see \Iterator::key()

Returns

string

Move to next record.

next() 

Alias of {@link count()}.

num_rows() : integer

Sort-of mimics mysqli

Returns

integer

Rewind.

rewind() 

Is there a record at the current position.

valid() 

 Properties

 

$mode : integer
 

$rs : array
 

$total : integer