Documentation

DataReader
in package
implements IDataReader

FinalYes

Class responsible for working with query results.

Table of Contents

Interfaces

IDataReader
Interface for reading data from a data source.

Properties

$affected  : int
$count  : int
$hasRows  : bool
$_affected  : int
Total number of results.
$_count  : int
Number of results in the current query page.
$_preparedQuery  : string|null
Query string after processing.
$_results  : mixed
Query result resource.

Methods

__construct()  : mixed
Creates a new object.
__destruct()  : mixed
Destructor to close the resource.
__get()  : mixed
Magic getter method to retrieve properties.
__set()  : void
Magic setter method.
Close()  : void
Closes the query result resource.
Count()  : int
Returns the number of rows in the result set.
Fields()  : array<string|int, mixed>
Retrieves the list of fields in the query result.
Read()  : object|null
Reads the next row from the query result.
_flags2txt()  : array<string|int, mixed>
Converts the MySQL field flags to a readable string.
_type2txt()  : string|null
Converts the MySQL field type ID to a readable string.

Properties

$affected

public int $affected

Number of affected rows.

$count read-only

public int $count

Number of rows in the result set.

$hasRows read-only

public bool $hasRows

Indicates whether the result set has any rows.

$_affected

Total number of results.

private int $_affected = null

Filled only when the query is executed with the info parameter set to true in ExecuteReader.

$_count

Number of results in the current query page.

private int $_count = null

$_preparedQuery

Query string after processing.

private string|null $_preparedQuery = null

$_results

Query result resource.

private mixed $_results = null

Methods

__construct()

Creates a new object.

public __construct(mixed $results[, int|null $affected = null ][, string|null $preparedQuery = null ]) : mixed
Parameters
$results : mixed

Query results.

$affected : int|null = null

Number of affected rows.

$preparedQuery : string|null = null

Processed query string.

__destruct()

Destructor to close the resource.

public __destruct() : mixed

__get()

Magic getter method to retrieve properties.

public __get(string $property) : mixed
Parameters
$property : string

The property name.

Return values
mixed

The value of the property.

__set()

Magic setter method.

public __set(string $property, mixed $value) : void
Parameters
$property : string

The property name.

$value : mixed

The value to set.

Close()

Closes the query result resource.

public Close() : void

Count()

Returns the number of rows in the result set.

public Count() : int
Return values
int

The number of rows in the result set.

Fields()

Retrieves the list of fields in the query result.

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

The list of fields in the query result.

Read()

Reads the next row from the query result.

public Read() : object|null
Return values
object|null

The next row as an object, or null if no more rows are available.

_flags2txt()

Converts the MySQL field flags to a readable string.

private _flags2txt(int $flags_num) : array<string|int, mixed>
Parameters
$flags_num : int

The MySQL field flags.

Return values
array<string|int, mixed>

An array containing the readable field flags.

_type2txt()

Converts the MySQL field type ID to a readable string.

private _type2txt(string $type_id) : string|null
Parameters
$type_id : string

The MySQL field type ID.

Return values
string|null

The readable string representing the field type.


        
On this page

Search results