Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Public Member Functions | List of all members
moodle_recordset Class Reference

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

Inheritance diagram for moodle_recordset:
mysqli_native_moodle_recordset oci_native_moodle_recordset pdo_moodle_recordset pgsql_native_moodle_recordset question_test_recordset sqlsrv_native_moodle_recordset

Public Member Functions

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

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, sqlsrv_native_moodle_recordset, and question_test_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: