Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Data definition API

From MoodleDocs

Starting with Moodle 1.7, an important change has been done to practically all the DB abstraction layer in order to improve the number of RDBMS supported by Moodle.

One of the basic points to achieve this improvement is to have a well-defined group of functions able to handle all the DB structure (DDL statements) using one neutral description, being able to execute the correct SQL statements required by each RDBMS. All these functions are used exclusively by the installation and upgrade processes.

In this page you'll see a complete list of such functions, with some explanations, tricks and examples of their use. If you are interested, it's also highly recommendable to take a look to the DML functions page where everything about how to handle DB data (select, insert, update, delete i.e. DML statements) is defined.

Of course, feel free to clarify, complete and add more info to all this documentation. It will be welcome, absolutely!

Main info

The functions

See also

  • XML database schema: Main page of the whole XMLDB documentation, where all the process is defined and all the related information resides.
  • XMLDB Defining one XML structure: Where you will know a bit more about the underlying XML structure used to define the DB objects, that is used continuously by the functions described in this page.
  • DML functions: Where all the functions used to handle DB data (DML) are defined.