libasynql  3.2.0
Asynchronous MySQL access library for PocketMine plugins.
SqlSelectResult Class Reference
Inheritance diagram for SqlSelectResult:
SqlResult

Public Member Functions

 __construct (array $columnInfo, array $rows)
 
 getColumnInfo ()
 
 getRows ()
 

Detailed Description

Definition at line 27 of file SqlSelectResult.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( array  $columnInfo,
array  $rows 
)

SqlSelectResult constructor.

Parameters
SqlColumnInfo[]$columnInfo
array[]$rows

Definition at line 37 of file SqlSelectResult.php.

Member Function Documentation

◆ getColumnInfo()

getColumnInfo ( )

Returns the columns from the query

Returns
SqlColumnInfo[]

Definition at line 47 of file SqlSelectResult.php.

◆ getRows()

getRows ( )

Returns an array of rows. Each row is an array with keys as the (virtual) column name and values as the cell value. The type of cell values are juggled with the following special rules:

  • TINYINT(1) and BIT(1) in MySQL are expressed in bool
  • Signed long long, a.k.a. BIGINT [SIGNED], i.e. 64-bit unsigned integers, are expressed in int, because PocketMine only supports 64-bit machines.
  • Unsigned long long, a.k.a. BIGINT [SIGNED], i.e. 64-bit unsigned integers, are also expressed in int. If it exceeds PHP_INT_MAX, it overflows natively, i.e. PHP_INT_MAX + 1 becomes PHP_INT_MIN, which is different from both mysqli's implementation and PHP's behaviour.
  • Timestamps will be converted to a date()-compatible UNIX timestamp in seconds.
  • Other types are juggled according to rules provided by the backend.

If the query has multiple columns with the same name, the latter one overwrites the former ones. For example, the query SELECT 1 a, 2 a returns the result set [ ["a" => 2] ].

Also note that qualifying the column reference with the table name will not add the table name into the column name in the result set. For example, the query SELECT foo.qux, bar.qux will return the result set [ ["qux" => "the value in bar.qux"] ].

Therefore, use column aliases when the column names may duplicate.

Returns
array[]

Definition at line 67 of file SqlSelectResult.php.


The documentation for this class was generated from the following file: