Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-29217

Detect uses of reserved words as placeholders in developer mode

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.0.4, 2.1.1, 2.2, 2.3
    • Fix Version/s: DEV backlog
    • Component/s: Database SQL/XMLDB
    • Labels:
    • Database:
      Any
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE, MOODLE_23_STABLE

      Description

      This is one followup of MDL-28080

      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

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              stronk7 Eloy Lafuente (stronk7)
              Participants:
              Component watchers:
              Jake Dallimore, Jun Pataleta
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated: