CodeIgniter v4.5 API

ResultInterface

Tags
template

TConnection

template

TResult

Table of Contents

Methods

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()  : mixed
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
Returns number of rows in the result set.
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<string|int, mixed>
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.

Methods

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 dataSeek([int $n = 0 ]) : bool
Parameters
$n : int = 0
Return values
bool

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.

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 getFieldCount() : int
Return values
int

getFieldData()

Generates an array of objects representing field meta-data.

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

getFieldNames()

Generates an array of column names in the result set.

public 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()

Returns number of rows in the result set.

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<string|int, mixed>

If no results, an empty array is returned.

Return values
array<string|int, mixed>

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

        
On this page

Search results