2 // This file is part of Moodle - http://moodle.org/
4 // Moodle is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
9 // Moodle is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
18 * This file contains all the constants and variables used
19 * by the XMLDB interface
22 * @copyright 1999 onwards Martin Dougiamas http://dougiamas.com
23 * 2001-3001 Eloy Lafuente (stronk7) http://contiento.com
24 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
27 defined('MOODLE_INTERNAL') ||
die();
30 // ==== First, some constants to be used by actions ====
31 /** Default flags for class */
32 define('ACTION_NONE', 0);
33 /** The invoke function will return HTML */
34 define('ACTION_GENERATE_HTML', 1);
35 /** The invoke function will return HTML */
36 define('ACTION_GENERATE_XML', 2);
37 /** The class can have subaction */
38 define('ACTION_HAVE_SUBACTIONS', 1);
40 // ==== Now the allowed DB Field Types ====
42 define ('XMLDB_TYPE_INCORRECT', 0);
44 define ('XMLDB_TYPE_INTEGER', 1);
46 define ('XMLDB_TYPE_NUMBER', 2);
47 /** Floating Point number */
48 define ('XMLDB_TYPE_FLOAT', 3);
50 define ('XMLDB_TYPE_CHAR', 4);
52 define ('XMLDB_TYPE_TEXT', 5);
54 define ('XMLDB_TYPE_BINARY', 6);
56 define ('XMLDB_TYPE_DATETIME', 7);
58 define ('XMLDB_TYPE_TIMESTAMP', 8);
60 // ==== Now the allowed DB Keys ====
62 define ('XMLDB_KEY_INCORRECT', 0);
64 define ('XMLDB_KEY_PRIMARY', 1);
66 define ('XMLDB_KEY_UNIQUE', 2);
68 define ('XMLDB_KEY_FOREIGN', 3);
69 /** Check Constraints - NOT USED! */
70 define ('XMLDB_KEY_CHECK', 4);
71 /** Foreign Key + Unique Key */
72 define ('XMLDB_KEY_FOREIGN_UNIQUE',5);
74 // ==== Some other useful Constants ====
75 /** If the field is going to be unsigned @deprecated since 2.3 */
76 define ('XMLDB_UNSIGNED', true);
77 /** If the field is going to be not null */
78 define ('XMLDB_NOTNULL', true);
79 /** If the field is going to be a sequence */
80 define ('XMLDB_SEQUENCE', true);
81 /** If the index is going to be unique */
82 define ('XMLDB_INDEX_UNIQUE', true);
83 /** If the index is NOT going to be unique */
84 define ('XMLDB_INDEX_NOTUNIQUE',false);
86 // ==== Some strings used widely ====
87 /** New line in xmldb generated files */
88 define ('XMLDB_LINEFEED', "\n");
89 /** Upgrade start in upgrade.php */
90 define ('XMLDB_PHP_HEADER', ' if ($oldversion < XXXXXXXXXX) {' . XMLDB_LINEFEED
);
91 /** Upgrade end in upgrade.php */
92 define ('XMLDB_PHP_FOOTER', ' }' . XMLDB_LINEFEED
);