\CGExtensions\querysql_resultset

A class to allow iterating and fetching the results from an SQL query.

Summary

Methods
Properties
Constants
__construct()
get_query()
RecordCount()
MoveNext()
MoveFirst()
MoveLast()
current()
next()
rewind()
key()
valid()
EOF()
Close()
TotalMatches()
get_pagination()
FetchAll()
Rewind()
get_object()
No public properties found
No constants found
wildcard()
_query()
$_rs
$_filter
$_totalmatching
N/A
No private methods found
No private properties found
N/A

Properties

$_rs

$_rs : 

A member to store the database recordset.

Type

$_filter

$_filter : 

The current filter object.

Type

$_totalmatching

$_totalmatching : 

The total number of records matching the query (independent of limit and offset)

Type

Methods

__construct()

__construct(\CGExtensions\query\sql_query  $query) 

Constructor

Parameters

\CGExtensions\query\sql_query $query

The input query object

RecordCount()

RecordCount() : integer

Get the number of records returned in this recordset.

Returns

integer

MoveNext()

MoveNext() 

Move the pointer to the next matching row in the recordset.

MoveFirst()

MoveFirst() 

Move the pointer to the first matching row in the recordset.

MoveLast()

MoveLast() 

Move the pointer to the last matching row in the recordset.

current()

current() : mixed

Get the current object.

Returns

mixed

next()

next() : void

Move the pointer to the next object

rewind()

rewind() : void

Rewind the pointer to the first object.

key()

key() : integer

Get the key (position) of the current object within the resultset.

Returns

integer

valid()

valid() : boolean

Test if the current pointer points to a valid object.

Returns

boolean

EOF()

EOF() : boolean

Test if the pointer is at the end of the recordset (there are no more records)

Returns

boolean

Close()

Close() 

Close the recordset, and free resources.

TotalMatches()

TotalMatches() : integer

return the total number of matches (independent of limit and offset)

Returns

integer

get_pagination()

get_pagination() : \CGExtensions\query\pagination

Get a pagination object for this query and resultset

Returns

\CGExtensions\query\pagination

FetchAll()

FetchAll() : array<mixed,object>

Fetch all of the records in this resultset as an array of objects.

Returns

array<mixed,object>

Rewind()

Rewind() 

Move the pointer to the first matching row in the recordset.

get_object()

get_object() 

Get the object associated with the resultset.

In this class, the method returns an associative array representing a single row.

wildcard()

wildcard(string  $str) 

A convenience method used to aide in converting a string that may (or may not) contain wildcard (*) characters into a string suitable for use in a substring match

Parameters

string $str

The string to parse for wildcards.

_query()

_query() 

Use the data from the query object, perform the database query and set the recordset member.

This method should first see if the recordset has been set and not repeat the query... for the same of optimal behavior.