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

Data manipulation API external table check

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.3.1
    • Fix Version/s: None
    • Component/s: Database SQL/XMLDB
    • Labels:
      None
    • Affected Branches:
      MOODLE_33_STABLE

      Description

      I would like to propose a data API function to check the presence of an external database table.

       
      $DB->database_exists
      1,0 or True/False

      $DB->databasetable_exists
      1,0 or True/False

      I propose this because when developing a custom plugin relying on external data, there are times where (if the table disappears) it would be better to not load data contained in the table rather than prevent the whole plugin from loading with the following error:

       
      Error reading from database

      More information about this error

       

      You can then add an IF statement to check whether the table exists and then take the appropriate action. At the moment, this is not possible.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              acheckley Andrew C
              Participants:
              Component watchers:
              Jake Dallimore, Jun Pataleta
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: