This is one followup of
From time to time some reserved words are used in some of these places:
A - Table/column names: Already detected by the XMLDB Editor (edition time + report).
B - Table/column aliases (AS xxx): Not detected
C - Query placeholders (named params): Not detected.
The basic idea is to implement some mechanism in order to be able to detect B & C bad uses on development time, instead of using hacks (like
MDL-28080 was for Oracle).
So here it's the initial draft for further discussion:
1) The detection only will be invoked under debug developer mode.
2) The reserved words for all the moodle BD drivers will be loaded (per request)
3) Each invoked sql and placeholders will be analyzed looking for reserved words
4) One exception / debugging (to decide) will be thrown if bad uses are found
5) Once implemented, and used along a complete development cycle (to have time to detect all bad uses and fix them)
MDL-28080 could be out.
6) Any remaining bad use will be fixed each time it is detected (note this only will affect production sites running Oracle, unique using named placeholders for now). So impact in all the rest of DB will be zero. But any new code will be safer and won't be using the offending (reserved) words.
Sounds simple, sure it is not,
Comments and ideas are welcome, ciao