Nextcloud PHP API (master)

IResult

This interface represents the result of a database query.

Usage:

$qb = $this->db->getQueryBuilder();
$qb->select(...);
$result = $query->executeQuery();

foreach ($result->iterateAssociative() as $row) {
    $id = $row['id'];
}
Tags
since
21.0.0
Attributes
#[Consumable]
$since: '21.0.0'

Table of Contents

Methods

closeCursor()  : true
fetch()  : PDO::FETCH_NUM ? list : mixed))|false
fetchAll()  : array<int, PDO::FETCH_NUM ? list : mixed))>
fetchAllAssociative()  : array<int, array<string, mixed>>
Returns an array containing all the result rows represented as associative arrays.
fetchAllNumeric()  : array<int, array<int, mixed>>
Returns an array containing all the result rows represented as numeric arrays.
fetchAssociative()  : array<string, mixed>|false
Returns the next row of the result as an associative array or FALSE if there are no more rows.
fetchColumn()  : mixed
fetchFirstColumn()  : array<int, mixed>
Returns the value of the first column of all rows.
fetchNumeric()  : array<int, mixed>|false
Returns the next row of the result as a numeric array or FALSE if there are no more rows.
fetchOne()  : false|mixed
Returns the first value of the next row of the result or FALSE if there are no more rows.
iterateAssociative()  : Traversable<string|int, array<string, mixed>>
Returns an iterator over rows represented as associative arrays.
iterateNumeric()  : Traversable<string|int, array<int, mixed>>
Returns an iterator over rows represented as numeric arrays.
rowCount()  : int

Methods

closeCursor()

public closeCursor() : true
Tags
since
21.0.0
Return values
true

fetch()

public fetch([PDO::FETCH_* $fetchMode = PDO::FETCH_ASSOC ]) : PDO::FETCH_NUM ? list : mixed))|false
Parameters
$fetchMode : PDO::FETCH_* = PDO::FETCH_ASSOC
Tags
since
21.0.0
note

Since 33.0.0, prefer using fetchAssociative/fetchNumeric/fetchOne or iterateAssociate/iterateNumeric instead.

Return values
PDO::FETCH_NUM ? list : mixed))|false

fetchAll()

public fetchAll([PDO::FETCH_* $fetchMode = PDO::FETCH_ASSOC ]) : array<int, PDO::FETCH_NUM ? list : mixed))>
Parameters
$fetchMode : PDO::FETCH_* = PDO::FETCH_ASSOC
Tags
since
21.0.0
note

Since 33.0.0, prefer using fetchAllAssociative/fetchAllNumeric/fetchFirstColumn or iterateAssociate/iterateNumeric instead.

Return values
array<int, PDO::FETCH_NUM ? list : mixed))>

fetchAllAssociative()

Returns an array containing all the result rows represented as associative arrays.

public fetchAllAssociative() : array<int, array<string, mixed>>
Tags
since
33.0.0
Return values
array<int, array<string, mixed>>

fetchAllNumeric()

Returns an array containing all the result rows represented as numeric arrays.

public fetchAllNumeric() : array<int, array<int, mixed>>
Tags
since
33.0.0
Return values
array<int, array<int, mixed>>

fetchAssociative()

Returns the next row of the result as an associative array or FALSE if there are no more rows.

public fetchAssociative() : array<string, mixed>|false
Tags
since
33.0.0
Return values
array<string, mixed>|false

fetchColumn()

public fetchColumn() : mixed

use \OCP\DB\IResult::fetchOne

Tags
since
21.0.0

fetchFirstColumn()

Returns the value of the first column of all rows.

public fetchFirstColumn() : array<int, mixed>
Tags
since
33.0.0
Return values
array<int, mixed>

fetchNumeric()

Returns the next row of the result as a numeric array or FALSE if there are no more rows.

public fetchNumeric() : array<int, mixed>|false
Tags
since
33.0.0
Return values
array<int, mixed>|false

fetchOne()

Returns the first value of the next row of the result or FALSE if there are no more rows.

public fetchOne() : false|mixed
Tags
since
21.0.0
Return values
false|mixed

iterateAssociative()

Returns an iterator over rows represented as associative arrays.

public iterateAssociative() : Traversable<string|int, array<string, mixed>>
Tags
since
33.0.0
Return values
Traversable<string|int, array<string, mixed>>

iterateNumeric()

Returns an iterator over rows represented as numeric arrays.

public iterateNumeric() : Traversable<string|int, array<int, mixed>>
Tags
since
33.0.0
Return values
Traversable<string|int, array<int, mixed>>

rowCount()

public rowCount() : int
Tags
since
21.0.0
Return values
int

        
On this page

Search results