Closed dasistwas closed 2 years ago
i have solved this issue with postgress when i was installing the plugin i have changed the value of $sql to be like this
$sql .= " LIMIT 0 OFFSET 1";
since that postgress doesn't understand this syntax LIMIT 0,1
You can just delete the line. It is not necessary.
In the current version, yes. But it was designed that way to provide a few features in future, like course based support levels or responsibilities.
Therefore we should correct the statement to be compatible with PostreSQL instead of deleting the line.
The "get_record_sql" method only gets a single entry per definition. If that is going to be changed, it would be better to use "get_records_select" in order to stay compatible with any DB supported by Moodle that would be preferable.
https://docs.moodle.org/dev/Data_manipulation_API#get_records_select
All what you have now in the sql-Statement can be managed by the API call
$DB->get_records_select($table, $select, array $params=null, $sort='', $fields='*', $limitfrom=0, $limitnum=0)
You can even set a limit if you want to have only one result for now and later expand to multiple results.
But I am not fully aware of the future changes so I might be wrong as well.
https://github.com/center-for-learning-management/moodle-local_edusupport/blob/acdc61ff2068f46df142cf92fed7b3fe6ed5ff9e/classes/lib.php#L442
Zeile 442 kann man ersatzlos streichen, da get_record_sql ohnehin nur einen Eintrag liefert.