Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Public Member Functions | List of all members
core\log\sql_reader Interface Reference

Log iterator reader interface. More...

Inheritance diagram for core\log\sql_reader:
core\log\reader core\log\sql_internal_table_reader logstore_database\log\store logstore_legacy\log\store logstore_standard\log\store

Public Member Functions

 get_description ()
 Longer description of the log data source. More...
 
 get_events_select ($selectwhere, array $params, $sort, $limitfrom, $limitnum)
 Fetch records using given criteria. More...
 
 get_events_select_count ($selectwhere, array $params)
 Return number of events matching given criteria. More...
 
 get_events_select_iterator ($selectwhere, array $params, $sort, $limitfrom, $limitnum)
 Fetch records using the given criteria returning an traversable list of events. More...
 
 get_log_event ($data)
 Returns an event from the log data. More...
 
 get_name ()
 Localised name of the reader. More...
 
 is_logging ()
 Are the new events appearing in the reader? More...
 

Detailed Description

Log iterator reader interface.

Replaces sql_select_reader adding functions to return iterators.

Since
Moodle 2.9
License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ get_description()

core\log\reader::get_description ( )
inherited

Longer description of the log data source.

Return values
string

◆ get_events_select()

core\log\sql_reader::get_events_select (   $selectwhere,
array  $params,
  $sort,
  $limitfrom,
  $limitnum 
)

Fetch records using given criteria.

Parameters
string$selectwhere
array$params
string$sort
int$limitfrom
int$limitnum
Return values
core::event::base[]

Implemented in logstore_database\log\store, logstore_legacy\log\store, and logstore_standard\log\store.

◆ get_events_select_count()

core\log\sql_reader::get_events_select_count (   $selectwhere,
array  $params 
)

Return number of events matching given criteria.

Parameters
string$selectwhere
array$params
Return values
int

Implemented in logstore_database\log\store, logstore_legacy\log\store, and logstore_standard\log\store.

◆ get_events_select_iterator()

core\log\sql_reader::get_events_select_iterator (   $selectwhere,
array  $params,
  $sort,
  $limitfrom,
  $limitnum 
)

Fetch records using the given criteria returning an traversable list of events.

Note that the returned object is Traversable, not Iterator, as we are returning EmptyIterator if we know there are no events, and EmptyIterator does not implement Countable so valid() should be checked in any case instead of a count().

Also note that the traversable object contains a recordset and it is very important that you close it after using it.

Parameters
string$selectwhere
array$params
string$sort
int$limitfrom
int$limitnum
Return values
Traversable|core::event::base[]Returns an iterator containing core\event\base objects.

Implemented in logstore_database\log\store, logstore_legacy\log\store, and logstore_standard\log\store.

◆ get_log_event()

core\log\sql_reader::get_log_event (   $data)

Returns an event from the log data.

Parameters
stdClass$dataLog data
Return values
core::event::base

Implemented in logstore_database\log\store, logstore_legacy\log\store, and logstore_standard\log\store.

◆ get_name()

core\log\reader::get_name ( )
inherited

Localised name of the reader.

To be used in selection for in reports.

Return values
string

◆ is_logging()

core\log\reader::is_logging ( )
inherited

Are the new events appearing in the reader?

Return values
booltrue means new log events are being added, false means no new data will be added

Implemented in logstore_database\log\store, logstore_legacy\log\store, and logstore_standard\log\store.


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