MDL-60029 profile: Replace table alias with non-reserve word

* The table alias 'uid' is a reserved word in oracle. Replaced it with
something a little more safe.
This commit is contained in:
Jun Pataleta 2017-10-13 10:38:00 +08:00
parent 14de134454
commit 5a3f03b2a8

View File

@ -508,12 +508,12 @@ function profile_get_user_fields_with_data($userid) {
// Join any user info data present with each user info field for the user object.
$sql = 'SELECT uif.*, uic.name AS categoryname ';
if ($userid) {
$sql .= ', uid.id AS hasuserdata, uid.data, uid.dataformat ';
$sql .= ', uind.id AS hasuserdata, uind.data, uind.dataformat ';
}
$sql .= 'FROM {user_info_field} uif ';
$sql .= 'LEFT JOIN {user_info_category} uic ON uif.categoryid = uic.id ';
if ($userid) {
$sql .= 'LEFT JOIN {user_info_data} uid ON uif.id = uid.fieldid AND uid.userid = :userid ';
$sql .= 'LEFT JOIN {user_info_data} uind ON uif.id = uind.fieldid AND uind.userid = :userid ';
}
$sql .= 'ORDER BY uic.sortorder ASC, uif.sortorder ASC ';
$fields = $DB->get_records_sql($sql, ['userid' => $userid]);