1 |
efrain |
1 |
<?php
|
|
|
2 |
// This file is part of Moodle - http://moodle.org/
|
|
|
3 |
//
|
|
|
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.
|
|
|
8 |
//
|
|
|
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.
|
|
|
13 |
//
|
|
|
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/>.
|
|
|
16 |
|
|
|
17 |
/**
|
|
|
18 |
* This file contains all the constants and variables used
|
|
|
19 |
* by the XMLDB interface
|
|
|
20 |
*
|
|
|
21 |
* @package core_xmldb
|
|
|
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
|
|
|
25 |
*/
|
|
|
26 |
|
|
|
27 |
defined('MOODLE_INTERNAL') || die();
|
|
|
28 |
|
|
|
29 |
|
|
|
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);
|
|
|
39 |
|
|
|
40 |
// ==== Now the allowed DB Field Types ====
|
|
|
41 |
/** Wrong DB Type */
|
|
|
42 |
define ('XMLDB_TYPE_INCORRECT', 0);
|
|
|
43 |
/** Integer */
|
|
|
44 |
define ('XMLDB_TYPE_INTEGER', 1);
|
|
|
45 |
/** Decimal number */
|
|
|
46 |
define ('XMLDB_TYPE_NUMBER', 2);
|
|
|
47 |
/** Floating Point number */
|
|
|
48 |
define ('XMLDB_TYPE_FLOAT', 3);
|
|
|
49 |
/** String */
|
|
|
50 |
define ('XMLDB_TYPE_CHAR', 4);
|
|
|
51 |
/** Text */
|
|
|
52 |
define ('XMLDB_TYPE_TEXT', 5);
|
|
|
53 |
/** Binary */
|
|
|
54 |
define ('XMLDB_TYPE_BINARY', 6);
|
|
|
55 |
/** Datetime */
|
|
|
56 |
define ('XMLDB_TYPE_DATETIME', 7);
|
|
|
57 |
/** Timestamp */
|
|
|
58 |
define ('XMLDB_TYPE_TIMESTAMP', 8);
|
|
|
59 |
|
|
|
60 |
// ==== Now the allowed DB Keys ====
|
|
|
61 |
/** Wrong DB Key */
|
|
|
62 |
define ('XMLDB_KEY_INCORRECT', 0);
|
|
|
63 |
/** Primary Keys */
|
|
|
64 |
define ('XMLDB_KEY_PRIMARY', 1);
|
|
|
65 |
/** Unique Keys */
|
|
|
66 |
define ('XMLDB_KEY_UNIQUE', 2);
|
|
|
67 |
/** Foreign Keys */
|
|
|
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);
|
|
|
73 |
|
|
|
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);
|
|
|
85 |
|
|
|
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);
|