Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
moodle_recordset Class Reference

Abstract class for resultsets returned from database functions. More...

Inheritance diagram for moodle_recordset:

Public Member Functions

 close ()
 Did we reach the end?
 
 rewind ()
 Returns current record - fields as object properties, lowercase.
 

Detailed Description

Abstract class for resultsets returned from database functions.

This is a simple Iterator with needed recorset closing support.

The difference from old recorset is that the records are returned as objects, not arrays. You should use "foreach ($recordset as $record) {}" followed by "$recordset->close()".

Do not forget to close all recordsets when they are not needed anymore!

Member Function Documentation

◆ close()

moodle_recordset::close ( )
abstract

Did we reach the end?

Return values
booleanFree resources and connections, recordset can not be used anymore.
void

Reimplemented in mysqli_native_moodle_recordset, oci_native_moodle_recordset, pdo_moodle_recordset, pgsql_native_moodle_recordset, question_test_recordset, and sqlsrv_native_moodle_recordset.

◆ rewind()

moodle_recordset::rewind ( )

Returns current record - fields as object properties, lowercase.

Return values
objectReturns the key of current row
intcurrent row Moves forward to next row
voidRewinds are not supported!
void

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