class Result implements IDataSource

Query result.

Properties

int read-only $rowCount

Methods

__construct($driver)

No description

getResource() deprecated

No description

void
free()

Frees the resources allocated for this result set.

getResultDriver()

Safe access to property $driver.

bool
seek($row)

Moves cursor position without fetching row.

int
count()

Required by the Countable interface.

int
getRowCount()

Returns the number of rows in a result set.

getIterator()

Required by the IteratorAggregate interface.

int
getColumnCount()

Returns the number of columns in a result set.

setRowClass($class)

Set fetched object class. This class should extend the Row class.

string
getRowClass()

Returns fetched object class name.

setRowFactory(callable $callback)

Set a factory to create fetched object instances. These should extend the Row class.

Row|false
fetch()

Fetches the row at current position, process optional type conversion.

mixed
fetchSingle()

Like fetch(), but returns only first field.

Row[]|array[]
fetchAll($offset = null, $limit = null)

Fetches all records from table.

array
fetchAssoc($assoc)

Fetches all records from table and returns associative tree.

array
fetchPairs($key = null, $value = null)

Fetches all records from table like $key => $value pairs.

setType($col, $type)

Define column type.

string
getType($col)

Returns column type.

setFormat($type, $format)

Sets date format.

string|null
getFormat($type)

Returns data format.

getInfo()

Returns a meta information about the current result set.

Column[]
getColumns()

No description

void
dump()

Displays complete result set as HTML or text table for debug purposes.

Details

at line 45
__construct($driver)

No description

Parameters

$driver

at line 55
final getResource() deprecated

deprecated

No description

at line 66
final void free()

Frees the resources allocated for this result set.

Return Value

void

at line 80
final ResultDriver getResultDriver()

Safe access to property $driver.

Return Value

ResultDriver

Exceptions

RuntimeException

at line 99
final bool seek($row)

Moves cursor position without fetching row.

Parameters

$row

Return Value

bool

true on success, false if unable to seek to specified record

Exceptions

Exception

at line 111
final int count()

Required by the Countable interface.

Return Value

int

at line 121
final int getRowCount()

Returns the number of rows in a result set.

Return Value

int

at line 131
final ResultIterator getIterator()

Required by the IteratorAggregate interface.

Return Value

ResultIterator

at line 141
final int getColumnCount()

Returns the number of columns in a result set.

Return Value

int

at line 155
Result setRowClass($class)

Set fetched object class. This class should extend the Row class.

Parameters

$class

Return Value

Result

at line 166
string getRowClass()

Returns fetched object class name.

Return Value

string

at line 176
Result setRowFactory(callable $callback)

Set a factory to create fetched object instances. These should extend the Row class.

Parameters

callable $callback

Return Value

Result

at line 188
final Row|false fetch()

Fetches the row at current position, process optional type conversion.

and moves the internal cursor to the next position

Return Value

Row|false

at line 209
final mixed fetchSingle()

Like fetch(), but returns only first field.

Return Value

mixed

value on success, false if no next record

at line 227
final Row[]|array[] fetchAll($offset = null, $limit = null)

Fetches all records from table.

Parameters

$offset
$limit

Return Value

Row[]|array[]

at line 260
final array fetchAssoc($assoc)

Fetches all records from table and returns associative tree.

Examples:

  • associative descriptor: col1[]col2->col3 builds a tree: $tree[$val1][$index][$val2]->col3[$val3] = {record}
  • associative descriptor: col1|col2->col3=col4 builds a tree: $tree[$val1][$val2]->col3[$val3] = val4

Parameters

$assoc

Return Value

array

Exceptions

InvalidArgumentException

at line 407
final array fetchPairs($key = null, $value = null)

Fetches all records from table like $key => $value pairs.

Parameters

$key
$value

Return Value

array

Exceptions

InvalidArgumentException

at line 546
final Result setType($col, $type)

Define column type.

Parameters

$col
$type

Return Value

Result

at line 557
final string getType($col)

Returns column type.

Parameters

$col

Return Value

string

at line 569
final Result setFormat($type, $format)

Sets date format.

Parameters

$type
$format

Return Value

Result

at line 580
final string|null getFormat($type)

Returns data format.

Parameters

$type

Return Value

string|null

at line 593
Result getInfo()

Returns a meta information about the current result set.

Return Value

Result

at line 605
final Column[] getColumns()

No description

Return Value

Column[]

at line 618
final void dump()

Displays complete result set as HTML or text table for debug purposes.

Return Value

void

Traits

Better OOP experience.