Resultset View code

A class defining a resultset and how to interact with results from a database query.

package

CMS

author

Robert Campbell

copyright

Copyright (c) 2015, Robert Campbell calguy1000@cmsmadesimple.org

since 2.2
property-read

Test if we are at the end of the current resultset.

property-read

Return the current row of the resultset.

Methods

MoveFirst() 

Move to the first row in a resultset.

abstract
MoveNext() 

Move to the next row of a resultset.

abstract
Move(integer $idx) 

Move to a specified index of the resultset.

abstract

Arguments

integer $idx

GetArray() : array

Get all remaining results in this resultset as an array of records.

Response

array

GetRows() : array

An alias for the GetArray method.

deprecated

Response

array

GetAll() : array

An alias for the GetArray method.

deprecated

Response

array

GetAssoc( $force_array = false,  $first2cols = false) : array

Get an associative array from a resultset.

deprecated

If only two columns are returned in the resultset, the keys of the returned associative array will be the value of the first column, and the value of each key will be the value from the second column.

If more than 2 columns are returned, then the key of the returned associative array will be the value from the first column, and the value of each key will be an associative array of the remaining columns. This is known as array behavior.

Arguments

$force_array

$first2cols

Response

array

EOF() : boolean

Test if we are at the end of a resultset, and there are no further matches.

abstract

Response

boolean

Close() 

Close the current resultset.

abstract
RecordCount() : integer

Return the number of rows in the current resultset.

abstract

Response

integer

NumRows() : integer

Alias for the RecordCount() method.

Response

integer

Fields(string $field = null) : mixed|array

Return the fields of the current resultset, or a single field of it.

abstract

Arguments

string $field

An optional field name, if not specified, the entire row will be returned.

Response

mixed|array

Either a single value, or an array

FetchRow() : array

Fetch the current row, and move to the next row.

Response

array

Properties

EOF

EOF : boolean

Test if we are at the end of the current resultset.

Type(s)

boolean

fields

fields : array

Return the current row of the resultset.

Type(s)

array