Note:

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

XMLDB key and index naming

From MoodleDocs
Revision as of 22:51, 9 August 2006 by Eloy Lafuente (stronk7) (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Every object in the DB have its own name. It's easy to know about table names and field names, but other objects, like keys, indexes, sequences... are created with some names difficult to know/understand. This page will try to explain a bit how all those objects will be named by the XMLDB generators in a compressive way.

First of all, you should know that, under the XMLDB Schema files everything is named easily, mainly because there are some exact conventions to follow. Basically, every key and index is named with one string that is the result of concatenating all the field names in the object, separated by "-". So, if we have one index over the fields "fieldA" and "fieldB" the index, in the XMLDB Files will be named "fieldA-fieldB". Simple!

But these resulting names aren't going to be the final names used to create the DB structure by the XMLDB generators. There we'll follow one nomenclature widely used by a lot of DB applications, that provides us with:

  1. One standard naming convention.
  2. The ability to know what's wrong when some key/index is throwing any error.
  3. The capability to have multiple Moolde servers running under the same DB.

Also, note that all these rules will be applied automatically by the XMLDB generators, so the object will be created with their correct names and you won't need to use such names directly, but under some special circumstances.