Result
in package
Result object given by a {@see Query} performed on a database.
The typical pattern for using this class is to receive an instance of it as a result of using the Database and Query class methods that return a result. This class should not be initialised independently.
Note that this is a stub class that a driver will extend and complete as required for individual database types. Individual drivers could add additional methods, but this is discouraged to ensure that the API is the same for all database types.
Table of Contents
Methods
- count() : int
- Count the number of rows in the result set.
- fetch() : array<string|int, mixed>
- Get the next row in a result set.
- fetchAll() : array<string|int, mixed>
- Get all rows in the result set.
- insertId() : int|string
- After an INSERT query, get the ID that was inserted.
Methods
count()
Count the number of rows in the result set.
public
abstract count() : int
Return values
intfetch()
Get the next row in a result set.
public
abstract fetch([int $fetchType = PDO::FETCH_ASSOC ]) : array<string|int, mixed>
Parameters
- $fetchType : int = PDO::FETCH_ASSOC
-
PDO row fetch style - PDO::FETCH_ASSOC is the default
Return values
array<string|int, mixed>fetchAll()
Get all rows in the result set.
public
abstract fetchAll([int $fetchType = PDO::FETCH_ASSOC ]) : array<string|int, mixed>
Parameters
- $fetchType : int = PDO::FETCH_ASSOC
-
PDO row fetch style - PDO::FETCH_ASSOC is the default
Return values
array<string|int, mixed>insertId()
After an INSERT query, get the ID that was inserted.
public
abstract insertId() : int|string