CodeIgniter v4.5 API

BaseResult
in package
implements ResultInterface

AbstractYes
Tags
template

TConnection

template

TResult

implements

ResultInterface<TConnection, TResult>

Table of Contents

Interfaces

ResultInterface

Properties

$connID  : object|resource
Connection ID
$currentRow  : int
Current Row index
$customResultObject  : array<string|int, mixed>
Custom Result Object
$resultArray  : array<int, array<string|int, mixed>>
Result Array
$resultID  : false|object|resource
Result ID
$resultObject  : array<int, object>
Result Object
$rowData  : array<string|int, mixed>|null
Row data
$numRows  : int|null
The number of records in the query result

Methods

__construct()  : mixed
Constructor
dataSeek()  : bool
Moves the internal pointer to the desired offset. This is called internally before fetching results to make sure the result set starts at zero.
freeResult()  : void
Frees the current result.
getCustomResultObject()  : array<string|int, mixed>
Returns the results as an array of custom objects.
getCustomRowObject()  : object|null
Returns a row as a custom class instance.
getFieldCount()  : int
Gets the number of fields in the result set.
getFieldData()  : array<string|int, mixed>
Generates an array of objects representing field meta-data.
getFieldNames()  : array<string|int, mixed>
Generates an array of column names in the result set.
getFirstRow()  : array<string|int, mixed>|object|null
Returns the "first" row of the current results.
getLastRow()  : array<string|int, mixed>|object|null
Returns the "last" row of the current results.
getNextRow()  : array<string|int, mixed>|object|null
Returns the "next" row of the current results.
getNumRows()  : int
Number of rows in the result set; checks for previous count, falls back on counting resultArray or resultObject, finally fetching resultArray if nothing was previously fetched
getPreviousRow()  : array<string|int, mixed>|object|null
Returns the "previous" row of the current results.
getResult()  : array<string|int, mixed>
Retrieve the results of the query. Typically an array of individual data rows, which can be either an 'array', an 'object', or a custom class name.
getResultArray()  : array<string|int, mixed>
Returns the results as an array of arrays.
getResultObject()  : array<int, stdClass>
Returns the results as an array of objects.
getRow()  : array<string|int, mixed>|float|int|object|stdClass|string|null
Wrapper object to return a row as either an array, an object, or a custom class.
getRowArray()  : array<string|int, mixed>|null
Returns a single row from the results as an array.
getRowObject()  : object|stdClass|null
Returns a single row from the results as an object.
getUnbufferedRow()  : array<string|int, mixed>|object|null
Returns an unbuffered row and move the pointer to the next row.
setRow()  : void
Assigns an item into a particular column slot.
fetchAssoc()  : array<string|int, mixed>|false|null
Returns the result set as an array.
fetchObject()  : Entity|false|object|stdClass
Returns the result set as an object.
isValidResultId()  : bool

Properties

$connID

Connection ID

public object|resource $connID
Tags
phpstan-var

TConnection

$currentRow

Current Row index

public int $currentRow = 0

$customResultObject

Custom Result Object

public array<string|int, mixed> $customResultObject = []

$resultArray

Result Array

public array<int, array<string|int, mixed>> $resultArray = []

$resultID

Result ID

public false|object|resource $resultID
Tags
phpstan-var

false|TResult

$resultObject

Result Object

public array<int, object> $resultObject = []

$rowData

Row data

public array<string|int, mixed>|null $rowData

$numRows

The number of records in the query result

protected int|null $numRows

Methods

__construct()

Constructor

public __construct(object|resource &$connID, object|resource &$resultID) : mixed
Parameters
$connID : object|resource
$resultID : object|resource
Tags
phpstan-param

TConnection $connID

phpstan-param

TResult $resultID

dataSeek()

Moves the internal pointer to the desired offset. This is called internally before fetching results to make sure the result set starts at zero.

public abstract dataSeek([int $n = 0 ]) : bool
Parameters
$n : int = 0
Return values
bool

freeResult()

Frees the current result.

public abstract freeResult() : void

getCustomResultObject()

Returns the results as an array of custom objects.

public getCustomResultObject(string $className) : array<string|int, mixed>
Parameters
$className : string

The name of the class to use.

Tags
phpstan-param

class-string $className

Return values
array<string|int, mixed>

getCustomRowObject()

Returns a row as a custom class instance.

public getCustomRowObject(int $n, string $className) : object|null

If the row doesn't exist, returns null.

Parameters
$n : int

The index of the results to return.

$className : string
Tags
template

T of object

phpstan-param

class-string<T> $className

phpstan-return

T|null

Return values
object|null

getFieldCount()

Gets the number of fields in the result set.

public abstract getFieldCount() : int
Return values
int

getFieldData()

Generates an array of objects representing field meta-data.

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

getFieldNames()

Generates an array of column names in the result set.

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

getFirstRow()

Returns the "first" row of the current results.

public getFirstRow([string $type = 'object' ]) : array<string|int, mixed>|object|null
Parameters
$type : string = 'object'
Return values
array<string|int, mixed>|object|null

getLastRow()

Returns the "last" row of the current results.

public getLastRow([string $type = 'object' ]) : array<string|int, mixed>|object|null
Parameters
$type : string = 'object'
Return values
array<string|int, mixed>|object|null

getNextRow()

Returns the "next" row of the current results.

public getNextRow([string $type = 'object' ]) : array<string|int, mixed>|object|null
Parameters
$type : string = 'object'
Return values
array<string|int, mixed>|object|null

getNumRows()

Number of rows in the result set; checks for previous count, falls back on counting resultArray or resultObject, finally fetching resultArray if nothing was previously fetched

public getNumRows() : int
Return values
int

getPreviousRow()

Returns the "previous" row of the current results.

public getPreviousRow([string $type = 'object' ]) : array<string|int, mixed>|object|null
Parameters
$type : string = 'object'
Return values
array<string|int, mixed>|object|null

getResult()

Retrieve the results of the query. Typically an array of individual data rows, which can be either an 'array', an 'object', or a custom class name.

public getResult([string $type = 'object' ]) : array<string|int, mixed>
Parameters
$type : string = 'object'

The row type. Either 'array', 'object', or a class name to use

Return values
array<string|int, mixed>

getResultArray()

Returns the results as an array of arrays.

public getResultArray() : array<string|int, mixed>

If no results, an empty array is returned.

Return values
array<string|int, mixed>

getResultObject()

Returns the results as an array of objects.

public getResultObject() : array<int, stdClass>

If no results, an empty array is returned.

Tags
phpstan-return

list<stdClass>

Return values
array<int, stdClass>

getRow()

Wrapper object to return a row as either an array, an object, or a custom class.

public getRow([int|string $n = 0 ][, string $type = 'object' ]) : array<string|int, mixed>|float|int|object|stdClass|string|null

If the row doesn't exist, returns null.

Parameters
$n : int|string = 0

The index of the results to return, or column name.

$type : string = 'object'

The type of result object. 'array', 'object' or class name.

Tags
template

T of object

phpstan-param

class-string<T>|'array'|'object' $type

phpstan-return

($n is string ? float|int|string|null : ($type is 'object' ? stdClass|null : ($type is 'array' ? array|null : T|null)))

Return values
array<string|int, mixed>|float|int|object|stdClass|string|null

getRowArray()

Returns a single row from the results as an array.

public getRowArray([int $n = 0 ]) : array<string|int, mixed>|null

If row doesn't exist, returns null.

Parameters
$n : int = 0
Return values
array<string|int, mixed>|null

getRowObject()

Returns a single row from the results as an object.

public getRowObject([int $n = 0 ]) : object|stdClass|null

If row doesn't exist, returns null.

Parameters
$n : int = 0
Return values
object|stdClass|null

getUnbufferedRow()

Returns an unbuffered row and move the pointer to the next row.

public getUnbufferedRow([string $type = 'object' ]) : array<string|int, mixed>|object|null
Parameters
$type : string = 'object'
Return values
array<string|int, mixed>|object|null

setRow()

Assigns an item into a particular column slot.

public setRow(array<string|int, mixed>|string $key[, array<string|int, mixed>|object|stdClass|null $value = null ]) : void
Parameters
$key : array<string|int, mixed>|string
$value : array<string|int, mixed>|object|stdClass|null = null

fetchAssoc()

Returns the result set as an array.

protected abstract fetchAssoc() : array<string|int, mixed>|false|null

Overridden by driver classes.

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

fetchObject()

Returns the result set as an object.

protected abstract fetchObject([string $className = 'stdClass' ]) : Entity|false|object|stdClass

Overridden by child classes.

Parameters
$className : string = 'stdClass'
Return values
Entity|false|object|stdClass

isValidResultId()

private isValidResultId() : bool
Return values
bool

        
On this page

Search results