reportmonster/const.py
2022-08-08 07:49:53 +00:00

29 lines
2.1 KiB
Python

QUERY_HTML_CERT_ISSUES = "SELECT * FROM mdl_htmlcert_issues"
QUERY_HTML_CERT = "SELECT * FROM mdl_htmlcert"
QUERY_CUSTOM_CERT_ISSUES = "SELECT * FROM mdl_customcert_issues"
QUERY_CUSTOM_CERT = "SELECT * FROM mdl_customcert"
QUERY_USER = "SELECT * FROM mdl_user"
QUERY_USER_INFO_FIELD = "SELECT * FROM mdl_user_info_field"
QUERY_USER_INFO_DATA = "SELECT * FROM mdl_user_info_data"
QUERY_USER_SET_PASSWORD = "UPDATE mdl_user SET password = %s WHERE username = %s"
QUERY_USER_SET_EMAIL = "UPDATE mdl_user SET email = %s WHERE id = %s"
QUERY_USER_CREATE = "INSERT INTO mdl_user(username, email, firstname, lastname, timecreated, timemodified, mnethostid, confirmed) VALUES (%s, %s, %s, %s, %s, %s, 1, 1)"
QUERY_ASSIGN_ROLE = "INSERT INTO mdl_role_assignments(roleid, contextid, userid, timemodified) VALUES (%s, %s, %s, %s)"
QUERY_GET_ROLE = "SELECT * FROM mdl_role_assignments WHERE contextid = %s AND userid = %s"
QUERY_GET_USERID = "SELECT * FROM mdl_user WHERE username = %s"
QUERY_USER_GET_PASSWORD = "SELECT password FROM mdl_user WHERE id = %s"
QUERY_COURSE = "SELECT * FROM mdl_course"
QUERY_ENROL = "SELECT * FROM mdl_enrol"
QUERY_ENROL_INSERT = "INSERT INTO mdl_enrol(enrol, courseid) VALUES (%s, %s)"
QUERY_ENROL_USER = "INSERT INTO mdl_user_enrolments(enrolid, userid, timecreated, timemodified) VALUES (%s, %s, %s, %s)"
QUERY_ENROLMENTS = "SELECT u.username AS username, c.shortname AS courseid, ue.timecreated AS timecreated FROM mdl_user_enrolments ue JOIN mdl_user u ON u.id = ue.userid JOIN mdl_enrol e ON ue.enrolid = e.id JOIN mdl_course c ON e.courseid = c.id"
QUERY_COURSE_CONTEXT = "SELECT * FROM mdl_context WHERE contextlevel = 50 AND instanceid = %s"
QUERY_COURSE_CONTEXT_REVERSE = "SELECT * FROM mdl_context WHERE id = %s"
QUERY_COURSE_FIELDS = "SELECT * FROM mdl_customfield_category cat JOIN mdl_customfield_field fld ON fld.categoryid = cat.id JOIN mdl_customfield_data dat ON dat.fieldid = fld.id"
QUERY_COURSE_MODULES = "SELECT * FROM mdl_course_modules WHERE course = %s"
QUERY_MODULE_COMPLETION = "SELECT * FROM mdl_course_modules_completion WHERE coursemoduleid = %s"
QUERY_WHERE_TIMESTAMPS = "WHERE %(column)s >= %(after)i AND %(column)s < %(before)i"