Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
3.11.6, 4.0
-
MOODLE_311_STABLE, MOODLE_400_STABLE
-
MOODLE_311_STABLE
-
MDL-74283-311 -
Description
While nowadays all the main databases have a CONCAT() function (some years ago that was not the case), they don't provide a full cross-db experience.
- Some are not able to concatenate non-char types.
- Others have a non-standard (SQL92 from memory) behaviour with NULLs.
Because of that, the sql_concat() helper method was created. It provides custom code to make all databases to behave consistently.
Right now there are a few (3 I've been able to find, though the search was not super-intensive) cases in core using the SQL native function:
$ ag -i ' concat\(' --php | ag 'SELECT|FROM|AND|OR|WHERE|ORDER'
|
lib/classes/task/manager.php:989: FROM (SELECT concat('s', ts.id) as uniqueid,
|
lib/classes/task/manager.php:1000: SELECT concat('a', ta.id) as uniqueid,
|
h5p/tests/h5p_file_storage_test.php:821: $sql = "SELECT concat(filepath, filename)
|
This issues is about to move them to use the helper function and verify that everything continues working ok (it should).
Ciao