CMS Made Simple API

Resultset
in package

AbstractYes

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

Tags
author

Robert Campbell

copyright

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

since
2.2

Table of Contents

Properties

$EOF  : bool
$fields  : array<string|int, mixed>

Methods

Close()  : mixed
Close the current resultset.
EOF()  : bool
Test if we are at the end of a resultset, and there are no further matches.
FetchRow()  : array<string|int, mixed>
Fetch the current row, and move to the next row.
Fields()  : mixed|array<string|int, mixed>
Return the fields of the current resultset, or a single field of it.
GetAll()  : array<string|int, mixed>
An alias for the GetArray method.
GetArray()  : array<string|int, mixed>
Get all remaining results in this resultset as an array of records.
GetAssoc()  : array<string|int, mixed>
Get an associative array from a resultset.
GetRows()  : array<string|int, mixed>
An alias for the GetArray method.
MoveFirst()  : mixed
Move to the first row in a resultset.
MoveNext()  : mixed
Move to the next row of a resultset.
NumRows()  : int
Alias for the RecordCount() method.
RecordCount()  : int
Return the number of rows in the current resultset.
Move()  : mixed
Move to a specified index of the resultset.

Properties

$EOF read-only

public bool $EOF

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

$fields read-only

public array<string|int, mixed> $fields

Return the current row of the resultset.

Methods

Close()

Close the current resultset.

public abstract Close() : mixed

EOF()

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

public abstract EOF() : bool
Return values
bool

FetchRow()

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

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

Fields()

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

public abstract Fields([string $field = null ]) : mixed|array<string|int, mixed>
Parameters
$field : string = null

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

Return values
mixed|array<string|int, mixed>

Either a single value, or an array

GetAll()

An alias for the GetArray method.

public GetAll() : array<string|int, mixed>
Tags
see
GetArray()
Return values
array<string|int, mixed>

GetArray()

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

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

GetAssoc()

Get an associative array from a resultset.

public GetAssoc([bool $force_array = false ][, bool $first2cols = false ]) : array<string|int, mixed>

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.

Parameters
$force_array : bool = false

Force array behavior, even if there are only two columns in the resulting SQL.

$first2cols : bool = false

The opposite of force_array. Only output the data from the first 2 columns as an associative array.

Return values
array<string|int, mixed>

GetRows()

An alias for the GetArray method.

public GetRows() : array<string|int, mixed>
Tags
see
GetArray()
Return values
array<string|int, mixed>

MoveFirst()

Move to the first row in a resultset.

public abstract MoveFirst() : mixed

MoveNext()

Move to the next row of a resultset.

public abstract MoveNext() : mixed

NumRows()

Alias for the RecordCount() method.

public NumRows() : int
Tags
see

RecordCount();

Return values
int

RecordCount()

Return the number of rows in the current resultset.

public abstract RecordCount() : int
Return values
int

Move()

Move to a specified index of the resultset.

protected abstract Move(int $idx) : mixed
Parameters
$idx : int

        
On this page

Search results