Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | List of all members
qubaid_condition Class Reference

This class represents a restriction on the set of question_usage ids to include in a larger database query. More...

Inheritance diagram for qubaid_condition:
qubaid_join qubaid_list mod_quiz\question\qubaids_for_users_attempts qubaids_for_quiz qubaids_for_quiz_user

Public Member Functions

 from_question_attempts ($alias)
 Get the SQL fragment to go in a FROM clause. More...
 
 from_where_params ()
 
 get_hash_code ()
 
 usage_id_in ()
 
 usage_id_in_params ()
 
 where ()
 

Detailed Description

This class represents a restriction on the set of question_usage ids to include in a larger database query.

Depending of the how you are going to restrict the list of usages, construct an appropriate subclass.

If $qubaids is an instance of this class, example usage might be

SELECT qa.id, qa.maxmark FROM $qubaids->from_question_attempts('qa') WHERE $qubaids->where() AND qa.slot = 1

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

Member Function Documentation

◆ from_question_attempts()

qubaid_condition::from_question_attempts (   $alias)
abstract

Get the SQL fragment to go in a FROM clause.

The SQL that needs to go in the FROM clause when trying to select records from the 'question_attempts' table based on this qubaid_condition.

Parameters
string$alias
Return values
stringSQL fragment.

Reimplemented in qubaid_join, and qubaid_list.

◆ from_where_params()

qubaid_condition::from_where_params ( )
abstract
Return values
arraythe params needed by a query that uses } and where().

Reimplemented in qubaid_join, and qubaid_list.

◆ get_hash_code()

qubaid_condition::get_hash_code ( )
Return values
string40-character hash code that uniquely identifies the combination of properties and class name of this qubaid condition.

◆ usage_id_in()

qubaid_condition::usage_id_in ( )
abstract
Return values
stringSQL that can use used in a WHERE qubaid IN (...) query. This method returns the "IN (...)" part.

Reimplemented in qubaid_join, and qubaid_list.

◆ usage_id_in_params()

qubaid_condition::usage_id_in_params ( )
abstract
Return values
arraythe params needed by a query that uses usage_id_in().

Reimplemented in qubaid_join, and qubaid_list.

◆ where()

qubaid_condition::where ( )
abstract
Return values
stringthe SQL that needs to go in the where clause.

Reimplemented in qubaid_join, and qubaid_list.


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